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

3
<<<<<<< HEAD
Muzalevsky I.A's avatar
Muzalevsky I.A committed
4
void histCorr(const char *filename = "analysis_07_8.root", const char *foldername = "7_8", const char *ext = ".eps", const Bool_t can1 = 0, const Bool_t can2 = 0, const Bool_t can3 = 0, const Bool_t can4 = 0,  const Bool_t can5 = 1)
5
=======
6 7 8 9 10 11 12
void histCorr(
//		const char *filename = "analysis_07_8.root",
		const char *filename = "analysis_08_2.root",
//		const char *foldername = "7_8",
		const char *foldername = "8_2",
//		const char *ext = ".eps",
		const char *ext = ".gif",
13
<<<<<<< HEAD
14
		const Bool_t can1 = 1, const Bool_t can2 = 1, const Bool_t can3 = 1, const Bool_t can4 = 1, const Bool_t can5 = 1)
15
>>>>>>> 1612d04b19c3139e125a1642bdb0763585790d84
16
=======
17
		const Bool_t can1 = 0, const Bool_t can2 = 0, const Bool_t can3 = 0, const Bool_t can4 = 0, const Bool_t can5 = 1)
18
>>>>>>> 07d2b501d7fd6bf88dd2d6b203a724d53357bbe3
19 20
{
	gSystem->Load("../libData.so");
21 22
	TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
//	TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root");
23
	TTree *t = (TTree*)f->Get("atree");
24 25 26 27 28

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

29 30 31
//		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);
32 33 34 35
		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);
36
		t->Draw("Ach0.fChargeCFD : ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h1","Ach0.fChargeCFD > 0.2e-9","col");
37
		//x
38
		h1->GetXaxis()->SetTitle("\\Delta \\tau_{0-1}  [ns]");
39 40 41 42
		h1->GetXaxis()->CenterTitle();
		//y
		h1->GetYaxis()->SetTitle("Q_{0} [C]");
		h1->GetYaxis()->CenterTitle();
43
		c1->Update();
44 45

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

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

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

	if (can2) {
		TCanvas *c2 = new TCanvas("c2", "Correlation pictures: Integrals and amplitudes");
80
		c2->Divide(2,2);
81 82 83 84 85

		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);
86
		t->Draw("Ach0.fChargeCFD : Ach1.fChargeCFD >> h5","","col1");
87
		//x
88
		h5->GetXaxis()->SetTitle("Q_{1} [C]");
89 90 91 92
		h5->GetXaxis()->CenterTitle();
		//y
		h5->GetYaxis()->SetTitle("Q_{0} [C]");
		h5->GetYaxis()->CenterTitle();
93
		c2->Update();
94

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

109 110
	if (can3) {
		TCanvas *c3 = new TCanvas("c3", "Correlation pictures: rising edge times");
111
		c3->Divide(2,2);
112 113

		TH1F *h7 = new TH1F("h7", "Time difference between 90 and 10 percent of the rising edge ampl", 100, 0, 5);
114
		TH2F *h8 = new TH2F("h8", "Time difference between 90 and 10 percent vs integral", 100, 0., 5., 100, 0., 3e-9);
115 116
//		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.);
117

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

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

129
		c3->cd(3);
130
		t->Draw("  Ach1.fChargeCFD : (Ach1.fTime90 - Ach1.fTime10) >> h8","(Ach1.fTime90 - Ach1.fTime10)>0","col");
131
		//x
132
		h8->GetXaxis()->SetTitle("\\Delta \\tau_{0}^{(rise)} [ns]");
133 134 135 136
		h8->GetXaxis()->CenterTitle();
		//y
		h8->GetYaxis()->SetTitle("Q_{0} [C]");
		h8->GetYaxis()->CenterTitle();
137
		c3->Update();
138
	
139
		c3->cd(2);
140 141
//		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","");
142
		//x
143
		h9->GetXaxis()->SetTitle("\\Delta \\tau_{0-1}  [ns]");
144
		h9->GetXaxis()->CenterTitle();
145 146
		TF1 *fGaus = new TF1("f1", "gaus", 8.5, 13.);
		h9->Fit(fGaus, "R");
147
		c3->Update();
148 149

		c3->cd(4);
150
		t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h10","((Ach1.fTime90-Ach1.fTime10)>=0)","");
151
		t->SetLineColor(kRed);
152 153 154 155
		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();

156
		c3->Update();
157 158
		c3->Print(Form("../macros/picsDRS4/file%s/RisingEdge%s", foldername, ext));
	//	c3->Print("../macros/picsDRS4/file7_8/RisingEdge.eps");
159

160 161
	}

162 163
	if (can4) {
		TCanvas *c4 = new TCanvas("c4", "Correlation pictures: XiSquares");
164

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

	}
178

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

		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();

196 197 198 199 200 201 202 203 204 205 206 207 208
		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();

209
		c5->Update();
210
		//c5->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD_0.7_3%s", foldername, ext));
211 212

	}
213

Muzalevsky I.A's avatar
Muzalevsky I.A committed
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
	if (can5) {
		TCanvas *c5 = new TCanvas("c5", "Sigma");
		c5->cd();
		TH1F *h11 = new TH1F("h11", "sigma", 1023, -10, 10);

		t->Draw("Ach1.fAmpPos  >> h11","Ach1.fTime >0","col");
		//x
		//h10->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]");
		//h10->GetXaxis()->CenterTitle();
		//y
		//h10->GetYaxis()->SetTitle("fEdgeXi");
		//h10->GetYaxis()->CenterTitle();
		c5->Update();
		//c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext));

	}

231
}