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;
144 if (field_voltage < 10) {
147 fieldScale = (field_voltage) / map_voltage;
156 fRunAna->SetField(magField);
168 cout <<
"\n\n|||||||||||||||| EXPERIMENTAL RUN SUMMARY ||||||||||||||||" << endl;
169 cout <<
"||\t\t\t\t\t\t\t||" << endl;
170 cout <<
"||\t\tPeriod:\t\t" << run_period <<
"\t\t\t||" << endl;
171 cout <<
"||\t\tNumber:\t\t" << run_number <<
"\t\t\t||" << endl;
172 cout <<
"||\t\tBeam:\t\t" << beam <<
"\t\t\t||" << endl;
173 cout <<
"||\t\tTarget:\t\t" << targ <<
"\t\t\t||" << endl;
174 cout <<
"||\t\tField scale:\t" << setprecision(4) << fieldScale <<
"\t\t\t||" << endl;
175 cout <<
"||\t\t\t\t\t\t\t||" << endl;
176 cout <<
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n\n" << endl;
178 remove(geoFileName.
Data());
182 fRunAna->SetSource(fFileSource);
184 if (dstFileName ==
"")
185 dstFileName =
"bmndst.root";
189 fRunAna->SetSink(
new FairRootFileSink(dstFileName));
190 fRunAna->SetGenerateRunInfo(
false);
205 if (run_period == 8 && isExp) {
207 eventSelector->
SetRunId(run_number);
208 eventSelector->
SetInputFileName(
"$VMCWORKDIR/input/eventSelector_calib_run8.root");
209 fRunAna->AddTask(eventSelector);
216 fRunAna->AddTask(trig);
221 if (run_period >= 8) {
229 fRunAna->AddTask(mwpcHP);
232 fRunAna->AddTask(mwpcHM);
241 fRunAna->AddTask(vspHM);
249 fRunAna->AddTask(siliconHM);
257 fRunAna->AddTask(gemHM);
267 fRunAna->AddTask(cscHM);
274 fRunAna->AddTask(tof400HP);
281 fRunAna->AddTask(tof700HP);
294 bool IsGlobalCoordinates =
true;
295 if (run_period >= 8) {
299 fRunAna->AddTask(fhcalReco);
302 fRunAna->AddTask(zdcAna);
308 IsGlobalCoordinates =
true;
311 fRunAna->AddTask(scwallReco);
319 fRunAna->AddTask(hodoReco);
324 IsGlobalCoordinates =
true;
327 fRunAna->AddTask(ndetReco);
334 fRunAna->AddTask(vacReco);
342 innerTrackBranchName =
"StsTrack";
344 innerTrackBranchName =
"StsVector";
345 if (run_period >= 8) {
351 fRunAna->AddTask(hitConverter);
358 FairRuntimeDb* rtdb = fRunAna->GetRuntimeDb();
359 FairParRootFileIo* parIo1 =
new FairParRootFileIo();
360 FairParAsciiFileIo* parIo2 =
new FairParAsciiFileIo();
361 parIo1->open(inFileName.Data());
362 parIo2->open(parFileNameList,
"in");
363 rtdb->setFirstInput(parIo1);
364 rtdb->setSecondInput(parIo2);
368 fRunAna->GetMainTask()->SetVerbose(iVerbose);
373 FairParRootFileIo* parOut =
new FairParRootFileIo(
kTRUE);
376 rtdb->setOutput(parOut);
377 rtdb->writeContainer(rtdb->getContainer(
"FairGeoParSet"), rtdb->getCurrentRun());
383 fRunAna->Run(nStartEvent, nStartEvent + nEvents);
391 cout << endl << endl;
392 cout <<
"Macro finished successfully." << endl;
393 cout <<
"Input file is " + inFileName << endl;
394 cout <<
"Output file is " + dstFileName << endl;
395 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.