37 gROOT->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C");
41 TH2I* hZX =
new TH2I(
"hZX",
"hZX", 1200, -50., 550., 520, -130., 130.);
47 TH2I* hZX_GemHit =
new TH2I(
"hZX_GemHit",
"hZX_GemHit", 1200, -50., 550., 520, -130., 130.);
53 TH2I* hZY =
new TH2I(
"hZY",
"hZY", 1200, -50., 550., 520, -130., 130.);
59 TH2I* hZY_GemHit =
new TH2I(
"hZY_GemHit",
"hZY_GemHit", 1200, -50., 550., 520, -130., 130.);
65 TH2I* hXY_Tof =
new TH2I(
"hXY_Tof",
"hXY_Tof", 240, -150., 150., 150, -75., 75.);
71 TH2I* hXY_Gem =
new TH2I(
"hXY_Gem",
"hXY_Gem", 240, -150., 150., 150, -75., 75.);
77 TH2I* hXY_Tof_PeakX1 =
new TH2I(
"hXY_Tof_PeakX1",
"hXY_Tof_PeakX1", 240, -150., 150., 150, -75., 75.);
81 TH2I* hXY_Tof_PeakX2 =
new TH2I(
"hXY_Tof_PeakX2",
"hXY_Tof_PeakX2", 240, -150., 150., 150, -75., 75.);
85 TH1I* hDeviationX =
new TH1I(
"hDeviationX",
"hDeviationX", 800, -200., 200.);
89 TH1I* hDeviationY =
new TH1I(
"hDeviationY",
"hDeviationY", 800, -200., 200.);
93 TH1I* hDeviation =
new TH1I(
"hDeviation",
"hDeviation", 402, -1., 200.);
98 TH1I* hSeed =
new TH1I(
"hSeed",
"hSeed", 20, 0, 20.);
103 TH1I* hTargetX =
new TH1I(
"hTargetX",
"hTargetX", 80, -10., 10.);
105 TH1I* hTargetY =
new TH1I(
"hTargetY",
"hTargetY", 80, -10., 10.);
107 TH1I* hTargetZ_FromX =
new TH1I(
"hTargetZ_FromX",
"hTargetZ_FromX", 500, -150., 100.);
109 TH1I* hTargetZ_FromY =
new TH1I(
"hTargetZ_FromY",
"hTargetZ_FromY", 500, -150., 100.);
111 TH2I* hTargetXY =
new TH2I(
"hTargetXY",
"hTargetXY", 80, -10., 10., 80, -10., 10.);
116 TPad* Pad_ZX =
new TPad(
"Pad_ZX",
"Pad_ZX", 0.01, 0.51, 0.49, 0.99, 21);
117 TPad* Pad_ZY =
new TPad(
"Pad_ZY",
"Pad_ZY", 0.01, 0.01, 0.49, 0.49, 21);
118 TPad* Pad_XY_on_Tof =
new TPad(
"Pad_XY_on_Tof",
"Pad_XY_on_Tof", 0.51, 0.51, 0.99, 0.99, 21);
119 TPad* Pad_DeviationX =
new TPad(
"Pad_DeviationX",
"Pad_DeviationX", 0.51, 0.01, 0.74, 0.49, 21);
120 TPad* Pad_DeviationY =
new TPad(
"Pad_DeviationY",
"Pad_DeviationY", 0.74, 0.01, 0.99, 0.49, 21);
128 Pad_XY_on_Tof->
Draw();
131 Pad_DeviationX->
Draw();
134 Pad_DeviationY->
Draw();
141 TString inName =
Form(
"$VMCWORKDIR/macro/run/%s", NameFileIn.Data());
143 cout <<
"Open file " << inName << endl << endl;
144 eveTree->
Add(inName);
157 if (nEvForRead == 0 || nEvForRead > nEvents)
158 nEvForRead = nEvents;
159 cout <<
"Will be readed " << nEvForRead <<
" events from " << nEvents << endl;
161 for (
Int_t iEv = 0; iEv < nEvForRead; iEv++) {
163 if (iEv % 50000 == 0)
164 cout <<
"EVENT: " << iEv << endl;
174 if (nHits != 0 && nSeeds != 0) {
199 vLast.reserve(nSeeds);
204 for (
Int_t i = 0;
i < nSeeds;
i++) {
209 vLast.push_back(pLast);
239 FlagGoodSeed =
kTRUE;
241 for (
Int_t i = 0;
i < nSeeds;
i++) {
254 if (FlagGoodSeed ==
kTRUE) {
263 hZX->
Fill(hitTof400->GetZ(), hitTof400->GetX());
264 hZY->
Fill(hitTof400->GetZ(), hitTof400->GetY());
265 hXY_Tof->
Fill(hitTof400->GetX(), hitTof400->GetY());
269 for (
Int_t iseed = 0; iseed < nSeeds; iseed++) {
270 Double_t MinDev = 1000., MinDevY = 1000., MinDevX = 1000., tempx, tempy, dev;
272 for (
Int_t itof = 0; itof < nHits; itof++) {
287 hDeviationX->
Fill(MinDevX);
288 hDeviationY->
Fill(MinDevY);
292 hDeviation->
Fill(MinDev);
305 hZX_GemHit->
Fill(hit->GetZ(), hit->GetX());
306 hZY_GemHit->
Fill(hit->GetZ(), hit->GetY());
354 TF1* fDxFit =
new TF1(
"fDxFit",
"gaus(0) + pol2(3)", -8., 8.);
355 fDxFit->
SetParNames(
"Const1",
"Mean1",
"Sigma1",
"p0",
"p1",
"p2");
358 cout <<
"max Dx = " <<
max;
363 hDeviationX->
Fit(fDxFit,
"BR");
377 TF1* fDyFit =
new TF1(
"fDyFit",
"gaus(0) + pol3(3)", -15., 15.);
378 fDyFit->
SetParNames(
"Const1",
"Mean1",
"Sigma1",
"p0",
"p1",
"p2",
"p3");
381 cout <<
"max Dy = " <<
max;
386 hDeviationY->
Fit(fDyFit,
"BR");
389 TString NameTimeFile =
"Tof400Aligment.dat";
390 cout <<
"Write time to " << NameTimeFile.
Data() << endl;
391 f_time.open(NameTimeFile.
Data(), std::ofstream::out | std::ofstream::app);
392 f_time << endl << NameFileIn << endl;
393 f_time <<
"\tX_Aligment\n\t\t" << fDxFit->
GetParameter(
"Mean1") <<
" +- " << fDxFit->
GetParameter(
"Sigma1") << endl;
395 f_time <<
"\tY_Aligment\n\t\t" << fDyFit->
GetParameter(
"Mean1") <<
" +- " << fDyFit->
GetParameter(
"Sigma1") << endl;
399 cout <<
"Readed " << nEvForRead <<
" events" << endl;
400 cout <<
"Time = " << timer.
RealTime() <<
" s" << endl;
401 cout <<
"Time/Event = " << timer.
RealTime() / (
Double_t)nEvForRead * 1000. <<
" ms/Event" << endl;
402 cout <<
"TimeCPU = " << timer.
CpuTime() <<
" s" << endl;
403 cout <<
"TimeCPU/Event = " << timer.
CpuTime() / (
Double_t)nEvForRead * 1000. <<
" ms/Event" << endl;
409 outName.
Replace(Point, 15,
"_Aligment.root");
410 outName =
Form(
"/home/storage/analysis/%s", outName.
Data());
411 cout <<
"Save data to " << outName.
Data() << endl;
415 hDeviationX->
Write();
416 hDeviationY->
Write();
418 hXY_Tof_PeakX1->
Write();
419 hXY_Tof_PeakX2->
Write();
422 hTargetZ_FromX->
Write();
423 hTargetZ_FromY->
Write();
430 cout <<
"Time for write root = " << timer.
RealTime() <<
" s" << endl;
virtual void SetParNames(const char *name0="", const char *name1="", const char *name2="", const char *name3="", const char *name4="", const char *name5="", const char *name6="", const char *name7="", const char *name8="", const char *name9="", const char *name10="")