BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
run_reco_bmn.C
Go to the documentation of this file.
1#include <Rtypes.h>
2#include <TFile.h>
3#include <TKey.h>
4#include <TStopwatch.h>
5#include <TString.h>
6R__ADD_INCLUDE_PATH($VMCWORKDIR)
7#include "macro/run/bmnloadlibs.C"
8
9void run_reco_bmn(TString inputFileName = "evetest_RUN7_GEM.root",
10 TString bmndstFileName = "bmndst_RUN7_GEM.root",
11 Int_t nStartEvent = 0,
12 Int_t nEvents = 1000,
13 TString alignCorrFileName = "align_start_null.root",
14 TString steerGemTrackingFile = "gemTrackingSteer.dat")
15{
16 // Verbosity level (0=quiet, 1=event-level, 2=track-level, 3=debug)
17 Int_t iVerbose = 0;
18
19 // ---- Debug option --------------------------------------------------
20 gDebug = 0;
21
22 // ---- Load libraries --------------------------------------------------
23 bmnloadlibs(); // load BmnRoot libraries
24
25 // ----- Timer ---------------------------------------------------------
26 TStopwatch timer;
27 timer.Start();
28
29 // ----- Reconstruction run --------------------------------------------
30 FairRunAna* fRunAna = new FairRunAna();
31
32 Bool_t isField = kFALSE; // flag for tracking (to use mag.field or not)
33 Bool_t isTarget = kTRUE; // kFALSE; // flag for tracking (run with target or not)
34
35 // Declare input source as simulation file or experimental data
36 FairSource* fFileSource;
37
38 Int_t run_period = 7;
39 Double_t fieldScale = 0.;
40 Bool_t isExp = kTRUE;
41 TVector3 vertex = TVector3(0.5, -4.6, -2.3);
42
43 if (!CheckFileExist(inputFileName))
44 return;
45 fFileSource = new FairFileSource(inputFileName);
46
47 fRunAna->SetSource(fFileSource);
48 fRunAna->SetOutputFile(bmndstFileName);
49 fRunAna->SetGenerateRunInfo(false);
50
51 if (iVerbose == 0) { // print only progress bar in terminal in quiet mode
52 BmnCounter* cntr = new BmnCounter(nEvents);
53 fRunAna->AddTask(cntr);
54 }
55
56 // ====================================================================== //
57 // === GEM hit finder === //
58 // ====================================================================== //
60 BmnGemStripHitMaker* gemHM = new BmnGemStripHitMaker(run_period, isExp);
61 gemHM->SetCurrentConfig(gem_config);
62 gemHM->SetHitMatching(kTRUE);
63 fRunAna->AddTask(gemHM);
64
65 // ====================================================================== //
66 // === ALIGNMENT (GEM) === //
67 // ====================================================================== //
68 // if (iterNum > 0)
69 gemHM->SetAlignmentCorrectionsFileName(alignCorrFileName);
70
71 // ====================================================================== //
72 // === Tracking (GEM) === //
73 // ====================================================================== //
74 BmnGemTracking* gemTF = new BmnGemTracking(run_period, isField, isTarget, steerGemTrackingFile);
75 gemTF->SetRoughVertex(vertex);
76 fRunAna->AddTask(gemTF);
77
78 // ====================================================================== //
79 // === Global Tracking === //
80 // ====================================================================== //
81 BmnGlobalTracking* globalTF = new BmnGlobalTracking();
82 globalTF->SetField(isField);
83 fRunAna->AddTask(globalTF);
84
85 // ====================================================================== //
86 // === Primary vertex finding === //
87 // ====================================================================== //
88 BmnVertexFinder* gemVF = new BmnVertexFinder(run_period);
89 gemVF->SetVertexApproximation(vertex);
90 fRunAna->AddTask(gemVF);
91
92 // Residual analysis
93 BmnGemResiduals* residAnalGem = new BmnGemResiduals(run_period);
94 fRunAna->AddTask(residAnalGem);
95
96 // ----- Parameter database --------------------------------------------
97 FairRuntimeDb* rtdb = fRunAna->GetRuntimeDb();
98 FairParRootFileIo* parIo1 = new FairParRootFileIo();
99 FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
100 parIo1->open(inputFileName.Data());
101 // parIo2->open(parFileNameList, "in");
102 rtdb->setFirstInput(parIo1);
103 // rtdb->setSecondInput(parIo2);
104 rtdb->setOutput(parIo1);
105 rtdb->saveOutput();
106
107 // -------------------------------------------------------------------------
108 // ----- Initialize and run --------------------------------------------
109 fRunAna->GetMainTask()->SetVerbose(iVerbose);
110 fRunAna->Init();
111 cout << "Starting run" << endl;
112 fRunAna->Run(nStartEvent, nStartEvent + nEvents);
113 // -------------------------------------------------------------------------
114 // ----- Finish --------------------------------------------------------
115 timer.Stop();
116 Double_t rtime = timer.RealTime();
117 Double_t ctime = timer.CpuTime();
118 cout << endl << endl;
119 cout << "Macro finished successfully." << endl; // marker of successful execution for CDASH
120 cout << "Input file is " + inputFileName << endl;
121 cout << "Output file is " + bmndstFileName << endl;
122 cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
123 cout << endl;
124 // ------------------------------------------------------------------------
125}
bool Bool_t
int Int_t
Int_t gDebug
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
#define R__ADD_INCLUDE_PATH(PATH)
void SetCurrentConfig(BmnGemStripConfiguration::GEM_CONFIG config)
void SetHitMatching(Bool_t opt=kTRUE)
Double_t RealTime()
void Start(Bool_t reset=kTRUE)
Double_t CpuTime()
void Stop()