histCorr.C 11.9 KB
Newer Older
Muzalevsky I.A's avatar
Muzalevsky I.A committed
1 2 3
#include "TH2F.h"
#include "TH3F.h"
#include "TStyle.h"
4 5
#include "TMath.h"
#include "TF1.h"
6

7
void histCorr(
Muzalevsky I.A's avatar
Muzalevsky I.A committed
8

9 10
	const Bool_t can1 = 0, const Bool_t can2 = 0,
	const Bool_t can3 = 1, const Bool_t can4 = 0,
11 12
	const Bool_t can5 = 0, const Bool_t can6 = 0) // tLEd and CFD for colollinated and NONcollimated data

13
{
14 15 16 17
	//TString foldername = "30_06
	Double_t rMin;
	Double_t rMax;
	TF1 *g1 = new TF1("g1","gaus",0,100);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
18 19
	using std::cout;
	using std::endl;
20
	gSystem->Load("../libData.so");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
21
//	TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root");
22
	TFile *f = new TFile("../data/dataTektronix/GSItests/1000V_trigg5mv/analize.root");
23

24 25
	//TFile *f = new TFile("../data/dataTektronix/GSItests/1000V_trigg5mv/analize.root");
	TTree *t = (TTree*)f->Get("atree");
26

27 28
		gStyle->SetOptFit();
	if (can1) {
Muzalevsky I.A's avatar
Muzalevsky I.A committed
29 30
		TCanvas *c1 = new TCanvas("c5", "Changing CFD parameters");
		c1->Divide(2,2);
31
		c1->cd(1);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
32

33 34 35 36
		g1->SetParLimits(0,1e+2,1e+4);
		g1->SetParLimits(1,-100,100);
		g1->SetParLimits(2,0.1,10);

37 38 39 40 41
		TH1F *h1 = new TH1F("h1", "tau_CFD",100, 3., 20.);
//		t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","(Ach0.fTimeCFD - Ach1.fTimeCFD) < 20 && (Ach0.fTimeCFD - Ach1.fTimeCFD) > -20 && (Ach0.fTimeThreshBack - Ach0.fTimeThresh)>0 && (Ach0.fTimeThreshBack - Ach0.fTimeThresh)>3","");
		t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","(Ach0.fTimeCFD - Ach1.fTimeCFD) < 20 && (Ach0.fTimeCFD - Ach1.fTimeCFD) > 3","");
		h1->GetXaxis()->SetRangeUser(3, 20);
		h1->GetXaxis()->SetTitle("tauCFD [ns]");
42
		h1->GetXaxis()->CenterTitle();
43 44 45
		//g1->SetRange(2.8,6.5);
		//h1->Fit("g1","R");
		//cout<<"sigma= "<<g1->GetParameter(2)<<endl
46 47

		c1->cd(2);
48 49 50
		TH1F *h2 = new TH1F("h2", "tau_LED",100, 3., 20.);
		h2->GetXaxis()->SetRangeUser(3, 20);
		t->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h2","(Ach0.fTimeLED - Ach1.fTimeLED) < 20 && (Ach0.fTimeLED - Ach1.fTimeLED) > 3","");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
51

52
		h2->GetXaxis()->SetTitle("tauLED [ns]");
53
		h2->GetXaxis()->CenterTitle();
54 55 56 57 58 59 60
		g1->SetRange(3.6,7);
	//	h2->Fit("g1","R");
		//cout<<"sigma= "<<g1->GetParameter(2)<<endl;



		//c1->Print("../data/dataTektronix/GSItests/1000V_trigg10mv/30_06_10mv_35mv/pic/tauLEDCFD.gif");
61 62
	}

63 64 65
	if (can2) { ///  ToT pics
		gStyle->SetOptFit();
		TCanvas *c2 = new TCanvas("c2", "Threshold properties");
66
		c2->Divide(2,2);
67

68
		TH1F *h5 = new TH1F("h5", "time of 25mv back threshold trigger", 300, 0 ,100);
69
		c2->cd(1);
70 71 72 73
		//t->Draw("Ach0.fTimeThreshBack >> h5","Ach0.fTimeThreshBack>40 && Ach0.fTimeThreshBack<60 ","");
		t->Draw("Ach0.fTimeThreshBack");
		//h5->GetXaxis()->SetRangeUser(40, 60);
		h5->GetXaxis()->SetTitle("time thresh back [ns]");
74
		h5->GetXaxis()->CenterTitle();
75
		c2->Update();
76 77 78 79
		rMin = 50.67;
		rMax = 53.33;
		//g1->SetRange(rMin,rMax);
		//h5->Fit("g1","R");
80

81
		TH1F *h6 = new TH1F("h6", "Time over my Threshold trigg", 100, 0 ,10);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
82
		c2->cd(2);
83 84 85
		//t->Draw("Ach0.fTimeThreshBack - Ach0.fTimeThresh >> h6 ","(Ach0.fTimeThreshBack - Ach0.fTimeThresh)>0 && (Ach0.fTimeThreshBack - Ach0.fTimeThresh)<10","");
		//h6->GetXaxis()->SetRangeUser(0, 10);
		h6->GetXaxis()->SetTitle("time over my threshold [ns]");
86
		h6->GetXaxis()->CenterTitle();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
87
		c2->Update();
88 89 90 91 92 93
		rMin = 50.67;
		rMax = 53.33;
		//g1->SetRange(rMin,rMax);
		//h6->Fit("g1","R");
/*
		TH1F *h7 = new TH1F("h7", "time of 25mv back threshold nontrigg", 300, 0 ,100);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
94
		c2->cd(3);
95 96 97 98
		t->Draw("Ach1.fTimeThreshBack >> h7","Ach1.fTimeThreshBack>40 && Ach1.fTimeThreshBack<60","");
		//t->Draw("Ach1.fTimeThreshBack ");
		//h7->GetXaxis()->SetRangeUser(40, 60);
		h7->GetXaxis()->SetTitle("time thresh back [ns]");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
99 100
		h7->GetXaxis()->CenterTitle();
		c2->Update();
101 102 103 104
		rMin = 45.67;
		rMax = 49.67;
		//g1->SetRange(rMin,rMax);
		//h7->Fit("g1","R");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
105 106


107
		TH1F *h8 = new TH1F("h8", "Time over my Threshold nontrigg", 100, 0 ,10);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
108
		c2->cd(4);
109 110 111
		t->Draw("Ach1.fTimeThreshBack - Ach1.fTimeThresh >> h8 ","(Ach1.fTimeThreshBack - Ach1.fTimeThresh)>0 && (Ach1.fTimeThreshBack - Ach1.fTimeThresh)<10","");
		//h8->GetXaxis()->SetRangeUser(0, 10);
		h8->GetXaxis()->SetTitle("time over my threshold [ns]");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
112
		h8->GetXaxis()->CenterTitle();
113
		c2->Update();
114 115 116 117
		rMin = 50.67;
		rMax = 53.33;
		//g1->SetRange(rMin,rMax);
		//h6->Fit("g1","R");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
118

119 120 121 122 123 124 125 126 127 128 129 130
		/*TH1F *h7 = new TH1F("h7", "Time over 50% Threshold", 100, 0 ,10);
		c2->cd(3);
		t->Draw("Ach0.fToT >> h7","Ach0.fToT>0 && Ach0.fToT<10","");
		h7->GetXaxis()->SetRangeUser(0, 10);
		h7->GetXaxis()->SetTitle("time over 50% threshold [ns]");
		h7->GetXaxis()->CenterTitle();
		c2->Update();
		rMin = 50.67;
		rMax = 53.33;
		g1->SetRange(rMin,rMax);
		//h7->Fit("g1","R");*/
		//c2->Print("../data/dataTektronix/GSItests/1000V_trigg10mv/30_06_10mv_35mv/pic/ToTtimes.gif");*/
131
	}
132

133
	if (can3) {
Muzalevsky I.A's avatar
Muzalevsky I.A committed
134
		TCanvas *c3 = new TCanvas("c3", "Correlation pictures: Integrals and amplitudes");
135 136
		//c3->Divide(2,2);
		t->Draw("Ach0.fChargeTF - Ach1.fChargeTF");
137

138
		/*TH2F *h9 = new TH2F("h9", "tau_led vs chargeLed KOLLIMATED", 200, 0 ,5e-10, 200, 5, 15);
139
		c3->cd(1);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
140
		t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h9","","col");
141
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
142 143 144 145 146
		h9->GetXaxis()->SetTitle("Charge [kl]");
		h9->GetXaxis()->CenterTitle();
		//y
		h9->GetYaxis()->SetTitle("tauLED [ns]");
		h9->GetYaxis()->CenterTitle();
147

Muzalevsky I.A's avatar
Muzalevsky I.A committed
148
		TH2F *h10 = new TH2F("h10", "tau_led vs chargeLed NONKOLLIMATED", 200, 0 ,8e-10, 200, -10, 5);
149
		c3->cd(3);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
150
		t->Draw("Ach0.fTimeLED - Ach3.fTimeLED : Ach0.fChargeLED >> h10","","col");
151
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
152 153
		h10->GetXaxis()->SetTitle("Charge [kl]");
		h10->GetXaxis()->CenterTitle();
154
		//y
Muzalevsky I.A's avatar
Muzalevsky I.A committed
155 156 157
		h10->GetYaxis()->SetTitle("tauLED [ns]");
		h10->GetYaxis()->CenterTitle();

158
		c3->Update();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
159 160

		TH2F *h11 = new TH2F("h11", "tauLED vs summCharge COLLIMATED", 200, 0 ,1e-9, 200, 5, 15);
161
		c3->cd(2);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
162
		t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED  : Ach0.fChargeLED + Ach1.fChargeLED >> h11","","col");
163
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
164 165 166 167 168
		h11->GetXaxis()->SetTitle("Summ_Charge [kl]");
		h11->GetXaxis()->CenterTitle();
		//y
		h11->GetYaxis()->SetTitle("tau_LED [V]");
		h11->GetYaxis()->CenterTitle();
169

Muzalevsky I.A's avatar
Muzalevsky I.A committed
170 171
		c3->Update();
		TH2F *h12 = new TH2F("h12", "tau_led vs summCharge NONKOLLIMATED", 200, 0 ,8e-10, 200, -10, 5);
172
		c3->cd(4);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
173 174 175 176 177 178 179
		t->Draw("Ach0.fTimeLED - Ach3.fTimeLED : Ach0.fChargeLED + Ach3.fChargeLED >> h12","","col");
		//x
		h12->GetXaxis()->SetTitle("Summ_Charge [kl]");
		h12->GetXaxis()->CenterTitle();
		//y
		h12->GetYaxis()->SetTitle("tauLED [ns]");
		h12->GetYaxis()->CenterTitle();
180 181
		c3->Update();

Muzalevsky I.A's avatar
Muzalevsky I.A committed
182

183
		//c3->Print(Form("../macros/picsDRS4/%s/tauVSCHARGE%s", foldername, ext));*/
184 185
	}

186
	if (can4) {
187

188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
		gStyle->SetOptFit();

		TCanvas *c4 = new TCanvas("c4", "time rising edge and full charge");
		c4->Divide(2,2);
		c4->cd(1);
		TH1F *h13 = new TH1F("h13", "Time front line crossing zero line trigg",300, 38., 52. );
		t->Draw("Ach0.fTimeFront >> h13","Ach0.fTimeFront > 38 && Ach0.fTimeFront < 52","");
		h13->GetXaxis()->SetRangeUser(38, 52);
		h13->GetXaxis()->SetTitle("TimeFront [ns]");
		h13->GetXaxis()->CenterTitle();
		g1->SetRange(49.35,49.9);
		h13->Fit("g1","R");

		c4->cd(2);
		TH1F *h141 = new TH1F("h141", "Time front line crossing zero line nontrigg",300, 38., 52. );
		t->Draw("Ach1.fTimeFront >> h141","Ach1.fTimeFront > 38 && Ach1.fTimeFront < 52 ","");
		h141->GetXaxis()->SetRangeUser(38, 52);
		h141->GetXaxis()->SetTitle("TimeFront [ns]");
		h141->GetXaxis()->CenterTitle();
		g1->SetRange(49.35,49.9);
		//h14->Fit("g1","R");

		c4->cd(3);
		TH1F *h16 = new TH1F("h14", "tau Front Time",300, -10, 10. );
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront");
		h16->GetXaxis()->SetRangeUser(38, 52);
		h16->GetXaxis()->SetTitle("tau Front time [ns]");
		h16->GetXaxis()->CenterTitle();
		g1->SetRange(49.35,49.9);
		//h14->Fit("g1","R");

		c4->cd(4);
		TH1F *h15 = new TH1F("h15", "summCharge",300, 0., 0.4. );
		t->Draw("Ach0.fChargeLED + Ach1.fChargeLED>>h15","Ach0.fChargeLED + Ach1.fChargeLED<0.4","");
		h15->GetXaxis()->SetRangeUser(0, 0.4);
		h15->GetXaxis()->SetTitle("FullCharge");
		h15->GetXaxis()->CenterTitle();
		//h14->Fit("g1","R");
		c4->Print("../data/dataTektronix/GSItests/1000V_trigg10mv/30_06_10mv_35mv/pic/front&Charge.gif");
227 228

	}
229

230 231
	if (can5) {
		TCanvas *c5 = new TCanvas("c5", "Changing CFD parameters");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
232
		c5->Divide(2,2);
233
		c5->cd(1);
234

235 236 237 238 239 240 241 242 243 244 245 246
		rMin[0]= 138.4; rMax[0] = 140.4;
		rMin[1]= 137; rMax[1] = 138.4;
		rMin[2]= 136.4; rMax[2] = 142.4;
		rMin[3]= 135.2; rMax[3] = 141.4;


//		TF1 *gaus5 = new TF1("gaus5","TMath:gaus(0)");
		TF1 *g5 = new TF1("g5","gaus",135,140);
		g5->SetParLimits(0,1e+2,1e+4);
		g5->SetParLimits(1,10,1000);
		g5->SetParLimits(2,0.1,10);

247 248 249 250
		TH1F *h12 = new TH1F("h12", "tau_CFD triggered channel for NONcollimated data",1000, 0., 50);

		t->Draw("Ach0.fTimeCFD >> h12","","");
		//h12->GetXaxis()->SetRangeUser(132, 150);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
251
		h12->GetXaxis()->SetTitle("tauCFD_{0} [ns]");
252
		h12->GetXaxis()->CenterTitle();
253
		g5->SetRange(rMin[0],rMax[0]);
254
		//h12->Fit("g5","R");
255
		cout<<"sigma= "<<g5->GetParameter(2)<<endl;
256

Muzalevsky I.A's avatar
Muzalevsky I.A committed
257
		c5->cd(2);
258
		TH1F *h13 = new TH1F("h13", "tau LED triggered channel for NONcollimated data",1000, 0., 50);
259

260 261
		t->Draw("Ach0.fTimeLED >> h13","","");
		//h13->GetXaxis()->SetRangeUser(132, 150);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
262 263
		h13->GetXaxis()->SetTitle("tauLED_{0} [ns]");
		h13->GetXaxis()->CenterTitle();
264
		g5->SetRange(rMin[1],rMax[1]);
265
		//h13->Fit("g5","R");
266
		cout<<"sigma= "<<g5->GetParameter(2)<<endl;
267

Muzalevsky I.A's avatar
Muzalevsky I.A committed
268
		c5->cd(3);
269
		TH1F *h14 = new TH1F("h14", "tau_CFD nontriggered channel for NONcollimated data",1000	, 0., 50);
270

271 272
		t->Draw("Ach1.fTimeCFD >> h14","","");
		//h14->GetXaxis()->SetRangeUser(132, 150);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
273 274
		h14->GetXaxis()->SetTitle("tauCFD_{0} [ns]");
		h14->GetXaxis()->CenterTitle();
275
		g5->SetRange(rMin[2],rMax[2]);
276
		//h14->Fit("g5","R");
277
		cout<<"sigma= "<<g5->GetParameter(2)<<endl;
Muzalevsky I.A's avatar
Muzalevsky I.A committed
278 279

		c5->cd(4);
280
		TH1F *h15 = new TH1F("h15", "tau LED nontriggered channel for NONcollimated data",1000	, 0., 50);
281

282 283
		t->Draw("Ach1.fTimeLED >> h15","","");
		//h15->GetXaxis()->SetRangeUser(132, 	150);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
284 285
		h15->GetXaxis()->SetTitle("tauLED_{0} [ns]");
		h15->GetXaxis()->CenterTitle();
286
		g5->SetRange(rMin[3],rMax[3]);
287
		//h15->Fit("g5","R");
288
		cout<<"sigma= "<<g5->GetParameter(2)<<endl;
289
		c5->Update();
290

291
		//c5->Print(Form("../macros/picsDRS4/%s/NONcollimatedT%s", foldername, ext));
292
	}
293

294
	if (can6) {
Muzalevsky I.A's avatar
Muzalevsky I.A committed
295
		TCanvas *c6 = new TCanvas("c6", "Changing CFD parameters");
296
		c6->Divide(2,2);
297 298 299 300 301 302 303 304 305 306
		TF1 *g6 = new TF1("g6","gaus",135,140);
		//g6->SetParLimits(0,1e+2,1e+4);
		//g6->SetParLimits(1,10,1000);
		//g6->SetParLimits(2,0.1,10);

		rMin[0]= 138.8; rMax[0] = 140.2;
		rMin[1]= 137.4; rMax[1] = 138.4;
		rMin[2]= 125.6; rMax[2] = 131.6;
		rMin[3]= 125.8; rMax[3] = 131.4;

307
		c6->cd(1);
308

Muzalevsky I.A's avatar
Muzalevsky I.A committed
309
		TH1F *h16 = new TH1F("h16", "tau_CFD triggered channel for collimated data",1000, 0., 200);
310

Muzalevsky I.A's avatar
Muzalevsky I.A committed
311 312 313 314
		t1->Draw("Ach0.fTimeCFD >> h16","Ach0.fTimeCFD>132 && Ach0.fTimeCFD<142","");
		h16->GetXaxis()->SetRangeUser(120, 150);
		h16->GetXaxis()->SetTitle("tauCFD_{0} [ns]");
		h16->GetXaxis()->CenterTitle();
315 316 317 318
		g6->SetRange(rMin[0],rMax[0]);
		h16->Fit("g6","R");
		cout<<"sigma= "<<g6->GetParameter(2)<<endl;

319

Muzalevsky I.A's avatar
Muzalevsky I.A committed
320 321
		c6->cd(2);
		TH1F *h17 = new TH1F("h17", "tau LED triggered channel for collimated data",1000, 0., 200);
322

Muzalevsky I.A's avatar
Muzalevsky I.A committed
323 324 325 326
		t1->Draw("Ach0.fTimeLED >> h17","Ach0.fTimeLED>132 && Ach0.fTimeLED<142","");
		h17->GetXaxis()->SetRangeUser(120, 150);
		h17->GetXaxis()->SetTitle("tauLED_{0} [ns]");
		h17->GetXaxis()->CenterTitle();
327 328 329
		g6->SetRange(rMin[1],rMax[1]);
		h17->Fit("g6","R");
		cout<<"sigma= "<<g6->GetParameter(2)<<endl;
330

Muzalevsky I.A's avatar
Muzalevsky I.A committed
331
		c6->cd(3);
332

Muzalevsky I.A's avatar
Muzalevsky I.A committed
333
		TH1F *h18 = new TH1F("h18", "tau_CFD nontriggered channel for collimated data",1000	, 0., 200);
334

Muzalevsky I.A's avatar
Muzalevsky I.A committed
335 336 337 338
		t1->Draw("Ach1.fTimeCFD >> h18","Ach1.fTimeCFD > 120 && Ach1.fTimeCFD<180","");
		h18->GetXaxis()->SetRangeUser(120, 150);
		h18->GetXaxis()->SetTitle("tauCFD_{0} [ns]");
		h18->GetXaxis()->CenterTitle();
339 340 341
		g6->SetRange(rMin[2],rMax[2]);
		h18->Fit("g6","R");
		cout<<"sigma= "<<g6->GetParameter(2)<<endl;
342

343
		c6->cd(4);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
344 345 346 347 348 349
		TH1F *h19 = new TH1F("h19", "tau LED nontriggered channel for collimated data",1000	, 0., 200);

		t1->Draw("Ach1.fTimeLED >> h19","Ach1.fTimeLED>120 && Ach1.fTimeLED<180","");
		h19->GetXaxis()->SetRangeUser(120, 	150);
		h19->GetXaxis()->SetTitle("tauLED_{0} [ns]");
		h19->GetXaxis()->CenterTitle();
350 351 352
		g6->SetRange(rMin[3],rMax[3]);
		h19->Fit("g6","R");
		cout<<"sigma= "<<g6->GetParameter(2)<<endl;
Muzalevsky I.A's avatar
Muzalevsky I.A committed
353

354
		c6->Update();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
355
		c6->Print(Form("../macros/picsDRS4/%s/collimatedT%s", foldername, ext));
Muzalevsky I.A's avatar
Muzalevsky I.A committed
356 357
	}

358

359
}