BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
run_reco_gem.C
Go to the documentation of this file.
1// --------------------------------------------------------------------------
2//
3// Macro for reconstruction of simulated events with standard settings
4//
5// HitProducers in MVD, RICH, TRD, TOF, ECAL
6// Digitizer and HitFinder in STS
7// FAST MC for ECAL
8// STS track finding and fitting (L1 / KF)
9// TRD track finding and fitting (L1 / KF)
10// RICH ring finding (ideal) and fitting
11// Global track finding (ideal), rich assignment
12// Primary vertex finding (ideal)
13// Matching of reconstructed and MC tracks in STS, RICH and TRD
14//
15// V. Friese 24/02/2006
16// Version 24/04/2007 (V. Friese)
17//
18// --------------------------------------------------------------------------
19#include "../run/bmnloadlibs.C"
20
21#include <TGDMLParse.h>
22
23void run_reco_gem(TString mcFile = "mc.root", Int_t nEvents = 10000)
24{
25
26 // ========================================================================
27 // Adjust this part according to your requirements
28
29 // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
30 Int_t iVerbose = 1;
31 // Int_t iVerbose = 3;
32
33 // Input file (MC events)
34 // TString inFile = "data/AuAu_urqmd_3.3p1_4.0_gev__10000_ev__centr__seed_1_fscale88.mc.root";
35 // TString inFile = "mc.root";
36
37 // Parameter file
38 // TString parFile = "data/AuAu_urqmd_3.3p1_4.0_gev__10000_ev__mbias__seed_0_params.root";
39 TString dir = "./"; // Output directory
40 TString inFile = /*dir +*/ mcFile; // MC transport file
41
42 TString scriptFile = TString(gSystem->Getenv("MCFILE"));
43 if (scriptFile != "")
44 inFile = dir + scriptFile;
45 TString parFile = inFile;
46
47 // Output file
48 TString outFile = "data/reco.root";
49 TString recoFile = TString(gSystem->Getenv("RECOFILE"));
50 if (recoFile != "")
51 outFile = dir + recoFile;
52
53 // Digitisation files.
54 // Add TObjectString containing the different file names to
55 // a TList which is passed as input to the FairParAsciiFileIo.
56 // The FairParAsciiFileIo will take care to create on the fly
57 // a concatenated input parameter file which is then used during
58 // the reconstruction.
59 TList* parFileList = new TList();
60
61 TString paramDir = gSystem->Getenv("VMCWORKDIR");
62 paramDir += "/parameters";
63
64 // TObjString stsDigiFile = paramDir + "/sts/sts_v12b_12344444_std.digi.par";
65 TObjString stsDigiFile = paramDir + "/sts_v17a_gem.digi.par";
66 // TObjString stsDigiFile = paramDir + "/sts_v15a90_gem.digi.par";
67 // TObjString stsDigiFile = paramDir + "/sts_1st_30.digi.par";
68 // TObjString stsDigiFile = paramDir + "/sts_var.digi.par";
69 TString stsMatBudgetFile = ""; // paramDir + "/sts/sts_matbudget_v12b_12344444.root";
70 // TString stsMatBudgetFile = paramDir + "/sts_matbudget_var_fr.root";
71 parFileList->Add(&stsDigiFile);
72
73 // In general, the following parts need not be touched
74 // ========================================================================
75
76 // ---- Debug option -------------------------------------------------
77 gDebug = 0;
78 // ------------------------------------------------------------------------
79
80 // ----- Timer --------------------------------------------------------
81 TStopwatch timer;
82 timer.Start();
83// ------------------------------------------------------------------------
84
85// ---- Load libraries --------------------------------------------------
86#if ROOT_VERSION_CODE < ROOT_VERSION(5, 99, 99)
87 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
88#endif
89 bmnloadlibs(); // load BmnRoot libraries
90 /*
91 // ---- Load libraries -------------------------------------------------
92 gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
93 basiclibs();
94 gSystem->Load("libFairTools");
95 gSystem->Load("libGeoBase");
96 gSystem->Load("libParBase");
97 gSystem->Load("libBase");
98 //gSystem->Load("libCbmBase");
99 //gSystem->Load("libCbmData");
100 //gSystem->Load("libField");
101 gSystem->Load("libBmnData");
102 gSystem->Load("libBmnField");
103 gSystem->Load("libGen");
104 gSystem->Load("libPassive");
105 //gSystem->Load("libEcal");
106 gSystem->Load("libKF");
107 //gSystem->Load("libMvd");
108 gSystem->Load("libSts");
109 //gSystem->Load("libLittrack");
110 //gSystem->Load("libRich");
111 //gSystem->Load("libTrd");
112 //gSystem->Load("libTof");
113 //gSystem->Load("libGlobal");
114 //gSystem->Load("libL1");
115 gSystem->Load("libCat");
116 gSystem->Load("libMinuit2"); // Nedded for rich ellipse fitter
117 // ------------------------------------------------------------------------
118
119 */
120 // AC added
121 FairSource* fFileSource;
122 fFileSource = new BmnFileSource(inFile);
123
124 // ----- Reconstruction run -------------------------------------------
125 FairRunAna* run = new FairRunAna();
126 // run->SetInputFile(inFile);
127 run->SetInputFile(fFileSource);
128 run->SetOutputFile(outFile);
129 // ------------------------------------------------------------------------
130
131 // =========================================================================
132 // === Detector Response Simulation (Digitiser) ===
133 // === (where available) ===
134 // =========================================================================
135
136 // ----- STS digitizer -------------------------------------------------
137 Double_t threshold = 4;
138 Double_t noiseWidth = 0.01;
139 Int_t nofBits = 12;
140 // Double_t electronsPerAdc = 10;
141 Double_t electronsPerAdc = 20; // AZ
142 Double_t StripDeadTime = 0.1;
143 Double_t minStep = 0.00004; // AZ
144 CbmStsDigitize* stsDigitize = new CbmStsDigitize("STS Digitiser", iVerbose);
145 stsDigitize->SetRealisticResponse();
146 stsDigitize->SetFrontThreshold(threshold);
147 stsDigitize->SetBackThreshold(threshold);
148 stsDigitize->SetFrontNoiseWidth(noiseWidth);
149 stsDigitize->SetBackNoiseWidth(noiseWidth);
150 stsDigitize->SetFrontNofBits(nofBits);
151 stsDigitize->SetBackNofBits(nofBits);
152 stsDigitize->SetFrontNofElPerAdc(electronsPerAdc);
153 stsDigitize->SetBackNofElPerAdc(electronsPerAdc);
154 stsDigitize->SetStripDeadTime(StripDeadTime);
155 stsDigitize->SetStep(minStep); // AZ
156 run->AddTask(stsDigitize);
157 // -------------------------------------------------------------------------
158
159 // =========================================================================
160 // === STS local reconstruction ===
161 // =========================================================================
162
163 // ----- STS Cluster Finder --------------------------------------------
164 FairTask* stsClusterFinder = new CbmStsClusterFinder("STS Cluster Finder", iVerbose);
165 run->AddTask(stsClusterFinder);
166 // -------------------------------------------------------------------------
167
168 // ----- STS hit finder ------------------------------------------------
169 FairTask* stsFindHits = new CbmStsFindHits("STS Hit Finder", iVerbose);
170 run->AddTask(stsFindHits);
171 // -------------------------------------------------------------------------
172
173 // ----- STS hit matching -----------------------------------------------
174 FairTask* stsMatchHits = new CbmStsMatchHits("STS Hit Matcher", iVerbose);
175 run->AddTask(stsMatchHits);
176 // -------------------------------------------------------------------------
177
178 // --- STS track finding ------------------------------------------------
179 CbmKF* kalman = new CbmKF();
180 run->AddTask(kalman);
181 CbmL1* l1 = new CbmL1();
182 l1->SetMaterialBudgetFileName(stsMatBudgetFile);
183 run->AddTask(l1);
184 CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder();
185 FairTask* stsFindTracks = new CbmStsFindTracks(iVerbose, stsTrackFinder);
186 run->AddTask(stsFindTracks);
187 // -------------------------------------------------------------------------
188
189 // --- STS track matching ----------------------------------------------
190 FairTask* stsMatchTracks = new CbmStsMatchTracks(iVerbose);
191 run->AddTask(stsMatchTracks);
192 // -------------------------------------------------------------------------
193
194 // --- STS track fitting -----------------------------------------------
195 /// CbmStsTrackFitter* stsTrackFitter = new CbmStsKFTrackFitter();
196 /// FairTask* stsFitTracks = new CbmStsFitTracks(stsTrackFitter, iVerbose);
197 /// run->AddTask(stsFitTracks);
198 // -------------------------------------------------------------------------
199
200 // === End of STS local reconstruction ===
201 // =========================================================================
202
203 // =========================================================================
204 // === Global tracking ===
205 // =========================================================================
206
207 /// CbmLitFindGlobalTracks* finder = new CbmLitFindGlobalTracks();
208 // Tracking method to be used
209 // "branch" - branching tracking
210 // "nn" - nearest neighbor tracking
211 // "weight" - weighting tracking
212 /// finder->SetTrackingType("branch");
213
214 // Hit-to-track merger method to be used
215 // "nearest_hit" - assigns nearest hit to the track
216 /// finder->SetMergerType("nearest_hit");
217
218 /// run->AddTask(finder);
219
220 // ----- Primary vertex finding ---------------------------------------
221 CbmPrimaryVertexFinder* pvFinder = new CbmPVFinderKF();
222 CbmFindPrimaryVertex* findVertex = new CbmFindPrimaryVertex(pvFinder);
223 run->AddTask(findVertex);
224 // ------------------------------------------------------------------------
225
226 // === End of global tracking ===
227 // =========================================================================
228
229 // ----------- TRD track Pid Like ----------------------
230 // Since in the newest version of this method depends on the global
231 // track the task has to move after the global tracking
232 // FU 08.02.12 Switch the task off since the input file needed for the new geometry has to be generated first.
233 // CbmTrdSetTracksPidLike* trdSetTracksPidLikeTask =
234 // new CbmTrdSetTracksPidLike("Likelihood", "Likelihood");
235 // run->AddTask(trdSetTracksPidLikeTask);
236 // ----------------------------------------------------
237
238 // ----- Parameter database --------------------------------------------
239 // TString stsDigi = gSystem->Getenv("VMCWORKDIR");
240 // stsDigi += "/parameters/sts/";
241 // stsDigi += stsDigiFile;
242 FairRuntimeDb* rtdb = run->GetRuntimeDb();
243 FairParRootFileIo* parIo1 = new FairParRootFileIo();
244 FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
245 parIo1->open(parFile.Data());
246 parIo2->open(parFileList, "in");
247 gSystem->Unlink(parIo2->getFilename()); // drop concatenated all_<pid>.par
248 rtdb->setFirstInput(parIo1);
249 rtdb->setSecondInput(parIo2);
250 rtdb->setOutput(parIo1);
251 rtdb->saveOutput();
252 // ------------------------------------------------------------------------
253
254 // ----- Intialise and run --------------------------------------------
255 run->Init();
256 cout << "Starting run" << endl;
257 run->Run(0, nEvents);
258 // ------------------------------------------------------------------------
259
260 // ----- Finish -------------------------------------------------------
261 timer.Stop();
262 Double_t rtime = timer.RealTime();
263 Double_t ctime = timer.CpuTime();
264 cout << endl << endl;
265 cout << "Macro finished succesfully." << endl;
266 cout << "Output file is " << outFile << endl;
267 cout << "Parameter file is " << parFile << endl;
268 cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
269 cout << endl;
270 // ------------------------------------------------------------------------
271
272 // delete run;
273
274 cout << " Test passed" << endl;
275 cout << " All ok " << endl;
276}
int Int_t
Int_t gDebug
double Double_t
#define gROOT
R__EXTERN TSystem * gSystem
BmnFileSource.h.
The CbmKF Kalman Filter algorithm.
Definition CbmKF.h:28
Definition CbmL1.h:48
void SetMaterialBudgetFileName(TString s)
Definition CbmL1.h:86
CbmPVFinderKF.
void SetBackNofElPerAdc(Double_t backMS=0.)
void SetBackNoiseWidth(Double_t backNoW=0.)
void SetFrontNofElPerAdc(Double_t frontMS=0.)
void SetFrontNoiseWidth(Double_t frontNoW=0.)
void SetStep(Double_t tStep)
void SetFrontThreshold(Double_t frontThr=0.)
virtual void SetRealisticResponse(Bool_t real=kTRUE)
void SetBackNofBits(Int_t backNB=0)
void SetBackThreshold(Double_t backThr=0.)
void SetFrontNofBits(Int_t frontNB=0)
void SetStripDeadTime(Double_t StripDeadTime=0.)
CbmStsFindTracks.
void Add(TObject *obj) override
Double_t RealTime()
void Start(Bool_t reset=kTRUE)
Double_t CpuTime()
void Stop()
const char * Data() const
void run_reco_gem(TString mcFile="mc.root", Int_t nEvents=10000)