43 TString dstFileName =
"$VMCWORKDIR/macro/run/bmndst.root",
44 Int_t nStartEvent = 0,
54 FairLogger::GetLogger()->SetLogScreenLevel(
"info");
66 FairRunAna* fRunAna =
new FairRunAna();
78 Int_t run_period = 9, run_number = -1;
81 fFileSource =
new FairFileSource(inFileName);
86 fFileSource =
new BmnFileSource(inFileName, run_period, run_number);
93 cout <<
"ERROR: Geometry not loaded. Error status " << errStatus << endl;
101 cout <<
"ERROR: could not read geometry file from the database" << endl;
106 TFile* geoFile =
new TFile(geoFileName,
"READ");
108 cout <<
"ERROR: could not open ROOT file with geometry: " + geoFileName << endl;
118 cout <<
"ERROR: TGeoManager is not top element in geometry file " + geoFileName << endl;
124 if (pCurrentRun == 0)
132 int prev_mag_period = run_period, prev_mag_run = run_number;
134 if ((field_voltage == 0) and (prev_mag_run == run_number) and (prev_mag_period == run_period)) {
135 cout <<
"ERROR: no any field voltage was found for run " << run_period <<
":" << run_number << endl;
139 cout <<
"ERROR: no field voltage was found for run " << run_period <<
":" << run_number << endl;
143 Double_t map_voltage = (run_period < 8) ? 55.87 : 112.0;
153 if (field_voltage < 10) {
156 fieldScale = (field_voltage) / map_voltage;
161 fRunAna->SetField(magField);
173 cout <<
"\n\n|||||||||||||||| EXPERIMENTAL RUN SUMMARY ||||||||||||||||" << endl;
174 cout <<
"||\t\t\t\t\t\t\t||" << endl;
175 cout <<
"||\t\tPeriod:\t\t" << run_period <<
"\t\t\t||" << endl;
176 cout <<
"||\t\tNumber:\t\t" << run_number <<
"\t\t\t||" << endl;
177 cout <<
"||\t\tBeam:\t\t" << beam <<
"\t\t\t||" << endl;
178 cout <<
"||\t\tTarget:\t\t" << targ <<
"\t\t\t||" << endl;
179 cout <<
"||\t\tField scale:\t" << setprecision(4) << fieldScale <<
"\t\t\t||" << endl;
180 cout <<
"||\t\t\t\t\t\t\t||" << endl;
181 cout <<
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n\n" << endl;
183 remove(geoFileName.
Data());
187 fRunAna->SetSource(fFileSource);
189 if (dstFileName ==
"")
190 dstFileName =
"bmndst.root";
194 fRunAna->SetSink(
new FairRootFileSink(dstFileName));
195 fRunAna->SetGenerateRunInfo(
false);
210 if (run_period == 8 && isExp) {
212 eventSelector->
SetRunId(run_number);
213 eventSelector->
SetInputFileName(
"$VMCWORKDIR/input/eventSelector_calib_run8.root");
214 fRunAna->AddTask(eventSelector);
221 fRunAna->AddTask(trig);
226 if (run_period >= 8) {
234 fRunAna->AddTask(mwpcHP);
237 fRunAna->AddTask(mwpcHM);
246 fRunAna->AddTask(vspHM);
254 fRunAna->AddTask(siliconHM);
262 fRunAna->AddTask(gemHM);
272 fRunAna->AddTask(cscHM);
279 fRunAna->AddTask(tof400HP);
286 fRunAna->AddTask(tof700HP);
299 bool IsGlobalCoordinates =
true;
300 if (run_period >= 8) {
304 fRunAna->AddTask(fhcalReco);
307 fRunAna->AddTask(zdcAna);
313 IsGlobalCoordinates =
true;
316 fRunAna->AddTask(scwallReco);
324 fRunAna->AddTask(hodoReco);
329 IsGlobalCoordinates =
true;
332 fRunAna->AddTask(ndetReco);
339 fRunAna->AddTask(vacReco);
347 innerTrackBranchName =
"StsTrack";
349 innerTrackBranchName =
"StsVector";
350 if (run_period >= 8) {
356 fRunAna->AddTask(hitConverter);
363 FairRuntimeDb* rtdb = fRunAna->GetRuntimeDb();
364 FairParRootFileIo* parIo1 =
new FairParRootFileIo();
365 FairParAsciiFileIo* parIo2 =
new FairParAsciiFileIo();
366 parIo1->open(inFileName.Data());
367 parIo2->open(parFileNameList,
"in");
368 rtdb->setFirstInput(parIo1);
369 rtdb->setSecondInput(parIo2);
373 fRunAna->GetMainTask()->SetVerbose(iVerbose);
378 FairParRootFileIo* parOut =
new FairParRootFileIo(
kTRUE);
381 rtdb->setOutput(parOut);
382 rtdb->writeContainer(rtdb->getContainer(
"FairGeoParSet"), rtdb->getCurrentRun());
388 fRunAna->Run(nStartEvent, nStartEvent + nEvents);
396 cout << endl << endl;
397 cout <<
"Macro finished successfully." << endl;
398 cout <<
"Input file is " + inFileName << endl;
399 cout <<
"Output file is " + dstFileName << endl;
400 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
void dump_hits(TString inFileName="$VMCWORKDIR/macro/run/bmnsim.root", TString dstFileName="$VMCWORKDIR/macro/run/bmndst.root", Int_t nStartEvent=0, Int_t nEvents=0, enumTracking tracking=VectorFinder)
Run reconstruction and export the converted hits to .csv.