76 TString srcdstFileName = "$VMCWORKDIR/macro/
run/srcdst.root",
77 Int_t nStartEvent = 0,
93 FairRunAna* fRunAna =
new FairRunAna();
97 (inputFileName.Contains(
"noField")) ? kFALSE : kTRUE;
98 Bool_t isTarget = kTRUE;
103 FairSource* fFileSource;
107 Int_t run_period = 7, run_number = -2;
108 Double_t fieldScale = 0.;
110 fFileSource =
new FairFileSource(inputFileName);
114 fFileSource =
new BmnFileSource(inputFileName, run_period, run_number);
118 TString geoFileName = Form(
"current_geo_file_%d.root", UInt_t(gRandom->Integer(UINT32_MAX)));
121 cout <<
"ERROR: could not read geometry file from the database" << endl;
126 TFile* geoFile =
new TFile(geoFileName,
"READ");
127 if (!geoFile->IsOpen()) {
128 cout <<
"ERROR: could not open ROOT file with geometry: " + geoFileName << endl;
131 TList* keyList = geoFile->GetListOfKeys();
133 TKey* key = (TKey*)next();
134 TString className(key->GetClassName());
135 if (className.BeginsWith(
"TGeoManager"))
138 cout <<
"ERROR: TGeoManager is not top element in geometry file " + geoFileName << endl;
144 if (pCurrentRun == 0)
147 if (field_voltage == NULL) {
148 cout <<
"ERROR: no field voltage was found for run " << run_period <<
":" << run_number << endl;
151 Double_t map_current = 55.87;
152 if (*field_voltage < 10) {
156 fieldScale = (*field_voltage) / map_current;
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;
182 remove(geoFileName.Data());
185 fRunAna->SetSource(fFileSource);
189 fRunAna->SetSink(
new FairRootFileSink(srcdstFileName));
190 fRunAna->SetGenerateRunInfo(
false);
200 TList* parFileNameList =
new TList();
207 fRunAna->AddTask(mwpcHP);
210 fRunAna->AddTask(mwpcHM);
218 fRunAna->AddTask(siliconHM);
227 fRunAna->AddTask(gemHM);
236 fRunAna->AddTask(cscHM);
243 fRunAna->AddTask(tof1HP);
249 new BmnTofHitProducer(
"TOF",
"TOF700_geometry_run7_panin.txt", !isExp, iVerbose, kFALSE);
258 fRunAna->AddTask(tof2HP);
265 fRunAna->AddTask(armTrigHitProducer);
273 fRunAna->AddTask(bcHitProducer);
286 fRunAna->AddTask(mwpcTF);
293 fRunAna->AddTask(siHP);
296 fRunAna->AddTask(siTF);
302 fRunAna->AddTask(upTF);
308 fRunAna->AddTask(innerTF);
316 fRunAna->AddTask(dchHP);
321 fRunAna->AddTask(dchTF);
325 fRunAna->AddTask(res);
328 glTF->SetSrcSetup(kTRUE);
330 fRunAna->AddTask(glTF);
336 fRunAna->AddTask(VF);
342 fRunAna->AddTask(dst_task);
345 fRunAna->AddTask(pid);
348 FairRuntimeDb* rtdb = fRunAna->GetRuntimeDb();
349 FairParRootFileIo* parIo1 =
new FairParRootFileIo();
350 FairParAsciiFileIo* parIo2 =
new FairParAsciiFileIo();
351 parIo1->open(inputFileName.Data());
352 parIo2->open(parFileNameList,
"in");
353 rtdb->setFirstInput(parIo1);
354 rtdb->setSecondInput(parIo2);
355 rtdb->setOutput(parIo1);
359 fRunAna->GetMainTask()->SetVerbose(iVerbose);
361 cout <<
"Starting run" << endl;
362 fRunAna->Run(nStartEvent, nStartEvent + nEvents);
366 Double_t rtime = timer.RealTime();
367 Double_t ctime = timer.CpuTime();
368 cout << endl << endl;
369 cout <<
"Macro finished successfully." << endl;
370 cout <<
"Input file is " + inputFileName << endl;
371 cout <<
"Output file is " + srcdstFileName << endl;
372 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;