98void run_reco_bmn(TString inFileName =
"$VMCWORKDIR/macro/run/bmnsim.root",
99 TString dstFileName =
"$VMCWORKDIR/macro/run/bmndst.root",
100 Int_t nStartEvent = 0,
109 FairLogger::GetLogger()->SetLogScreenLevel(
"info");
120 FairRunAna* fRunAna =
new FairRunAna();
123 Bool_t isTarget = kTRUE;
128 FairSource* fFileSource;
132 Int_t run_period = 8, run_number = -1;
133 Double_t fieldScale = 0.;
135 fFileSource =
new FairFileSource(inFileName);
139 fFileSource =
new BmnFileSource(inFileName, run_period, run_number);
143 TString geoFileName = Form(
"current_geo_file_%d.root", UInt_t(gRandom->Integer(UINT32_MAX)));
146 cout <<
"ERROR: could not read geometry file from the database" << endl;
151 TFile* geoFile =
new TFile(geoFileName,
"READ");
152 if (!geoFile->IsOpen()) {
153 cout <<
"ERROR: could not open ROOT file with geometry: " + geoFileName << endl;
156 TList* keyList = geoFile->GetListOfKeys();
158 TKey* key = (TKey*)next();
159 TString className(key->GetClassName());
160 if (className.BeginsWith(
"TGeoManager"))
163 cout <<
"ERROR: TGeoManager is not top element in geometry file " + geoFileName << endl;
169 if (pCurrentRun == 0)
172 if (field_voltage == NULL) {
173 cout <<
"ERROR: no field voltage was found for run " << run_period <<
":" << run_number << endl;
176 Double_t map_current = (run_period == 8) ? 112.0 : (run_period == 7) ? 55.87 : 0.0;
177 if (*field_voltage < 10) {
180 fieldScale = (*field_voltage) / map_current;
185 fRunAna->SetField(magField);
197 cout <<
"\n\n|||||||||||||||| EXPERIMENTAL RUN SUMMARY ||||||||||||||||" << endl;
198 cout <<
"||\t\t\t\t\t\t\t||" << endl;
199 cout <<
"||\t\tPeriod:\t\t" << run_period <<
"\t\t\t||" << endl;
200 cout <<
"||\t\tNumber:\t\t" << run_number <<
"\t\t\t||" << endl;
201 cout <<
"||\t\tBeam:\t\t" << beam <<
"\t\t\t||" << endl;
202 cout <<
"||\t\tTarget:\t\t" << targ <<
"\t\t\t||" << endl;
203 cout <<
"||\t\tField scale:\t" << setprecision(4) << fieldScale <<
"\t\t\t||" << endl;
204 cout <<
"||\t\t\t\t\t\t\t||" << endl;
205 cout <<
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n\n" << endl;
206 remove(geoFileName.Data());
209 fRunAna->SetSource(fFileSource);
211 if (dstFileName ==
"")
212 dstFileName =
"bmndst.root";
216 fRunAna->SetSink(
new FairRootFileSink(dstFileName));
217 fRunAna->SetGenerateRunInfo(
false);
227 TList* parFileNameList =
new TList();
232 if (run_period >= 8 && isExp) {
234 eventSelector->
SetRunId(run_number);
235 eventSelector->
SetInputFileName(
"$VMCWORKDIR/input/eventSelector_calib_run8.root");
236 fRunAna->AddTask(eventSelector);
243 fRunAna->AddTask(trig);
248 if (run_period >= 8) {
251 fRunAna->AddTask(sibtHM);
256 fRunAna->AddTask(mwpcHP);
259 fRunAna->AddTask(mwpcHM);
268 fRunAna->AddTask(siliconHM);
276 fRunAna->AddTask(gemHM);
286 fRunAna->AddTask(cscHM);
293 fRunAna->AddTask(tof1HP);
298 BmnTof701HitProducer* tof701HP =
new BmnTof701HitProducer(
"TOF701", !isExp, iVerbose, kFALSE);
299 tof701HP->SetPeriodRun(run_period, run_number);
300 fRunAna->AddTask(tof701HP);
313 bool IsGlobalCoordinates =
true;
314 if (run_period >= 8) {
318 fRunAna->AddTask(fhcalReco);
321 fRunAna->AddTask(zdcAna);
327 IsGlobalCoordinates =
true;
330 fRunAna->AddTask(scwallReco);
338 fRunAna->AddTask(hodoReco);
343 IsGlobalCoordinates =
true;
346 fRunAna->AddTask(ndetReco);
353 fRunAna->AddTask(vacReco);
358 TString innerTrackBranchName;
360 innerTrackBranchName =
"StsTrack";
362 innerTrackBranchName =
"StsVector";
363 if (run_period >= 8) {
368 fRunAna->AddTask(hitConverter);
371 fRunAna->AddTask(kalman);
374 TString stsMatBudgetFile =
"";
376 fRunAna->AddTask(l1);
379 FairTask* stsFindTracks =
new CbmStsFindTracks(iVerbose,
"CbmL1StsTrackFinder");
380 fRunAna->AddTask(stsFindTracks);
385 fRunAna->AddTask(vf);
390 fRunAna->AddTask(stsMatchTracks);
395 fRunAna->AddTask(innerTF);
401 if (run_period >= 8) {
404 fRunAna->AddTask(beamTF);
408 fRunAna->AddTask(mwpcTF);
425 fRunAna->AddTask(findVertex);
429 fRunAna->AddTask(pvMPD);
432 fRunAna->AddTask(combPV);
442 Bool_t doAlign = kTRUE;
448 fRunAna->AddTask(glTF);
459 fRunAna->AddTask(mcMatching);
466 fRunAna->AddTask(pid_analyser);
471 if (run_period < 8) {
473 fRunAna->AddTask(res);
480 fRunAna->AddTask(cclusterizer);
484 fRunAna->AddTask(dst_task);
487 FairRuntimeDb* rtdb = fRunAna->GetRuntimeDb();
488 FairParRootFileIo* parIo1 =
new FairParRootFileIo();
489 FairParAsciiFileIo* parIo2 =
new FairParAsciiFileIo();
490 parIo1->open(inFileName.Data());
491 parIo2->open(parFileNameList,
"in");
492 rtdb->setFirstInput(parIo1);
493 rtdb->setSecondInput(parIo2);
497 fRunAna->GetMainTask()->SetVerbose(iVerbose);
502 FairParRootFileIo* parOut =
new FairParRootFileIo(kTRUE);
505 rtdb->setOutput(parOut);
506 rtdb->writeContainer(rtdb->getContainer(
"FairGeoParSet"), rtdb->getCurrentRun());
512 fRunAna->Run(nStartEvent, nStartEvent + nEvents);
518 delete parFileNameList;
524 delete TDatabasePDG::Instance();
528 Double_t rtime = timer.RealTime();
529 Double_t ctime = timer.CpuTime();
530 cout << endl << endl;
531 cout <<
"Macro finished successfully." << endl;
532 cout <<
"Input file is " + inFileName << endl;
533 cout <<
"Output file is " + dstFileName << endl;
534 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;