BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
run_reco_zdc.C
Go to the documentation of this file.
1// --------------------------------------------------------------------------
2//
3// Macro for reconstruction of simulated events with standard settings
4//
5// --------------------------------------------------------------------------
6#include <TGDMLParse.h>
7
8void run_reco_zdc(TString mcFile = "evetest.root", Int_t nEvents = 1)
9{
10
11 // ========================================================================
12 // Adjust this part according to your requirements
13
14 // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
15 Int_t iVerbose = 1;
16 // Int_t iVerbose = 3;
17
18 // Input file (MC events)
19 // TString inFile = "data/AuAu_urqmd_3.3p1_4.0_gev__10000_ev__centr__seed_1_fscale88.mc.root";
20 // TString inFile = "mc.root";
21
22 // Parameter file
23 // TString parFile = "data/AuAu_urqmd_3.3p1_4.0_gev__10000_ev__mbias__seed_0_params.root";
24 TString dir = "./"; // Output directory
25 TString inFile = dir + mcFile; // MC transport file
26 TString scriptFile = TString(gSystem->Getenv("MCFILE"));
27 if (scriptFile != "")
28 inFile = dir + scriptFile;
29 TString parFile = inFile;
30
31 // Output file
32 TString outFile = "reco_zdc.root";
33 TString recoFile = TString(gSystem->Getenv("RECOFILE"));
34 if (recoFile != "")
35 outFile = dir + recoFile;
36
37 // Digitisation files.
38 // Add TObjectString containing the different file names to
39 // a TList which is passed as input to the FairParAsciiFileIo.
40 // The FairParAsciiFileIo will take care to create on the fly
41 // a concatenated input parameter file which is then used during
42 // the reconstruction.
43 TList* parFileList = new TList();
44
45 TString paramDir = gSystem->Getenv("VMCWORKDIR");
46 paramDir += "/parameters";
47
48 // TObjString stsDigiFile = paramDir + "/sts/sts_v12b_12344444_std.digi.par";
49 TObjString stsDigiFile = paramDir + "/sts_v17a_gem.digi.par";
50 // TObjString stsDigiFile = paramDir + "/sts_v15a90_gem.digi.par";
51 // TObjString stsDigiFile = paramDir + "/sts_1st_30.digi.par";
52 // TObjString stsDigiFile = paramDir + "/sts_var.digi.par";
53 TString stsMatBudgetFile = ""; // paramDir + "/sts/sts_matbudget_v12b_12344444.root";
54 // TString stsMatBudgetFile = paramDir + "/sts_matbudget_var_fr.root";
55 parFileList->Add(&stsDigiFile);
56
57 // In general, the following parts need not be touched
58 // ========================================================================
59
60 // ---- Debug option -------------------------------------------------
61 gDebug = 0;
62 // ------------------------------------------------------------------------
63
64 // ----- Timer --------------------------------------------------------
65 TStopwatch timer;
66 timer.Start();
67 // ------------------------------------------------------------------------
68
69 // ---- Load libraries -------------------------------------------------
70 // gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
71 // basiclibs();
72 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
73 bmnloadlibs(); // load bmn libraries
74 // ------------------------------------------------------------------------
75
76 // ----- Reconstruction run -------------------------------------------
77 FairRunAna* run = new FairRunAna();
78 run->SetInputFile(inFile);
79 run->SetOutputFile(outFile);
80 // ------------------------------------------------------------------------
81
82 // =========================================================================
83 // === Detector Response Simulation (Digitiser) ===
84 // === (where available) ===
85 // =========================================================================
86
87 // -------------------------------------------------------------------------
88
89 // =========================================================================
90 // === ZDC ===
91 // =========================================================================
92
93 // ----- ZDC Digi Producer --------------------------------------------
94 FairTask* zdcDigiProducer = new BmnZdcDigiProducer("ZDC Digi Producer");
95 run->AddTask(zdcDigiProducer);
96 // -------------------------------------------------------------------------
97
98 // ----- Parameter database --------------------------------------------
99 FairRuntimeDb* rtdb = run->GetRuntimeDb();
100 FairParRootFileIo* parIo1 = new FairParRootFileIo();
101 FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
102 parIo1->open(parFile.Data());
103 parIo2->open(parFileList, "in");
104 gSystem->Unlink(parIo2->getFilename()); // drop concatenated all_<pid>.par
105 rtdb->setFirstInput(parIo1);
106 rtdb->setSecondInput(parIo2);
107 rtdb->setOutput(parIo1);
108 rtdb->saveOutput();
109 // ------------------------------------------------------------------------
110
111 // ----- Intialise and run --------------------------------------------
112 run->Init();
113 cout << "Starting run" << endl;
114 run->Run(0, nEvents);
115 // ------------------------------------------------------------------------
116
117 // ----- Finish -------------------------------------------------------
118 timer.Stop();
119 Double_t rtime = timer.RealTime();
120 Double_t ctime = timer.CpuTime();
121 cout << endl << endl;
122 cout << "Macro finished succesfully." << endl;
123 cout << "Output file is " << outFile << endl;
124 cout << "Parameter file is " << parFile << endl;
125 cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
126 cout << endl;
127 // ------------------------------------------------------------------------
128
129 // delete run;
130
131 cout << " Test passed" << endl;
132 cout << " All ok " << endl;
133}
int Int_t
Int_t gDebug
double Double_t
#define gROOT
R__EXTERN TSystem * gSystem
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_zdc(TString mcFile="evetest.root", Int_t nEvents=1)
Definition run_reco_zdc.C:8