64 gROOT->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C");
75 TChain *eveTree =
new TChain(
"cbmsim");
78 cout <<
"Open file " << inName << endl << endl;
81 TClonesArray *ToF400Digits;
82 eveTree->SetBranchAddress(
"TOF400", &ToF400Digits);
84 TClonesArray *BC2Digits;
85 eveTree->SetBranchAddress(
"T0", &BC2Digits);
87 TClonesArray *EventHeader;
88 eveTree->SetBranchAddress(
"EventHeader", &EventHeader);
90 Long64_t nEvents = eveTree->GetEntries();
91 if (nEvForRead == 0) nEvForRead = nEvents;
92 cout <<
"Will be readed " << nEvForRead <<
" events from " << nEvents << endl;
97 ofstream f_call, f_dt;
98 TF1 *f_gaus =
new TF1(
"f_gaus",
"gaus", -20, 40);
107 TList * ListStat =
new TList();
108 TList * ListAmpTofPlane2 =
new TList();
109 TList * ListTimeTofPlane2 =
new TList();
110 TList * ListLRTofPlane2 =
new TList();
111 TList * ListAmpTofPlane7 =
new TList();
112 TList * ListTimeTofPlane7 =
new TList();
113 TList * ListLRTofPlane7 =
new TList();
114 TList * ListLRCorrTofPlane7 =
new TList();
115 TList * ListLRvsAmpLTofPlane7 =
new TList();
116 TList * ListLRvsAmpRTofPlane7 =
new TList();
117 TList * ListAnalysis =
new TList();
120 TH1I * hAmpTofPlane2[
kNST + 1];
121 TH1I * hTimeTofPlane2[
kNST + 1];
122 TH1I * hLevtMinusRightPlane2[
kNST + 1];
123 for (Int_t
i = 0;
i <
kNST + 1;
i++) {
124 name = Form(
"hAmpTofPlane2_%d",
i);
125 hAmpTofPlane2[
i] =
new TH1I(name, name, 1024, 0, 50.);
126 ListAmpTofPlane2->Add(hAmpTofPlane2[
i]);
127 name = Form(
"hTimeTofPlane2_%d",
i);
128 hTimeTofPlane2[
i] =
new TH1I(name, name, 1000, 0, 1000.);
129 ListTimeTofPlane2->Add(hTimeTofPlane2[
i]);
130 name = Form(
"hLevtMinusRightPlane2_%d",
i);
131 hLevtMinusRightPlane2[
i] =
new TH1I(name, name, 1024, -12., 12.);
132 ListLRTofPlane2->Add(hLevtMinusRightPlane2[
i]);
134 TH2I * hAmpLRPlane2 =
new TH2I(
"hAmpLRPlane2",
"hAmpLRPlane2", 1024, 0., 50., 1024, 0., 50.);
135 ListAmpTofPlane2->Add(hAmpLRPlane2);
137 TH1I * hAmpTofPlane7[
kNST + 1];
138 TH1I * hTimeTofPlane7[
kNST + 1];
139 TH1I * hLeftMinusRightPlane7[
kNST + 1];
140 TH2S * hLeftRightVsAmpLPlane7[
kNST + 1];
141 TH2S * hLeftRightVsAmpRPlane7[
kNST + 1];
142 TH2S * hLeftRightCorelationRPlane7[
kNST + 1];
143 for (Int_t
i = 0;
i <
kNST + 1;
i++) {
144 name = Form(
"hAmpTofPlane7_%d",
i);
145 hAmpTofPlane7[
i] =
new TH1I(name, name, 1024, 0, 50.);
146 ListAmpTofPlane7->Add(hAmpTofPlane7[
i]);
147 name = Form(
"hTimeTofPlane7_%d",
i);
148 hTimeTofPlane7[
i] =
new TH1I(name, name, 1000, 0, 1000.);
149 ListTimeTofPlane7->Add(hTimeTofPlane7[
i]);
150 name = Form(
"hLeftRightCorelationRPlane7_%d",
i);
151 hLeftRightCorelationRPlane7[
i] =
new TH2S(name, name, 1024, 0., 50., 1024, 0., 50.);
152 ListLRCorrTofPlane7->Add(hLeftRightCorelationRPlane7[
i]);
153 name = Form(
"hLeftMinusRightPlane7_%d",
i);
154 hLeftMinusRightPlane7[
i] =
new TH1I(name, name, 1024, -12., 12.);
155 ListLRTofPlane7->Add(hLeftMinusRightPlane7[
i]);
156 name = Form(
"hLeftRightVsAmpLPlane7_%d",
i);
157 hLeftRightVsAmpLPlane7[
i] =
new TH2S(name, name, 1024, 0., 50., 1024, -12., 12.);
158 ListLRvsAmpLTofPlane7->Add(hLeftRightVsAmpLPlane7[
i]);
159 name = Form(
"hLeftRightVsAmpRPlane7_%d",
i);
160 hLeftRightVsAmpRPlane7[
i] =
new TH2S(name, name, 1024, 0., 50., 1024, -12., 12.);
161 ListLRvsAmpRTofPlane7->Add(hLeftRightVsAmpRPlane7[
i]);
163 TH2I * hAmpLRPlane7 =
new TH2I(
"hAmpLRPlane7",
"hAmpLRPlane7", 1024, 0., 50., 1024, 0., 50.);
164 ListAmpTofPlane7->Add(hAmpLRPlane7);
166 TH1I *hHitStripsPerEvPlane2 =
new TH1I(
"hHitStripsPerEvPlane2",
"Hit Strips Per Ev on Plane#2",
kNST, 0,
kNST);
167 ListStat->Add(hHitStripsPerEvPlane2);
168 TH1I *hHitStripsPerEvPlane7 =
new TH1I(
"hHitStripsPerEvPlane7",
"Hit Strips Per Ev on Plane#7",
kNST, 0,
kNST);
169 ListStat->Add(hHitStripsPerEvPlane7);
170 TH2I *hLefRightCorelation_Plane2 =
new TH2I(
"hLefRightCorelation_Plane2",
" Lef-Right Corelation Plane#2",
kNST, 0,
kNST,
kNST, 0,
kNST);
171 ListStat->Add(hLefRightCorelation_Plane2);
172 TH2I *hLefRightCorelation_Plane7 =
new TH2I(
"hLefRightCorelation_Plane7",
" Lef-Right Corelation Plane#7",
kNST, 0,
kNST,
kNST, 0,
kNST);
173 ListStat->Add(hLefRightCorelation_Plane7);
174 TH2I *hPlane2Plane7Correlation =
new TH2I(
"hPlane2Plane7Correlation",
" Plane2-Plane7 Correlation",
kNST, 0,
kNST,
kNST, 0,
kNST);
175 ListStat->Add(hPlane2Plane7Correlation);
176 TH1S *hNoize =
new TH1S(
"hNoize",
"hNoize", 500, 0, 50);
177 hNoize->GetXaxis()->SetTitle(
"MHz");
178 ListStat->Add(hNoize);
179 Int_t NEvStrip47 = 0;
180 TH1I *hNEvStrip47 =
new TH1I(
"hNEvStrip47",
"hNEvStrip47", 20, 0, 20);
181 ListStat->Add(hNEvStrip47);
183 TList * ListT0 =
new TList();
184 TH1I *hHitT0PerEv =
new TH1I(
"hHitT0PerEv",
"Hit T0 Per Ev", 10, 0, 10);
185 ListT0->Add(hHitT0PerEv);
186 TH1I *hAmpT0 =
new TH1I(
"hAmpT0",
"Amp T0", 1024, 0, 50);
188 TH1I *hTimeT0 =
new TH1I(
"hTimeT0",
"Time T0", 1000, 0, 1000);
189 ListT0->Add(hTimeT0);
191 TH1I * hdt[
kNST + 1];
193 for (Int_t
i = 0;
i <
kNST + 1;
i++) {
194 name = Form(
"hdt_%d",
i);
195 name2 = Form(
"dt T0 - ToF400_Plane7_str_%d",
i);
196 hdt[
i] =
new TH1I(name, name2, 1024 + 512, -18., 18.);
197 hdt[
i]->SetLineWidth(3);
198 ListAnalysis->Add(hdt[
i]);
201 TH2I * hdt_vs_AmpT0[
kNST + 1];
202 for (Int_t
i = 0;
i <
kNST + 1;
i++) {
203 name = Form(
"hdt_vs_AmpT0_%d",
i);
204 name2 = Form(
"dt T0 - ToF400_Plane7_str_%d vs AMP_T0",
i);
205 hdt_vs_AmpT0[
i] =
new TH2I(name, name2, 1024, 0, 50, 1024 + 512, -24, 48);
206 ListAnalysis->Add(hdt_vs_AmpT0[
i]);
209 TH2I * hdt_vs_AmpToF[
kNST + 1];
210 for (Int_t
i = 0;
i <
kNST + 1;
i++) {
211 name = Form(
"hdt_vs_AmpToF_%d",
i);
212 name2 = Form(
"dt T0 - ToF400_Plane7_str_%d vs AMP_TOF400",
i);
213 hdt_vs_AmpToF[
i] =
new TH2I(name, name2, 1024, 0, 50, 1024 + 512, -24, 48);
214 ListAnalysis->Add(hdt_vs_AmpToF[
i]);
217 TH2F *h_StripHit =
new TH2F(
"h_StripHit",
"h_StripHit",
kNST, 0,
kNST, 2, 0, 2);
218 TH1I *h_StripHitSum =
new TH1I(
"h_StripHitSum",
"h_StripHitSum",
kNST, 0,
kNST);
219 TH1F *h_StripAmp =
new TH1F(
"h_StripAmp",
"h_StripAmp",
kNST, 0,
kNST);
220 h_StripAmp->GetYaxis()->SetLabelSize(0.07);
221 h_StripAmp->SetLineWidth(2);
222 h_StripAmp->SetLineColor(46);
223 TH1F *h_StripTime =
new TH1F(
"h_StripTime",
"h_StripTime",
kNST, 0,
kNST);
224 h_StripTime->GetYaxis()->SetLabelSize(0.07);
225 h_StripTime->GetYaxis()->SetRangeUser(-1., 1.);
226 h_StripTime->SetLineWidth(2);
227 h_StripTime->SetLineColor(46);
228 TH1F *h_StripAmpL =
new TH1F(
"h_StripAmpL",
"h_StripAmpL",
kNST, 0,
kNST);
229 h_StripAmpL->GetYaxis()->SetLabelSize(0.07);
230 h_StripAmpL->SetLineWidth(2);
231 h_StripAmpL->SetLineColor(2);
232 TH1F *h_StripTimeL =
new TH1F(
"h_StripTimeL",
"h_StripTimeL",
kNST, 0,
kNST);
233 h_StripTimeL->GetYaxis()->SetLabelSize(0.07);
234 h_StripTimeL->GetYaxis()->SetRangeUser(300, 450);
235 h_StripTimeL->SetLineWidth(2);
236 h_StripTimeL->SetLineColor(2);
237 TH1F *h_StripAmpR =
new TH1F(
"h_StripAmpR",
"h_StripAmpR",
kNST, 0,
kNST);
238 h_StripAmpR->GetYaxis()->SetLabelSize(0.07);
239 h_StripAmpR->SetLineWidth(2);
240 h_StripAmpR->SetLineColor(9);
241 TH1F *h_StripTimeR =
new TH1F(
"h_StripTimeR",
"h_StripTimeR",
kNST, 0,
kNST);
242 h_StripTimeR->GetYaxis()->SetLabelSize(0.07);
243 h_StripTimeR->GetYaxis()->SetRangeUser(300, 450);
244 h_StripTimeR->SetLineWidth(2);
245 h_StripTimeR->SetLineColor(9);
246 TH1F *h_StripLeftMinusRight =
new TH1F(
"h_StripLeftMinusRight",
"h_StripLeftMinusRight",
kNST, 0,
kNST);
247 h_StripLeftMinusRight->GetYaxis()->SetLabelSize(0.07);
248 h_StripLeftMinusRight->GetYaxis()->SetRangeUser(-2.5, 2.5);
249 h_StripLeftMinusRight->SetLineWidth(2);
250 h_StripLeftMinusRight->SetLineColor(9);
251 TH2F *h_StripLeftMinusRight_vs_Time =
new TH2F(
"h_StripLeftMinusRight_vs_Time",
"h_StripLeftMinusRight_vs_Time", 512, -5., 5., 2048, 250., 450.);
252 h_StripLeftMinusRight_vs_Time->GetYaxis()->SetLabelSize(0.07);
253 h_StripLeftMinusRight_vs_Time->GetXaxis()->SetLabelSize(0.07);
254 h_StripLeftMinusRight_vs_Time->SetMarkerStyle(8);
256 TH2F *h_XYTime =
new TH2F(
"h_XYTime",
"h_XYTime",
kNST, 0,
kNST, 64, -16, 16.);
257 h_XYTime->GetYaxis()->SetLabelSize(0.07);
258 h_XYTime->GetXaxis()->SetLabelSize(0.07);
263 TCanvas *c_1 =
new TCanvas(
"c1",
"c1", 20, 20, 1500, 750);
264 TPad *Pad_StripHit =
new TPad(
"Pad_StripHit",
"Pad_StripHit", 0.01, 0.51, 0.49, 0.99, 21);
265 TPad *Pad_StripHitSum =
new TPad(
"Pad_StripHitSum",
"Pad_StripHitSum", 0.01, 0.01, 0.49, 0.49, 21);
266 TPad *Pad_StripAmp =
new TPad(
"Pad_StripAmp",
"Pad_StripAmp", 0.51, 0.51, 0.99, 0.99, 21);
267 TPad *Pad_StripTime =
new TPad(
"Pad_StripTime",
"Pad_StripTime", 0.51, 0.01, 0.99, 0.49, 21);
269 Pad_StripHit->Draw();
270 Pad_StripHitSum->Draw();
271 Pad_StripAmp->Draw();
272 Pad_StripAmp->SetGridy();
273 Pad_StripTime->Draw();
274 Pad_StripTime->SetGridy();
276 TString NameDTFile = file;
277 Point = NameDTFile.First(
'.');
278 NameDTFile.Replace(Point, 15,
"_dt.dat");
279 cout <<
"Write call to " << NameDTFile.Data() << endl;
280 f_dt.open(NameDTFile.Data());
282 for (Int_t iEv = 0; iEv < nEvForRead; iEv++) {
283 if (iEv % 50000 == 0) cout <<
"EVENT: " << iEv << endl;
284 eveTree->GetEntry(iEv);
290 h_StripTime->Reset();
291 h_StripAmpL->Reset();
292 h_StripTimeL->Reset();
293 h_StripAmpR->Reset();
294 h_StripTimeR->Reset();
295 h_StripLeftMinusRight->Reset();
296 h_StripLeftMinusRight_vs_Time->Reset();
299 for (Int_t iDig = 0; iDig < ToF400Digits->GetEntriesFast(); ++iDig) {
316 if ((Plane2.
sTimeR[strip] != 0 && Plane2.
sTimeL[strip] != 0
318 && TMath::Abs((Plane2.
sTimeL[strip] - Plane2.
sTimeR[strip]) * 0.5) <= 2.
319 && TMath::Abs((Plane2.
sAmpL[strip] - Plane2.
sAmpR[strip]) * 0.5) <= 1.5
320 && Plane2.
sStrHit[strip] == kFALSE))
334 if (Plane7.
sTimeL[strip] != 0)
335 hNoize->Fill(1000. / (digTof->
GetTime() - Plane7.
sTimeL[strip]));
350 if ((Plane7.
sTimeR[strip] != 0 && Plane7.
sTimeL[strip] != 0
352 && TMath::Abs((Plane7.
sTimeL[strip] - Plane7.
sTimeR[strip]) * 0.5) <= 2.
353 && TMath::Abs((Plane7.
sAmpL[strip] - Plane7.
sAmpR[strip]) * 0.5) <= 1.5
354 && Plane7.
sStrHit[strip] == kFALSE))
358 hNEvStrip47->Fill(NEvStrip47);
360 for (Int_t
i = 0;
i <
kNST;
i++) {
361 if (Plane2.
sStrHit[
i] == kFALSE ||
i == 0 ||
i == 47) {
368 if (Plane7.
sStrHit[
i] == kFALSE ||
i == 0 ||
i == 47) {
377 for (Int_t iDig = 0; iDig < BC2Digits->GetEntriesFast(); ++iDig) {
385 hAmpT0->Fill(T0.
sAmp);
386 hTimeT0->Fill(T0.
sTime);
390 hHitT0PerEv->Fill(T0.
sNHits);
392 for (Int_t
i = 0;
i <
kNST;
i++)
393 for (Int_t j = 0; j <
kNST; j++) {
395 hLefRightCorelation_Plane2->Fill(
i, j);
397 hLefRightCorelation_Plane7->Fill(
i, j);
400 for (Int_t
i = 0;
i <
kNST;
i++) {
405 h_StripHitSum->Fill(
i);
406 hAmpTofPlane2[
i]->Fill(Plane2.
sAmp[
i]);
407 hTimeTofPlane2[
i]->Fill(Plane2.
sTime[
i]);
408 hLevtMinusRightPlane2[
i]->Fill((Plane2.
sTimeL[
i] - Plane2.
sTimeR[
i]) * 0.5);
409 hAmpTofPlane2[
kNST]->Fill(Plane2.
sAmp[
i]);
429 h_StripHitSum->Fill(
i);
430 hAmpTofPlane7[
i]->Fill(Plane7.
sAmp[
i]);
431 hTimeTofPlane7[
i]->Fill(Plane7.
sTime[
i]);
432 hLeftMinusRightPlane7[
i]->Fill((Plane7.
sTimeL[
i] - Plane7.
sTimeR[
i]) * 0.5);
433 hAmpTofPlane7[
kNST]->Fill(Plane7.
sAmp[
i]);
438 hLeftRightCorelationRPlane7[
i]->Fill(Plane7.
sAmpL[
i], Plane7.
sAmpR[
i]);
460 hHitStripsPerEvPlane2->Fill(Plane2.
sNHits);
461 hHitStripsPerEvPlane7->Fill(Plane7.
sNHits);
472 Int_t MaxStrPlane2 = TMath::LocMax(
kNST, Plane2.
sAmp);
473 Int_t MaxStrPlane7 = TMath::LocMax(
kNST, Plane7.
sAmp);
474 hPlane2Plane7Correlation->Fill(MaxStrPlane2, MaxStrPlane7);
480 && T0.
sAmp >= 17.9 && T0.
sAmp < 19.63) {
481 MaxStr = TMath::LocMax(
kNST, Plane7.
sAmp);
484 hdt[MaxStr]->Fill(dt);
485 hdt_vs_AmpT0[MaxStr]->Fill(T0.
sAmp, dt);
486 hdt_vs_AmpToF[MaxStr]->Fill(Plane7.
sAmpL[MaxStr], dt);
488 hdt_vs_AmpT0[
kNST]->Fill(T0.
sAmp, dt);
489 hdt_vs_AmpToF[
kNST]->Fill(Plane7.
sAmpL[MaxStr], dt);
491 Int_t iEvDig = EventHeader->GetEntriesFast();
492 if (iEvDig != 1) cout <<
"iEvDig == " << iEvDig << endl;
494 f_dt << (digEvent->
GetEventId()) <<
"\t" << MaxStr <<
"\t" << dt << endl;
526 TString NameCallFile = file;
527 Point = NameCallFile.First(
'.');
528 NameCallFile.Replace(Point, 15,
"_call.dat");
529 cout <<
"Write call to " << NameCallFile.Data() << endl;
530 f_call.open(NameCallFile.Data());
533 for (
i = 0;
i <
kNST + 1;
i++) {
535 hAmpTofPlane7[
i]->Fit(f_gaus,
"QW",
"QW", hAmpTofPlane7[
i]->GetMaximumBin() * hAmpTofPlane7[
i]->GetXaxis()->GetBinWidth(1) - 0.5, hAmpTofPlane7[
i]->GetMaximumBin() * hAmpTofPlane7[
i]->GetXaxis()->GetBinWidth(1) + 0.8);
536 sprintf(hid,
"Plane7 Strip %d\t mean %f\t integral %.0f",
i, f_gaus->GetParameter(1), hAmpTofPlane7[
i]->GetEntries());
537 f_call << hid << endl;
545 f_call <<
"Strip\t Mean\t Sigma" << endl;
546 for (
i = 0;
i <
kNST + 1;
i++) {
547 f_gaus->SetParameter(1, 0.);
548 f_gaus->SetParameter(2, 0.1);
549 hdt[
i]->Fit(f_gaus,
"QW",
"QW", -1, 1);
550 f_call <<
i <<
"\t" << f_gaus->GetParameter(1) <<
"\t" << f_gaus->GetParameter(2) * 1000. << endl;
551 cout <<
"Strip " <<
i <<
"\tMean " << f_gaus->GetParameter(1) <<
"\tSigma" << f_gaus->GetParameter(2) * 1000. << endl;
555 TString outName = file;
556 Point = outName.First(
'.');
557 outName.Replace(Point, 15,
"_TofAn.root");
558 TFile *fileout =
new TFile(outName.Data(),
"RECREATE");
561 Dir = fileout->mkdir(
"ToF");
564 TDirectory * DirPlane2;
565 DirPlane2 = Dir->mkdir(
"Plane2");
567 ListTimeTofPlane2->Write();
568 ListAmpTofPlane2->Write();
569 ListLRTofPlane2->Write();
571 TDirectory * DirPlane7;
572 TDirectory * DirLRPlane7;
573 DirPlane7 = Dir->mkdir(
"Plane7");
574 DirLRPlane7 = DirPlane7->mkdir(
"LRCorelation");
576 ListTimeTofPlane7->Write();
577 ListAmpTofPlane7->Write();
579 ListLRCorrTofPlane7->Write();
580 ListLRTofPlane7->Write();
581 ListLRvsAmpLTofPlane7->Write();
582 ListLRvsAmpRTofPlane7->Write();
585 DirT0 = fileout->mkdir(
"T0");
589 TDirectory * DirAnalysis;
590 DirAnalysis = fileout->mkdir(
"Analysis");
592 ListAnalysis->Write();