17 TString dstFileName =
"$VMCWORKDIR/macro/run/bmndst.root",
18 Int_t nStartEvent = 0,
29 FairLogger::GetLogger()->SetLogScreenLevel(
"info");
41 FairRunAna* fRunAna =
new FairRunAna();
50 Int_t run_period = -1, run_number = -1;
52 fFileSource =
new FairFileSource(inFileName);
59 fFileSource =
new BmnFileSource(inFileName, run_period, run_number);
67 LOG(fatal) <<
"Geometry '" << geometryTag <<
"' not loaded. Error status: " << errStatus << endl;
68 LOG(info) <<
"Geometry with '" << geometryTag <<
"' tag is chosen";
80 int prev_mag_period = run_period, prev_mag_run = run_number;
82 if ((field_voltage == 0) and (prev_mag_run == run_number) and (prev_mag_period == run_period))
83 LOG(fatal) <<
"no any field voltage was found for run " << run_period <<
":" << run_number << endl;
85 LOG(fatal) <<
"no field voltage was found for run " << run_period <<
":" << run_number << endl;
88 if (magField ==
nullptr)
89 LOG(fatal) <<
"no magnetic field was found for the '" << geometryTag <<
"' geometry" << endl;
92 if (map_voltage <= 0) {
93 map_voltage = (run_period < 8) ? 55.87 : 112.0;
94 LOG(warning) <<
"No ref voltage of the magfield in the Geometry DB, " << map_voltage <<
" mV is used";
97 if (field_voltage < 10) {
100 fieldScale = (field_voltage) / map_voltage;
103 if (beam_energy ==
nullptr)
104 LOG(warning) <<
"no beam energy was found for run " << run_period <<
":" << run_number
105 <<
", the field map scale is not corrected";
112 LOG(fatal) <<
"the scale of the magnetic field cannot be set" << endl;
114 fRunAna->SetField(magField);
126 cout <<
"\n\n|||||||||||||||| EXPERIMENTAL RUN SUMMARY ||||||||||||||||" << endl;
127 cout <<
"||\t\t\t\t\t\t\t||" << endl;
128 cout <<
"||\t\tPeriod:\t\t" << run_period <<
"\t\t\t||" << endl;
129 cout <<
"||\t\tNumber:\t\t" << run_number <<
"\t\t\t||" << endl;
130 cout <<
"||\t\tBeam:\t\t" << beam <<
"\t\t\t||" << endl;
131 cout <<
"||\t\tTarget:\t\t" << targ <<
"\t\t\t||" << endl;
132 cout <<
"||\t\tField scale:\t" << setprecision(4) << fieldScale <<
"\t\t\t||" << endl;
133 cout <<
"||\t\t\t\t\t\t\t||" << endl;
134 cout <<
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n\n" << endl;
138 fRunAna->SetSource(fFileSource);
140 if (dstFileName ==
"")
141 dstFileName =
"bmndst.root";
145 fRunAna->SetSink(
new FairRootFileSink(dstFileName));
146 fRunAna->SetGenerateRunInfo(
false);
159 if (run_period == 8 && isExp) {
161 eventSelector->
SetRunId(run_number);
162 eventSelector->
SetInputFileName(
"$VMCWORKDIR/input/eventSelector_calib_run8.root");
163 fRunAna->AddTask(eventSelector);
170 fRunAna->AddTask(trig);
175 if (run_period >= 8) {
178 fRunAna->AddTask(sibtHM);
183 fRunAna->AddTask(mwpcHP);
186 fRunAna->AddTask(mwpcHM);
195 fRunAna->AddTask(vspHM);
203 fRunAna->AddTask(siliconHM);
211 fRunAna->AddTask(gemHM);
219 fRunAna->AddTask(cscHM);
226 fRunAna->AddTask(tof400HP);
233 fRunAna->AddTask(tof700HP);
238 bool IsGlobalCoordinates =
true;
239 if (run_period >= 8) {
243 fRunAna->AddTask(fhcalReco);
246 fRunAna->AddTask(zdcAna);
252 IsGlobalCoordinates =
true;
255 fRunAna->AddTask(scwallReco);
263 fRunAna->AddTask(hodoReco);
270 fRunAna->AddTask(ndetReco);
277 fRunAna->AddTask(vacReco);
287 innerTrackBranchName =
"StsTrack";
289 innerTrackBranchName =
"StsVector";
290 if (run_period >= 8) {
296 if (run_period > 8) {
302 fRunAna->AddTask(hitConverter);
305 fRunAna->AddTask(kalman);
314 fRunAna->AddTask(stsFindTracks);
320 if (run_period > 8) {
323 fRunAna->AddTask(vf);
328 fRunAna->AddTask(stsMatchTracks);
336 fRunAna->AddTask(beamTF);
346 fRunAna->AddTask(findVertex);
350 fRunAna->AddTask(pvMPD);
353 fRunAna->AddTask(combPV);
361 fRunAna->AddTask(glTF);
369 fRunAna->AddTask(mcMatching);
375 if (run_period == 8) {
377 fRunAna->AddTask(dedx);
383 if (run_period < 8) {
385 fRunAna->AddTask(res);
392 fRunAna->AddTask(cclusterizer);
396 fRunAna->AddTask(dst_task);
399 FairRuntimeDb* rtdb = fRunAna->GetRuntimeDb();
400 FairParRootFileIo* parIo1 =
new FairParRootFileIo();
402 parIo1->open(inFileName.Data());
404 rtdb->setFirstInput(parIo1);
409 fRunAna->GetMainTask()->SetVerbose(iVerbose);
414 FairParRootFileIo* parOut =
new FairParRootFileIo(
kTRUE);
417 rtdb->setOutput(parOut);
419 rtdb->getContainer(
"FairGeoParSet")->setDescription(geometryTag.Data());
420 rtdb->writeContainer(rtdb->getContainer(
"FairGeoParSet"), rtdb->getCurrentRun());
426 fRunAna->Run(nStartEvent, nStartEvent + nEvents);
435 cout << endl << endl;
436 cout <<
"Macro finished successfully." << endl;
437 cout <<
"Input file is " + inFileName << endl;
438 cout <<
"Output file is " + dstFileName << endl;
439 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;