histCorrNew01.C 11.1 KB
Newer Older
1 2 3 4
#include "TH2F.h"
#include "TH3F.h"
#include "TStyle.h"

5 6
void histCorrNew01 (
//01 means it is used for channels 0 and 1
7

8
		const char *filename = "analysis_07_8.root",	//considered non-collimated
9 10
//		const char *filename = "analysis_07_2.root", //collimated?
//		const char *filename = "analysis_07_4.root",
11
//		const char *filename = "analysis_08_2.root",
12
		const char *foldername = "7_8/chpair01",
13 14 15
//		const char *ext = ".eps",
		const char *ext = ".gif",

16 17
		const Bool_t can1 = 1, const Bool_t can2 = 0,
		const Bool_t can3 = 0, const Bool_t can4 = 0)
18
		//const Bool_t can5 = 0, const Bool_t can6 = 0) 
19 20 21 22 23 24 25 26 27 28 29 30
{
	using std::cout;
	using std::endl;
	gSystem->Load("../libData.so");
	TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
	TTree *t = (TTree*)f->Get("atree");

	//gStyle->SetCanvasDefH(900);
	//gStyle->SetCanvasDefW(1500);

	if(can1){
		
31
		TCanvas *c1 = new TCanvas("c1", "Correlation pictures for non-collimated data: delta t and integrals");
32
//		c1->Divide(2,2);
33

34 35 36 37
/*		c1->cd(1);
		TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,1.0e-9, 200, -40, 40 );
	//	t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col");
		t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h1","","col");
38 39 40 41 42 43 44 45 46 47
		//x
		h1->GetXaxis()->SetTitle("Charge [C]");
		h1->GetXaxis()->CenterTitle();
		//y
		h1->GetYaxis()->SetTitle("tau_TF [ns]");
		h1->GetYaxis()->CenterTitle();

		c1->Update();

		c1->cd(2);
48 49 50
		TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ",  200, 0, 0.5e-9, 200, -20 ,30);
	//	t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
		t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach1.fChargeLED >> h2","","col");
51 52 53 54 55 56 57 58 59 60
		//x
		h2->GetXaxis()->SetTitle("Charge [C]");
		h2->GetXaxis()->CenterTitle();
		//y
		h2->GetYaxis()->SetTitle("tau_TF [V]");
		h2->GetYaxis()->CenterTitle();

		c1->Update();

		c1->cd(3);
61 62 63
		TH2F *h3 = new TH2F("h3", "charge TF 1 vs charge TF 0", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9);
	//	t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col");
		t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col");
64 65 66 67 68 69 70 71
		//x
		h3->GetXaxis()->SetTitle("Charge_0 [C]");
		h3->GetXaxis()->CenterTitle();
		//y
		h3->GetYaxis()->SetTitle("Charge_1 [C]");
		h3->GetYaxis()->CenterTitle();

		c1->Update();
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
*/
//pictures for latex report, LED
		c1->Divide(2,1);
		c1->cd(1);
		TH2F *h2 = new TH2F("h2", "time difference (LED method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9);
		//	t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
		t->Draw(" Ach1.fChargeLED : Ach0.fTimeLED - Ach1.fTimeLED >> h2","","col");
			//x
		h2->GetXaxis()->SetTitle("time  [ns]");
		h2->GetXaxis()->CenterTitle();
		//y
		h2->GetYaxis()->SetTitle("Q [C]");
		h2->GetYaxis()->CenterTitle();

		c1->Update();

		c1->cd(2);
		TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9);
		//	t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col");
		t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col");
		//x
		h3->GetXaxis()->SetTitle("Q_{0} [C]");
		h3->GetXaxis()->CenterTitle();
		//y
		h3->GetYaxis()->SetTitle("Q_{1} [C]");
		h3->GetYaxis()->CenterTitle();

		c1->Update();

//pictures for latex report, CFD
/*		c1->Divide(2,1);
		c1->cd(1);
		TH2F *h2 = new TH2F("h2", "time difference (CFD method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9);
		//	t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
		t->Draw(" Ach1.fChargeCFD : Ach0.fTimeCFD - Ach1.fTimeCFD >> h2","","col");
			//x
		h2->GetXaxis()->SetTitle("time [ns]");
		h2->GetXaxis()->CenterTitle();
		//y
		h2->GetYaxis()->SetTitle("Q [C]");
		h2->GetYaxis()->CenterTitle();

		c1->Update();
115

116 117 118 119 120 121 122 123 124 125 126 127
		c1->cd(2);
		TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9);
		//	t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col");
		t->Draw(" Ach0.fChargeCFD : Ach1.fChargeCFD >> h3","","col");
		//x
		h3->GetXaxis()->SetTitle("Q_{0} [C]");
		h3->GetXaxis()->CenterTitle();
		//y
		h3->GetYaxis()->SetTitle("Q_{1} [C]");
		h3->GetYaxis()->CenterTitle();
*/
		c1->Update();
128
	//	c1->Print(Form("../macros/picsDRS4/file%s/time_front_corr1%s", foldername, ext));
129 130 131
	}

	if(can2) {
132
		TCanvas *c2 = new TCanvas("c2", "Correlation pictures for non-collimated data: delta t and amplitudes");
133 134 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 161 162 163 164 165 166
		c2->Divide(2,2);

		c2->cd(1);
		TH2F *h4 = new TH2F("h4", "front time tau vs amplitude 0", 200, 0, 0.5, 200, 5 ,15);
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront  : Ach0.fAmpMax  >> h4","","col");
		//x
		h4->GetXaxis()->SetTitle("Max_ampl_{0} [V]");
		h4->GetXaxis()->CenterTitle();
		//y
		h4->GetYaxis()->SetTitle("tau_TF");
		h4->GetYaxis()->CenterTitle();

		c2->cd(2);
		TH2F *h5 = new TH2F("h5", "front time tau vs amplitude 1", 200, 0, 0.5, 200, 5 ,15);
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront  : Ach1.fAmpMax  >> h5","","col");
		//x
		h5->GetXaxis()->SetTitle("Max_ampl_{1} [V]");
		h5->GetXaxis()->CenterTitle();
		//y
		h5->GetYaxis()->SetTitle("tau_TF");
		h5->GetYaxis()->CenterTitle();

		c2->Update();

		c2->cd(3);
		TH2F *h6 = new TH2F("h6", "amplitude 0 vs amplitude 1", 200, 0 ,0.1, 200, 0, 0.2);
		t->Draw("Ach0.fAmpMax  : Ach1.fAmpMax  >> h6","","col");
		//x
		h6->GetXaxis()->SetTitle("Max_ampl_{1} [V]");
		h6->GetXaxis()->CenterTitle();
		//y
		h6->GetYaxis()->SetTitle("Max_ampl_{0} [V]");
		h6->GetYaxis()->CenterTitle();

167
	//	c2->Print(Form("../macros/picsDRS4/file%s/time_front_corr2%s", foldername, ext));
168 169 170
	}

	if(can3) {
171
		TCanvas *c3 = new TCanvas ("c3", "Correlation pictures for non-collimated data: time difference");
172 173 174
		c3->Divide(2,2);

		c3->cd(1);
175 176 177
		TH1F *h10 = new TH1F("h10", "delta t (front edge fit)", 100, -5 , 25);
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h10","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150","");
		h10->Fit("gaus", "","",-5,5);
178
		gStyle->SetOptFit();
179 180
		h10->GetXaxis()->SetTitle("delta t [ns]");
		h10->GetXaxis()->CenterTitle();
181 182

		c3->cd(2);
183 184 185 186 187
		TH1F *h7 = new TH1F("h7", "delta t (front edge fit) with edge slope correction", 100, -5 , 25);
	//	t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h7",
	//	"Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150 && Ach0.fEdgeSlope > 0.01 && Ach1.fEdgeSlope > 0.01","");
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h7","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150 && Ach0.fEdgeSlope > 0.005 && Ach1.fEdgeSlope > 0.001","");
		h7->Fit("gaus", "","",-5,5);
188
		gStyle->SetOptFit();
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
		h7->GetXaxis()->SetTitle("delta t [ns]");
		h7->GetXaxis()->CenterTitle();

		c3->cd(3);
		TH1F *h8 = new TH1F("h8", "delta t (front edge fit) with charge correction", 100, -5 , 25);
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h8",
		"Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150 && Ach0.fChargeTF > 0.05e-9 && Ach1.fChargeTF > 0.025e-9","");
		h8->Fit("gaus","","",-5,5);
		gStyle->SetOptFit();
		h8->GetXaxis()->SetTitle("delta t [ns]");
		h8->GetXaxis()->CenterTitle();

		c3->cd(4);
		TH1F *h9 = new TH1F("h9", "delta t (front edge fit) with rise time correction", 100, -5 , 25);
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h9",
		"Ach0.fTimeFront> 100 && Ach0.fTimeFront<150 && Ach1.fTimeFront> 100 && Ach1.fTimeFront<150 && (Ach0.fTime90 - Ach0.fTime10) > 1.5 && (Ach0.fTime90 - Ach0.fTime10)<3 && (Ach1.fTime90 - Ach1.fTime10) > 1.5 && (Ach1.fTime90 - Ach1.fTime10)<3","");
		h9->Fit("gaus","","",-5,5);
		gStyle->SetOptFit();
		h9->GetXaxis()->SetTitle("delta t [ns]");
		h9->GetXaxis()->CenterTitle();
209

210
	//	c3->Print(Form("../macros/picsDRS4/file%s/time_front_corr3%s", foldername, ext));
211 212
	}

213
	if(can4) {
214
		TCanvas *c4 = new TCanvas ("c4", "Correlation pictures for non-collimated data: time difference");
215 216
		c4->Divide(2,2);

217
/*		c4->cd(1);
218
		TH1F *h11 = new TH1F("h11", "rise time for ch0", 100, 0 , 5);
219 220 221 222
		t->Draw("Ach0.fTime90 - Ach0.fTime10 >> h11","","");
		//gStyle->SetLineColor(kRed);

		c4->cd(2);
223
		TH1F *h12 = new TH1F("h12", "rise time for ch1", 100, 0 , 5);
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
		t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h12","",""); */

		c4->cd(1);
		TH1F *h11 = new TH1F("h11", "ToT for ch0", 100, 0 , 10);
		t->Draw("Ach0.fToT >> h11","Ach0.fToT > 0","");
		//gStyle->SetLineColor(kRed);

		c4->cd(2);
		TH1F *h12 = new TH1F("h12", "ToT for ch1", 100, 0 , 10);
		t->Draw("Ach1.fToT >> h12","Ach1.fToT > 0","");

//other files
/*		c4->cd(3);
		TH1F *h13 = new TH1F("h13", "time difference at the middle point of front edge", 100, -10, 10);
		//t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h13","Ach0.fEdgeSlope > 0.03 && Ach1.fEdgeSlope > 0.006","");
		t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h13","","");
		h13->Fit("gaus","","",-3,2);
		gStyle->SetOptFit();

		c4->cd(4);
		TH1F *h13 = new TH1F("h14", "time difference at the middle point of front edge with the correction on the ToT", 100, -10, 10);
		t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h14","Ach0.fToT > 2. && Ach0.fToT < 5. && Ach1.fToT > 1. && Ach1.fToT < 5.","");
		h14->Fit("gaus","","",-3,2);
		gStyle->SetOptFit();
*/

//file 7_8

252

253 254 255 256 257 258 259
/*
		c4->cd(3);
		TH1F *h13 = new TH1F("h13", "time difference at the 10 percent of front edge", 100, -10, 10);
		//t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h13","Ach0.fEdgeSlope > 0.03 && Ach1.fEdgeSlope > 0.006","");
		t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h13","","");
		h13->Fit("gaus","","",-3,2);
		gStyle->SetOptFit();
260

261 262 263 264 265 266 267
		c4->cd(4);
		TH1F *h13 = new TH1F("h14", "time difference at the middle point of front edge with the correction on the ToT", 100, -10, 10);
		t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h14","Ach0.fToT > 3. && Ach0.fToT < 6. && Ach1.fToT > 3. && Ach1.fToT < 6.","");
		h14->Fit("gaus","","",-2,1);
		gStyle->SetOptFit();
*/
//file 8_2
268
		c4->cd(3);
269 270 271 272
		TH1F *h13 = new TH1F("h13", "time difference at the middle point of front edge", 100, 0, 20);
		//t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h13","Ach0.fEdgeSlope > 0.03 && Ach1.fEdgeSlope > 0.006","");
		t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h13","","");
		h13->Fit("gaus","","",8,13);
273
		gStyle->SetOptFit();
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295

		c4->cd(4);
		TH1F *h13 = new TH1F("h14", "time difference at the middle point of front edge with the correction on the ToT", 100, 0, 20);
		t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h14","Ach0.fToT > 4. && Ach0.fToT < 6. && Ach1.fToT > 4 && Ach1.fToT < 6.","");
		h14->Fit("gaus","","",9,13);
		gStyle->SetOptFit();
/*
		c4->cd(3);
		TH1F *h13 = new TH1F("h13", "time difference at the 10 percent of front edge", 100, 0, 20);
		//t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h13","Ach0.fEdgeSlope > 0.03 && Ach1.fEdgeSlope > 0.006","");
		t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h13","","");
		h13->Fit("gaus","","",9,13);
		gStyle->SetOptFit();

		c4->cd(4);
		TH1F *h13 = new TH1F("h14", "time difference at the middle point of front edge with the correction on the ToT", 100, 0, 20);
		t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h14","Ach0.fToT > 1. && Ach0.fToT < 6. && Ach1.fToT > 1. && Ach1.fToT < 6.","");
		h14->Fit("gaus","","",9,13);
		gStyle->SetOptFit();
*/


296
	//	c4->Print(Form("../macros/picsDRS4/file%s/time_front_corr4%s", foldername, ext));
297

298
	}
299
}