histCorr.C 11.8 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 11 12 13 14 15 16 17 18 19 20 21 22
//	const char *filename = "Neurad_7_08_NEW.root",
	const char *filename1 = "analysis_08_2.root",
	const char *filename = "analysis_07_8.root",
	const char *foldername = "report",
//	const char *foldername = "8_2",
//	const char *ext = ".eps",
	const char *ext = ".gif",

	const Bool_t can1 = 1, const Bool_t can2 = 0, // delta tLed and delta tcfd // dvumerki
	const Bool_t can3 = 0, const Bool_t can4 = 0,
	const Bool_t can5 = 0, const Bool_t can6 = 0) // tLEd and CFD for colollinated and NONcollimated data


23

24
{
25 26 27
	Double_t rMin[4];
	Double_t rMax[4];

Muzalevsky I.A's avatar
Muzalevsky I.A committed
28 29
	using std::cout;
	using std::endl;
30
	gSystem->Load("../libData.so");
31 32
	TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
//	TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root");
33
	TTree *t = (TTree*)f->Get("atree");
34

Muzalevsky I.A's avatar
Muzalevsky I.A committed
35 36 37
	TFile *f1 = new TFile(Form("../data/dataDSR4/%s", filename1));
//	TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root");
	TTree *t1 = (TTree*)f1->Get("atree");
38

Muzalevsky I.A's avatar
Muzalevsky I.A committed
39 40 41
	gStyle->SetCanvasDefH(900);
	gStyle->SetCanvasDefW(1500);
//	gStyle->SetCanvas
42

Muzalevsky I.A's avatar
Muzalevsky I.A committed
43 44 45
	if (can1) { // t1 - коллимированные данные!!!
		TCanvas *c1 = new TCanvas("c5", "Changing CFD parameters");
		c1->Divide(2,2);
46
		c1->cd(1);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
47

48 49 50 51 52 53 54 55 56 57 58
		TF1 *g1 = new TF1("g1","gaus",0,20);
		g1->SetParLimits(0,1e+2,1e+4);
		g1->SetParLimits(1,-100,100);
		g1->SetParLimits(2,0.1,10);


		rMin[0]= -4.8; rMax[0] = 0.8;
		rMin[1]= -7.6; rMax[1] = -0.8;
		rMin[2]= 9.2; rMax[2] = 12.8;
		rMin[3]= 6.8; rMax[3] = 12.4;

Muzalevsky I.A's avatar
Muzalevsky I.A committed
59 60
		TH1F *h1 = new TH1F("h1", "delta tau_CFD for NONcollimated data",1000	, -200., 200);

61 62
		t->Draw("Ach0.fTimeCFD - Ach3.fTimeCFD >> h1","(Ach0.fTimeCFD - Ach3.fTimeCFD)>-20 && (Ach0.fTimeCFD - Ach3.fTimeCFD)<10","");
		h1->GetXaxis()->SetRangeUser(-20, 10);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
63
		h1->GetXaxis()->SetTitle("delta tauCFD [ns]");
64
		h1->GetXaxis()->CenterTitle();
65 66 67
		g1->SetRange(rMin[0],rMax[0]);
		h1->Fit("g1","R");
		cout<<"sigma= "<<g1->GetParameter(2)<<endl;
68 69

		c1->cd(2);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
70 71
		TH1F *h2 = new TH1F("h2", "delta tau_LED for NONcollimated data",1000, -200., 200);

72 73 74
		t->Draw("Ach0.fTimeLED - Ach3.fTimeLED >> h2","(Ach0.fTimeLED - Ach3.fTimeLED)>-20 && (Ach0.fTimeLED - Ach3.fTimeLED)<10","");
		//t->Draw("Ach0.fTimeLED - Ach3.fTimeLED >> h2","","");
		h2->GetXaxis()->SetRangeUser(-20, 10);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
75
		h2->GetXaxis()->SetTitle("delta tauLED [ns]");
76
		h2->GetXaxis()->CenterTitle();
77 78 79
		g1->SetRange(rMin[1],rMax[1]);
		h2->Fit("g1","R");
		cout<<"sigma= "<<g1->GetParameter(2)<<endl;
80 81

		c1->cd(3);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
82

83
		TH1F *h3 = new TH1F("h3", "delta tau_CFD for collimated data",1000	, -200, 200);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
84

85
		t1->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h3","(Ach0.fTimeCFD - Ach1.fTimeCFD)>0 && (Ach0.fTimeCFD - Ach1.fTimeCFD)<20","");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
86
		//t1->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h3","","");
87
		h3->GetXaxis()->SetRangeUser(0, 20);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
88
		h3->GetXaxis()->SetTitle("delta tauCFD [ns]");
89
		h3->GetXaxis()->CenterTitle();
90 91 92
		g1->SetRange(rMin[2],rMax[2]);
		h3->Fit("g1","R");
		cout<<"sigma= "<<g1->GetParameter(2)<<endl;
93 94

		c1->cd(4);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
95 96
		TH1F *h4 = new TH1F("h4", "delta tau_LED for collimated data",1000	, -200., 200);

97
		t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h4","(Ach0.fTimeLED - Ach1.fTimeLED)>0 && (Ach0.fTimeLED - Ach1.fTimeLED)<20","");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
98
		//t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h4","","");
99
		h4->GetXaxis()->SetRangeUser(0,20);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
100
		h4->GetXaxis()->SetTitle("delta tauLED [ns]");
101
		h4->GetXaxis()->CenterTitle();
102 103 104
		g1->SetRange(rMin[3],rMax[3]);
		h4->Fit("g1","R");
		cout<<"sigma= "<<g1->GetParameter(2)<<endl;
Muzalevsky I.A's avatar
Muzalevsky I.A committed
105

106
		c1->Update();
107
		c1->Print(Form("../macros/picsDRS4/%s/deltaT%s", foldername, ext));
108 109 110 111
	}

	if (can2) {
		TCanvas *c2 = new TCanvas("c2", "Correlation pictures: Integrals and amplitudes");
112
		c2->Divide(2,2);
113

Muzalevsky I.A's avatar
Muzalevsky I.A committed
114
		TH2F *h5 = new TH2F("h5", "maxapl of the first channel vs maxamp of the second channel", 300, 0 ,0.1, 300, 0, 0.2);
115
		c2->cd(1);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
116
		t1->Draw("Ach0.fAmpMax : Ach1.fAmpMax >> h5","","col");
117
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
118
		h5->GetXaxis()->SetTitle("Max_ampl_{1} [V]");
119 120
		h5->GetXaxis()->CenterTitle();
		//y
Muzalevsky I.A's avatar
Muzalevsky I.A committed
121
		h5->GetYaxis()->SetTitle("Max_ampl_{0} [V]");
122
		h5->GetYaxis()->CenterTitle();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
123

124
		c2->Update();
125

Muzalevsky I.A's avatar
Muzalevsky I.A committed
126 127 128
		TH2F *h6 = new TH2F("h6", "tau(fTimeLed0-fTimeLed1) vs amplitude of the trigered channel", 200, 0 ,0.5, 200, 5, 15);
		c2->cd(2);
		t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED  : Ach0.fAmpMax >> h6","","col");
129
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
130
		h6->GetXaxis()->SetTitle("Max_ampl_{0} [V]");
131 132
		h6->GetXaxis()->CenterTitle();
		//y
Muzalevsky I.A's avatar
Muzalevsky I.A committed
133
		h6->GetYaxis()->SetTitle("tau_LED [V]");
134
		h6->GetYaxis()->CenterTitle();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160

		c2->Update();

		TH2F *h7 = new TH2F("h7", "tau(fTimeLed0-fTimeLed1) vs summ of amplitudes", 200, 0 ,0.5, 200, 5, 15);
		c2->cd(3);
		t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED  : Ach0.fAmpMax + Ach1.fAmpMax >> h7","","col");
		//x
		h7->GetXaxis()->SetTitle("summ_Amps [V]");
		h7->GetXaxis()->CenterTitle();
		//y
		h7->GetYaxis()->SetTitle("tau_LED [V]");
		h7->GetYaxis()->CenterTitle();

		c2->Update();


		TH2F *h8 = new TH2F("h8", "tau(fTimeCFD0-fTimeCFD1) vs summ of amplitudes", 200, 0 ,0.5, 200, -150, 150);
		c2->cd(4);
		t1->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD  : Ach0.fAmpMax + Ach1.fAmpMax >> h8","","col");
		//x
		h8->GetXaxis()->SetTitle("summ_Amps [V]");
		h8->GetXaxis()->CenterTitle();
		//y
		h8->GetYaxis()->SetTitle("tau_CFD [V]");
		h8->GetYaxis()->CenterTitle();

161
		c2->Update();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
162 163 164


		//c2->Print(Form("../macros/picsDRS4/%s/tauVSAmpl%s", foldername, ext));
165
	}
166

167
	if (can3) {
Muzalevsky I.A's avatar
Muzalevsky I.A committed
168
		TCanvas *c3 = new TCanvas("c3", "Correlation pictures: Integrals and amplitudes");
169
		c3->Divide(2,2);
170

Muzalevsky I.A's avatar
Muzalevsky I.A committed
171
		TH2F *h9 = new TH2F("h9", "tau_led vs chargeLed KOLLIMATED", 200, 0 ,5e-10, 200, 5, 15);
172
		c3->cd(1);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
173
		t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h9","","col");
174
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
175 176 177 178 179
		h9->GetXaxis()->SetTitle("Charge [kl]");
		h9->GetXaxis()->CenterTitle();
		//y
		h9->GetYaxis()->SetTitle("tauLED [ns]");
		h9->GetYaxis()->CenterTitle();
180

Muzalevsky I.A's avatar
Muzalevsky I.A committed
181
		TH2F *h10 = new TH2F("h10", "tau_led vs chargeLed NONKOLLIMATED", 200, 0 ,8e-10, 200, -10, 5);
182
		c3->cd(3);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
183
		t->Draw("Ach0.fTimeLED - Ach3.fTimeLED : Ach0.fChargeLED >> h10","","col");
184
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
185 186
		h10->GetXaxis()->SetTitle("Charge [kl]");
		h10->GetXaxis()->CenterTitle();
187
		//y
Muzalevsky I.A's avatar
Muzalevsky I.A committed
188 189 190
		h10->GetYaxis()->SetTitle("tauLED [ns]");
		h10->GetYaxis()->CenterTitle();

191
		c3->Update();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
192 193

		TH2F *h11 = new TH2F("h11", "tauLED vs summCharge COLLIMATED", 200, 0 ,1e-9, 200, 5, 15);
194
		c3->cd(2);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
195
		t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED  : Ach0.fChargeLED + Ach1.fChargeLED >> h11","","col");
196
		//x
Muzalevsky I.A's avatar
Muzalevsky I.A committed
197 198 199 200 201
		h11->GetXaxis()->SetTitle("Summ_Charge [kl]");
		h11->GetXaxis()->CenterTitle();
		//y
		h11->GetYaxis()->SetTitle("tau_LED [V]");
		h11->GetYaxis()->CenterTitle();
202

Muzalevsky I.A's avatar
Muzalevsky I.A committed
203 204
		c3->Update();
		TH2F *h12 = new TH2F("h12", "tau_led vs summCharge NONKOLLIMATED", 200, 0 ,8e-10, 200, -10, 5);
205
		c3->cd(4);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
206 207 208 209 210 211 212
		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();
213 214
		c3->Update();

Muzalevsky I.A's avatar
Muzalevsky I.A committed
215 216

		c3->Print(Form("../macros/picsDRS4/%s/tauVSCHARGE%s", foldername, ext));
217 218
	}

219 220
	if (can4) {
		TCanvas *c4 = new TCanvas("c4", "Correlation pictures: XiSquares");
221

222
		TH2F *h11 = new TH2F("h11", "Time difference between two channels vs XiSquare of edge",100, -0., 5., 100, 0., 0.005);
223
		t->Draw("Ach0.fEdgeXi : (Ach0.fTime90 - Ach0.fTime10) >> h11","","col");
224
		//t->Draw("Ach1.fEdgeXi : (Ach1.fTime90 - Ach1.fTime10) >> h11","(Ach1.fTime90 - Ach1.fTime10)>0","col");
225
		//x
226 227
		h11->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]");
		h11->GetXaxis()->CenterTitle();
228
		//y
229 230
		h11->GetYaxis()->SetTitle("fEdgeXi");
		h11->GetYaxis()->CenterTitle();
231
		c4->Update();
232
		//c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext));
233 234

	}
235

236 237
	if (can5) {
		TCanvas *c5 = new TCanvas("c5", "Changing CFD parameters");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
238
		c5->Divide(2,2);
239
		c5->cd(1);
240

241 242 243 244 245 246 247 248 249 250 251 252
		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);

Muzalevsky I.A's avatar
Muzalevsky I.A committed
253 254
		TH1F *h12 = new TH1F("h12", "tau_CFD triggered channel for NONcollimated data",1000, 0., 200);

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

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

266 267
		t->Draw("Ach0.fTimeLED >> h13","Ach0.fTimeLED>132 && Ach0.fTimeLED<150","");
		h13->GetXaxis()->SetRangeUser(132, 150);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
268 269
		h13->GetXaxis()->SetTitle("tauLED_{0} [ns]");
		h13->GetXaxis()->CenterTitle();
270 271 272
		g5->SetRange(rMin[1],rMax[1]);
		h13->Fit("g5","R");
		cout<<"sigma= "<<g5->GetParameter(2)<<endl;
273

Muzalevsky I.A's avatar
Muzalevsky I.A committed
274 275
		c5->cd(3);
		TH1F *h14 = new TH1F("h14", "tau_CFD nontriggered channel for NONcollimated data",1000	, 0., 200);
276

277 278
		t->Draw("Ach1.fTimeCFD >> h14","Ach1.fTimeCFD > 132 && Ach1.fTimeCFD<150","");
		h14->GetXaxis()->SetRangeUser(132, 150);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
279 280
		h14->GetXaxis()->SetTitle("tauCFD_{0} [ns]");
		h14->GetXaxis()->CenterTitle();
281 282 283
		g5->SetRange(rMin[2],rMax[2]);
		h14->Fit("g5","R");
		cout<<"sigma= "<<g5->GetParameter(2)<<endl;
Muzalevsky I.A's avatar
Muzalevsky I.A committed
284 285 286

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

288 289
		t->Draw("Ach1.fTimeLED >> h15","Ach1.fTimeLED>132 && Ach1.fTimeLED<150","");
		h15->GetXaxis()->SetRangeUser(132, 	150);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
290 291
		h15->GetXaxis()->SetTitle("tauLED_{0} [ns]");
		h15->GetXaxis()->CenterTitle();
292 293 294
		g5->SetRange(rMin[3],rMax[3]);
		h15->Fit("g5","R");
		cout<<"sigma= "<<g5->GetParameter(2)<<endl;
295
		c5->Update();
296

Muzalevsky I.A's avatar
Muzalevsky I.A committed
297
		c5->Print(Form("../macros/picsDRS4/%s/NONcollimatedT%s", foldername, ext));
298
	}
299

300
	if (can6) {
Muzalevsky I.A's avatar
Muzalevsky I.A committed
301
		TCanvas *c6 = new TCanvas("c6", "Changing CFD parameters");
302
		c6->Divide(2,2);
303 304 305 306 307 308 309 310 311 312
		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;

313
		c6->cd(1);
314

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

Muzalevsky I.A's avatar
Muzalevsky I.A committed
317 318 319 320
		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();
321 322 323 324
		g6->SetRange(rMin[0],rMax[0]);
		h16->Fit("g6","R");
		cout<<"sigma= "<<g6->GetParameter(2)<<endl;

325

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

Muzalevsky I.A's avatar
Muzalevsky I.A committed
329 330 331 332
		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();
333 334 335
		g6->SetRange(rMin[1],rMax[1]);
		h17->Fit("g6","R");
		cout<<"sigma= "<<g6->GetParameter(2)<<endl;
336

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

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

Muzalevsky I.A's avatar
Muzalevsky I.A committed
341 342 343 344
		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();
345 346 347
		g6->SetRange(rMin[2],rMax[2]);
		h18->Fit("g6","R");
		cout<<"sigma= "<<g6->GetParameter(2)<<endl;
348

349
		c6->cd(4);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
350 351 352 353 354 355
		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();
356 357 358
		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
359

360
		c6->Update();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
361
		c6->Print(Form("../macros/picsDRS4/%s/collimatedT%s", foldername, ext));
Muzalevsky I.A's avatar
Muzalevsky I.A committed
362 363
	}

364

365
}