8 plots(Int_t nEvents = 1000, Int_t iout = 1, TString mcEngine =
"TGeant3")
13 TString MCFile =
"testrun_" + mcEngine +
".root";
14 TString ParFile =
"testparams_" + mcEngine +
".root";
15 TString RecoFile =
"testreco_" + mcEngine +
".root";
22 fRun->AddFriend(RecoFile.Data());
26 parInput1->
open(ParFile.Data());
29 TFile *f1 = TFile::Open(MCFile);
30 TFile *f2 = TFile::Open(RecoFile);
32 TTree *t1 = f1->Get(
"cbmsim");
33 TTree *t2 = f2->Get(
"cbmsim");
36 TClonesArray *MCTracks =
new TClonesArray(
"FairMCTrack");
37 TClonesArray *TutorialDetPoints =
new TClonesArray(
"FairTutorialDet4Point");
38 TClonesArray *TutorialDetHits =
new TClonesArray(
"FairTutorialDet4Hit");
40 t1->SetBranchAddress(
"MCEventHeader.", &MCEventHeader);
41 t1->SetBranchAddress(
"MCTrack", &MCTracks);
42 t1->SetBranchAddress(
"TutorialDetPoint", &TutorialDetPoints);
43 t2->SetBranchAddress(
"TutorialDetHit", &TutorialDetHits);
56 TH2F *dxx =
new TH2F(
"dxx",
"Hit; x; Delta x;", 100, -xrange, xrange, 50., -10., 10.);
57 TH2F *dyy =
new TH2F(
"dyy",
"Hit; y; Delta y;", 100, -yrange, yrange, 50., -10., 10.);
58 TH1F *pullx =
new TH1F(
"pullx",
"Hit; pullx;", 100., -5., 5.);
59 TH1F *pully =
new TH1F(
"pully",
"Hit; pully;", 100., -5., 5.);
60 TH1F *pullz =
new TH1F(
"pullz",
"Hit; pullz;", 50., -10., 10.);
61 TH1F *pointx =
new TH1F(
"pointx",
"Hit; posx;", 200., -80., 80.);
62 TH1F *pointy =
new TH1F(
"pointy",
"Hit; posy;", 200., -80., 80.);
64 Int_t nMCTracks, nPoints, nHits;
65 Float_t x_point, y_point, z_point, tof_point, SMtype_point, mod_point, cel_point, gap_point;
66 Float_t x_poi, y_poi, z_poi;
67 Float_t SMtype_poi, mod_poi, cel_poi, gap_poi;
68 Float_t p_MC, px_MC, py_MC, pz_MC;
69 Float_t x_hit, y_hit, z_hit, dy_hit;
71 Int_t nevent = t1->GetEntries();
76 cout <<
"total number of events to process: " << nevent << endl;
80 for (Int_t iev = 0; iev < nevent; iev++) {
85 nMCTracks = MCTracks->GetEntriesFast();
86 nPoints = TutorialDetPoints->GetEntriesFast();
87 nHits = TutorialDetHits->GetEntriesFast();
89 cout <<
" Event" << iev <<
":";
90 cout << nMCTracks <<
" MC tracks ";
91 cout << nPoints <<
" points ";
92 cout << nHits <<
" Hits " << endl;
95 for (Int_t j = 0; j < nHits; j++) {
101 x_poi = Point->
GetX();
102 y_poi = Point->
GetY();
103 z_poi = Point->
GetZ();
109 dy_hit = Hit->
GetDy();
112 Float_t delta_x = x_poi - x_hit;
113 Float_t delta_y = y_poi - y_hit;
114 Float_t delta_z = z_poi - z_hit;
116 dxx->Fill(x_poi, delta_x);
117 dyy->Fill(y_poi, delta_y);
118 pullx->Fill(delta_x);
119 pully->Fill(delta_y);
120 pullz->Fill(delta_z);
130 cout <<
"Processing done, outflag =" << iout << endl;
134 TIter next(gDirectory->GetList());
137 while (obj = (TObject *)next()) {
138 if (obj->InheritsFrom(TH1::Class())) {
140 cout <<
"Write histo " << h->GetTitle() << endl;
151 cout << endl << endl;
157 cout <<
"<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
159 cout <<
"</DartMeasurement>" << endl;
162 Double_t rtime = timer.RealTime();
163 Double_t ctime = timer.CpuTime();
165 Float_t cpuUsage = ctime / rtime;
166 cout <<
"<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
168 cout <<
"</DartMeasurement>" << endl;
170 cout << endl << endl;
171 cout <<
"Output file is " << outFile << endl;
172 cout <<
"Parameter file is " << parFile << endl;
173 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
"s" << endl << endl;
174 cout <<
"Macro finished successfully." << endl;
list of container factories
void SetSink(FairSink *tempSink)
Int_t GetRefIndex() const
FairRuntimeDb * GetRuntimeDb(void)
Bool_t open(const Text_t *fname, Option_t *option="READ", const Text_t *ftitle="", Int_t compress=1)
plots(Int_t nEvents=1000, Int_t iout=1, TString mcEngine="TGeant3")
virtual void SetSource(FairSource *tempSource)
Bool_t setFirstInput(FairParIo *)