BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
run_qa_exp.C
Go to the documentation of this file.
1// #include <Rtypes.h>
2#include <TString.h>
3
4R__ADD_INCLUDE_PATH($VMCWORKDIR)
5
6void run_qa_exp(TString inFileName = "", TString outFileName = "", Int_t nStartEvent = 0, Int_t nEvents = 0)
7{
8
9 TStopwatch timer;
10 timer.Start();
11
12 // check input file exists
13 if (!BmnFunctionSet::CheckFileExist(inFileName, 1))
14 exit(-1);
15
16 FairRunAna* fRunAna = new FairRunAna();
17
18 Int_t fieldType = -1;
19 Double_t fieldScale = 0.;
20 FairField* magField = BmnFunctionAna::GetDSTField(inFileName, fieldScale, fieldType);
21 if (magField != nullptr)
22 fRunAna->SetField(magField);
23
24 // flag for FairRunAna tasks whether simulation or experimental data are used
25 Bool_t isExp = (BmnFunctionSet::isSimulationFile(inFileName) == 0);
26
27 // Load geometry file
28 // GeoSetup gSetup;
29 // gSetup.LoadSetupToGeoManager(gSetup.GetLastApprovedSetupTag("run8"));
30 TGeoManager::Import("current_geo_file.root");
31
32 // Declare input source as simulation file or experimental data
33 FairFileSource* fFileSource = new FairFileSource(inFileName);
34 fRunAna->SetSource(fFileSource);
35
36 // if directory for the output file does not exist, then create
37 if (BmnFunctionSet::CreateDirectoryTree(outFileName, 1) < 0)
38 exit(-2);
39 fRunAna->SetSink(new FairRootFileSink(outFileName));
40 fRunAna->SetGenerateRunInfo(false);
41
42 FairTask* pKF = new CbmKF();
43 fRunAna->AddTask(pKF);
44
45 // BmnTof400Qa* tof400QaTask = new BmnTof400Qa();
46 // fRunAna->AddTask(tof400QaTask);
47
48 BmnTof700Qa* tof700QaTask = new BmnTof700Qa();
49 fRunAna->AddTask(tof700QaTask);
50
51 fRunAna->Init();
52 fRunAna->Run(0, nEvents);
53
54 // remove(geoFileName.Data());
55
56 timer.Stop();
57 Double_t rtime = timer.RealTime();
58 Double_t ctime = timer.CpuTime();
59 cout << endl << endl;
60 cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
61 cout << endl;
62}
bool Bool_t
int Int_t
double Double_t
#define R__ADD_INCLUDE_PATH(PATH)
static FairField * GetDSTField(TString fileName, Double_t &fieldScale, Int_t &fieldType, TString *beam=nullptr, TString *target=nullptr, Double_t *beam_energy=nullptr, Int_t *beam_a=nullptr, Int_t *beam_z=nullptr, Int_t *target_a=nullptr, Int_t *target_z=nullptr)
static int CreateDirectoryTree(TString &fileName, int iVerbose=0, EAccessMode mode=kWritePermission)
static int isSimulationFile(TString fileName="")
static int CheckFileExist(TString &fileName, int iVerbose=0, EAccessMode mode=kFileExists)
The CbmKF Kalman Filter algorithm.
Definition CbmKF.h:28
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
Double_t RealTime()
void Start(Bool_t reset=kTRUE)
Double_t CpuTime()
void Stop()
void run_qa_exp(TString inFileName="", TString outFileName="", Int_t nStartEvent=0, Int_t nEvents=0)
Definition run_qa_exp.C:6