histCorr.C 10.9 KB
Newer Older
1 2
//#include "TCanvas.h"

3
void histCorr(
4
//		const char *filename = "Neurad_7_08_NEW.root",
5 6
//		const char *filename = "analysis_08_2.root",
		const char *filename = "analysis_07_8.root",
7 8
		const char *foldername = "7_8",
//		const char *foldername = "8_2",
9 10
//		const char *ext = ".eps",
		const char *ext = ".gif",
11

12 13 14
		const Bool_t can1 = 0, const Bool_t can2 = 0,
		const Bool_t can3 = 0, const Bool_t can4 = 0,
		const Bool_t can5 = 0, const Bool_t can6 = 1)
15 16
{
	gSystem->Load("../libData.so");
17 18
	TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
//	TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root");
19
	TTree *t = (TTree*)f->Get("atree");
20 21 22 23 24

	if (can1) {
		TCanvas *c1 = new TCanvas("c1", "Correlation pictures: delta t from CFD vs something");
		c1->Divide(2,2);

25 26 27
//		TH2F *h1 = new TH2F("h1", "Time difference between two channels vs an integral of the first channel",125, -50., 50., 125, 0., 5e-9);
		TH2F *h1 = new TH2F("h1", "Time difference between two channels vs an integral of the first channel",125, -20., 30., 125, 0., 5e-9);
		TH2F *h2 = new TH2F("h2", "Time difference between two channels vs an integral of the second channel",125, -10., 30.,125, 0e-9, 5e-9);
28 29 30 31
		TH2F *h3 = new TH2F("h3", "Time difference between two channels vs amplitude of the first channel",125, -100., 100., 125, 0., 0.5);
		TH2F *h4 = new TH2F("h4", "Time difference between two channels vs amplitude of the second channel",125, -100., 100., 125, 0., 0.5);

		c1->cd(1);
32
		t->Draw("Ach0.fChargeCFD : ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h1","Ach0.fChargeCFD > 0.2e-9","col");
33
		//x
34
		h1->GetXaxis()->SetTitle("\\Delta \\tau_{0-1}  [ns]");
35 36 37 38
		h1->GetXaxis()->CenterTitle();
		//y
		h1->GetYaxis()->SetTitle("Q_{0} [C]");
		h1->GetYaxis()->CenterTitle();
39
		c1->Update();
40 41

		c1->cd(2);
42 43
		t->Draw("Ach1.fChargeCFD : ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h2","Ach1.fChargeCFD>0.05e-9","col");
		h2->GetXaxis()->SetTitle("\\Delta \\tau_{0-1}  [ns]");
44 45
		h2->GetXaxis()->CenterTitle();
		//y
46
		h2->GetYaxis()->SetTitle("Q_{1} [C]");
47
		h2->GetYaxis()->CenterTitle();
48
		c1->Update();
49 50

		c1->cd(3);
51
		t->Draw("Ach0.fAmpMax: ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h3","","col");
52
		//x
53
		h3->GetXaxis()->SetTitle("\\Delta \\tau_{0-1}  [ns]");
54 55 56 57
		h3->GetXaxis()->CenterTitle();
		//y
		h3->GetYaxis()->SetTitle("Max_ampl_{0} [V]");
		h3->GetYaxis()->CenterTitle();
58
		c1->Update();
59 60

		c1->cd(4);
61
		t->Draw("Ach1.fAmpMax: ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h4","","col");
62
		//x
63
		h4->GetXaxis()->SetTitle("\\Delta \\tau_{0-1}  [ns]");
64 65
		h4->GetXaxis()->CenterTitle();
		//y
66
		h4->GetYaxis()->SetTitle("Max_ampl_{1} [V]");
67 68 69 70
		h4->GetYaxis()->CenterTitle();
		
		c1->Show();
		c1->Update();
71
		//c1->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD%s", foldername, ext));
72 73 74 75
	}

	if (can2) {
		TCanvas *c2 = new TCanvas("c2", "Correlation pictures: Integrals and amplitudes");
76
		c2->Divide(2,2);
77 78 79 80 81

		TH2F *h5 = new TH2F("h5", "Integral of the first channel vs integral of the second channel", 300, 0., 2e-9, 300, 0., 2e-9);
		TH2F *h6 = new TH2F("h6", "Amplitude of the first channel vs amplitude of the second channel", 300, 10, 1e-10, 300, 10, 1e-10);

		c2->cd(1);
82
		t->Draw("Ach0.fChargeCFD : Ach1.fChargeCFD >> h5","","col1");
83
		//x
84
		h5->GetXaxis()->SetTitle("Q_{1} [C]");
85 86 87 88
		h5->GetXaxis()->CenterTitle();
		//y
		h5->GetYaxis()->SetTitle("Q_{0} [C]");
		h5->GetYaxis()->CenterTitle();
89
		c2->Update();
90

91 92
		c2->cd(3);
		t->Draw("Ach0.fAmpMax : Ach1.fAmpMax >> h6","","col");
93
		//x
94
		h6->GetXaxis()->SetTitle("Max_ampl_{1} [V]");
95 96 97 98 99 100
		h6->GetXaxis()->CenterTitle();
		//y
		h6->GetYaxis()->SetTitle("Max_ampl_{0} [V]");
		h6->GetYaxis()->CenterTitle();
	
		c2->Update();
101 102
		c2->Print(Form("../macros/picsDRS4/file%s/IntergAmpl%s", foldername, ext));
	//	c2->Print("../macros/picsDRS4/file7_8/IntergAmpl.eps");
103
	}
104

105 106
	if (can3) {
		TCanvas *c3 = new TCanvas("c3", "Correlation pictures: rising edge times");
107
		c3->Divide(2,2);
108 109

		TH1F *h7 = new TH1F("h7", "Time difference between 90 and 10 percent of the rising edge ampl", 100, 0, 5);
110
		TH2F *h8 = new TH2F("h8", "Time difference between 90 and 10 percent vs integral", 100, 0., 5., 100, 0., 3e-9);
111 112
//		TH2F *h9 = new TH2F("h9", "Time difference between 90 and 10: ch0 vs ch1", 100, 0., 5., 100, 0., 5.);
		TH1F *h9 = new TH1F("h9", "Delta tau", 100, -10., 30.);
113

114
		TH1F *h10 = new TH1F("h10", "Time difference between 90 and 10 > 0 and chi square < 0.0005", 100, 0., 5.);
115 116

		c3->cd(1);
117
//		t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h7","((Ach1.fTime90-Ach1.fTime10)>=0)","col");
118
		t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h7","((Ach1.fTime90-Ach1.fTime10)>=0) && (Ach1.fEdgeXi < 0.0015)","col");
119
//		t->Draw("Ach0.fTime90 - Ach0.fTime10 >> h7","","col");
120
		//x
121
		h7->GetXaxis()->SetTitle("\\Delta \\tau_{0}^{(rise)} [ns]");
122
		h7->GetXaxis()->CenterTitle();
123
		c3->Update();
124

125
		c3->cd(3);
126
		t->Draw("  Ach1.fChargeCFD : (Ach1.fTime90 - Ach1.fTime10) >> h8","(Ach1.fTime90 - Ach1.fTime10)>0","col");
127
		//x
128
		h8->GetXaxis()->SetTitle("\\Delta \\tau_{0}^{(rise)} [ns]");
129 130 131 132
		h8->GetXaxis()->CenterTitle();
		//y
		h8->GetYaxis()->SetTitle("Q_{0} [C]");
		h8->GetYaxis()->CenterTitle();
133
		c3->Update();
134
	
135
		c3->cd(2);
136 137
//		t->Draw("  (Ach1.fTime90 - Ach1.fTime10) : (Ach1.fTime90 - Ach1.fTime10) >> h9","(Ach1.fTime90 - Ach1.fTime10)>0","col");
		t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h9","Ach1.fChargeCFD>0.05e-9 && Ach1.fChargeCFD<0.5e-9","");
138
		//x
139
		h9->GetXaxis()->SetTitle("\\Delta \\tau_{0-1}  [ns]");
140
		h9->GetXaxis()->CenterTitle();
141 142
		TF1 *fGaus = new TF1("f1", "gaus", 8.5, 13.);
		h9->Fit(fGaus, "R");
143
		c3->Update();
144 145

		c3->cd(4);
146
		t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h10","((Ach1.fTime90-Ach1.fTime10)>=0)","");
147
		t->SetLineColor(kRed);
148 149 150 151
		t->Draw("Ach1.fTime90 - Ach1.fTime10 ","((Ach1.fTime90-Ach1.fTime10)>=0) && (Ach1.fEdgeXi < 0.0005)","same"); //????????
		h10->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]");
		h10->GetXaxis()->CenterTitle();

152
		c3->Update();
153 154
		c3->Print(Form("../macros/picsDRS4/file%s/RisingEdge%s", foldername, ext));
	//	c3->Print("../macros/picsDRS4/file7_8/RisingEdge.eps");
155

156 157
	}

158 159
	if (can4) {
		TCanvas *c4 = new TCanvas("c4", "Correlation pictures: XiSquares");
160

161
		TH2F *h11 = new TH2F("h11", "Time difference between two channels vs XiSquare of edge",100, -0., 5., 100, 0., 0.005);
162
		t->Draw("Ach0.fEdgeXi : (Ach0.fTime90 - Ach0.fTime10) >> h11","","col");
163
		//t->Draw("Ach1.fEdgeXi : (Ach1.fTime90 - Ach1.fTime10) >> h11","(Ach1.fTime90 - Ach1.fTime10)>0","col");
164
		//x
165 166
		h11->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]");
		h11->GetXaxis()->CenterTitle();
167
		//y
168 169
		h11->GetYaxis()->SetTitle("fEdgeXi");
		h11->GetYaxis()->CenterTitle();
170
		c4->Update();
171
		//c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext));
172 173

	}
174

175 176
	if (can5) {
		TCanvas *c5 = new TCanvas("c5", "Changing CFD parameters");
177 178
		c5->Divide(1,2);
		c5->cd(1);
179 180 181 182 183 184 185 186 187 188 189 190 191

		TH1F *h12 = new TH1F("h12", "Delta tau CFD",100, -10., 30.);

	//	c5->Divide(1,2);
	//	c5->cd(1);
		t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h12","Ach1.fChargeCFD>0.05e-9 && Ach1.fChargeCFD<0.5e-9","");

		h12->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
		h12->GetXaxis()->CenterTitle();
		TF1 *fGaus = new TF1("f1", "gaus", 8.5, 13.);
		h12->Fit(fGaus, "R");
		gStyle->SetOptFit();

192 193 194 195 196 197 198 199 200 201 202 203 204
		c5->cd(2);
		TH3F *h3d = new TH3F("h3d","3d histo",  100, -10, 30, 125, 0, 5e-9, 125, 0, 5e-9);
		t->Draw("Ach1.fChargeCFD : Ach0.fChargeCFD : (Ach0.fTimeCFD - Ach1.fTimeCFD) >> h3d","","");

		h3d->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
		h3d->GetXaxis()->CenterTitle();

		h3d->GetYaxis()->SetTitle("Q_{0} [C]");
		h3d->GetYaxis()->CenterTitle();

		h3d->GetZaxis()->SetTitle("Q_{1} [C]");
		h3d->GetZaxis()->CenterTitle();

205
		c5->Update();
206
		//c5->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD_0.7_3%s", foldername, ext));
207
	}
208

209 210 211
	if (can6) {
		TCanvas *c6 = new TCanvas("c6", "leading edge vs charge");
		c6->Divide(2,2);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
212

213 214
		c6->cd(1);
		//TH2F *h13 = new TH2F("h13", "leading edge vs charge",100, 130., 145., 100, -2e-9, 6e-9);
215
		TH1F *h20 = new TH1F("h20", "delta Tau CFD", 100, -20., 0.);
216
		//t->Draw("Ach0.fTimeCFD - Ach0.fTimeLED >> h20","Ach0.fTimeCFD - Ach0.fTimeLED > 0.3 && Ach0.fTimeCFD - Ach0.fTimeLED <1.3","");
217
		t->Draw("Ach1.fTimeCFD - Ach0.fTimeCFD >> h20","Ach0.fTimeCFD >0. && Ach1.fTimeCFD >0.");
218
		//t->Draw("Ach0.fChargeCFD : Ach0.fChargeCFD >> h13","","col");;
Muzalevsky I.A's avatar
Muzalevsky I.A committed
219
		//x
220 221
	/*	h13->GetYaxis()->SetTitle("fChargeCFD");
		h13->GetYaxis()->CenterTitle();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
222
		//y
223 224 225 226 227
		h13->GetXaxis()->SetTitle("fTimeLED");
		h13->GetXaxis()->CenterTitle();*/
		c6->Update();

		c6->cd(3);
228 229 230 231 232 233 234 235 236 237 238 239 240 241
//		TH2F *h14 = new TH2F("h14", "fTIMECFD vs fTIMELED",100, 110., 140., 100, 110, 160);
//		TH1F *h14 = new TH1F("h14", "delta Tau LED", 100, -20., 0.);
		TH1F *h14 = new TH1F("h14", "delta Tau LED", 50, -8., 10.);
//		TH1F *h140 = new TH1F("h140", "delta Tau LED", 100, -20., 0.);
		TH1F *h140 = new TH1F("h140", "delta Tau LED", 50, -8., 10.);
//		t->Draw("Ach0.fTimeLED - Ach0.fTimeLED >> h14","","");
//		t->Draw("Ach2.fTimeLED - Ach0.fTimeLED >> h14","","");
		t->Draw("Ach1.fTimeLED - Ach0.fTimeLED >> h14","","");
//		t->SetLineColor(kRed);
//		cout << t->Draw("Ach0.fTimeLED - Ach0.fTimeLED >> h140","Ach1.fChargeLED > 0.04e-9","same") << endl;
//		cout << t->Draw("Ach2.fTimeLED - Ach0.fTimeLED >> h140","Ach2.fChargeLED > 0.04e-9","same") << endl;
		cout << t->Draw("Ach1.fTimeLED - Ach0.fTimeLED >> h140","Ach1.fChargeLED > 0.04e-9","same") << endl;
		h140->SetLineColor(kRed);

242 243
		//t->Draw("Ach0.fChargeCFD : Ach0.fChargeCFD >> h13","","col");;
		//x
244 245

		h14->GetYaxis()->SetTitle("N");
246 247
		h14->GetYaxis()->CenterTitle();
		//y
248
		h14->GetXaxis()->SetTitle("delta tau");
249
		h14->GetXaxis()->CenterTitle();
250 251 252 253 254 255 256 257

//		h14->Fit("gaus", "", "", -13, -6);
//		h140->Fit("gaus", "", "", -13, -6);
		h14->Fit("gaus", "", "", -2, 6);
		h140->Fit("gaus", "", "", -2, 6);

		gStyle->SetOptFit();

258 259 260
		c6->Update();

		c6->cd(2);
261 262 263
		TH2F *h15 = new TH2F("h15", "leading edge vs charge",50, 120., 140.,200, -0.02e-10, 4e-10);
		t->Draw("Ach1.fChargeLED : Ach1.fTimeLED >> h15","Ach1.fChargeLED>0","col");
//		t->Draw("Ach1.fChargeLED : Ach1.fTimeLED","Ach1.fChargeLED>0.02e-10 && Ach1.fChargeLED<4e-10 && Ach1.fTimeLED>120. && Ach1.fTimeLED<140.","");
264 265
		//t->Draw("Ach0.fChargeCFD : Ach0.fChargeCFD >> h13","","col");;
		//x
266
		h15->GetYaxis()->SetTitle("fChargeLED");
267 268 269 270 271 272
		h15->GetYaxis()->CenterTitle();
		//y
		h15->GetXaxis()->SetTitle("fTimeLED");
		h15->GetXaxis()->CenterTitle();
		c6->Update();

273 274


275
		c6->cd(4);
276 277 278
		TH2F *h16 = new TH2F("h16", "delta timeLED vs charge", 200, -20., 0.,100, 0, 10e-10);
//		t->Draw("Ach1.fChargeLED : Ach1.fTimeLED - Ach0.fTimeLED >> h16","Ach1.fChargeLED>3e-12","col");
		t->Draw("Ach1.fChargeLED : Ach1.fTimeLED - Ach0.fTimeLED >> h16","Ach1.fTimeLED - Ach0.fTimeLED > -20. && Ach1.fTimeLED - Ach0.fTimeLED < 0. && Ach1.fChargeLED<10e-10","col");
279 280
		//t->Draw("Ach0.fChargeCFD : Ach0.fChargeCFD >> h13","","col");;
		//x
281
		h16->GetYaxis()->SetTitle("fChargeLED");
282 283
		h16->GetYaxis()->CenterTitle();
		//y
284
		h16->GetXaxis()->SetTitle("delta tau LED");
285 286
		h16->GetXaxis()->CenterTitle();
		c6->Update();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
287 288 289
		//c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext));
	}

290

291
}