FairRoot/PandaRoot
Functions
pid_complete_runs.C File Reference

Go to the source code of this file.

Functions

void pid_complete_runs (Int_t nRun=0)
 

Function Documentation

void pid_complete_runs ( Int_t  nRun = 0)

Definition at line 1 of file pid_complete_runs.C.

References assDisc, assDrc, assEMC, assMC, assMdt, assMvd, assStt, corr, ctime, digiFile, Double_t, emcDigiFile, exit(), fRun, Geane, PndEmcMapper::Init(), iVerbose, mom, mult, nEvents, outFile, parFile, parInput1, parIo1, pid(), rtdb, rtime, PndPidCorrelator::SetBarrelTrackBranch(), PndPidCorrelator::SetForwardTrackBranch(), timer, and TString.

2 {
3  time_t rawtime;
4  struct tm * timeinfo;
5  time (&rawtime);
6  timeinfo = localtime (&rawtime);
7  std::cout << "Start = " << asctime(timeinfo) << std::endl;
8 
9  //-----User Settings:-----------------------------------------------
10  TString RunsListFile = "runs.txt";
11  std::ifstream runsFileInput(RunsListFile.Data());
12  char str[1000];
13  bool runexists = false;
14  int nrun, nrunmax = -1;
15  int pid, mult;
16  Float_t pmin, pmax;
17  Float_t tmin, tmax;
18  Float_t fmin, fmax;
19  Int_t nEvents;
20  std::string strg;
21  runsFileInput >> strg;
22  while(!runsFileInput.eof()) {
23  if (strg[0]!='#') {
24  sscanf(strg.c_str(),"%d",&nrun);
25  if (nrun==nRun) {
26  runexists = true;
27  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&pid);
28  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&nEvents);
29  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&mult);
30  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&pmin);
31  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&pmax);
32  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&tmin);
33  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&tmax);
34  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&fmin);
35  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&fmax);
36  }
37  else {
38  for(size_t iw=0;iw<9;iw++) runsFileInput >> strg;
39  }
40  nrunmax = nrun>nrunmax ? nrun : nrunmax;
41  }
42  runsFileInput >> strg;
43  }
44  runsFileInput.close();
45 
46  if (!runexists) {
47  std::cout << "Run number " << nRun << " is not defined!" << std::endl;
48  exit(0);
49  }
50 
51  std::cout << "run = " << nRun << " " << pid << " " << nEvents << " " << mult << " " << pmin << " "
52  << pmax << " " << tmin << " " << tmax << " " << fmin << " " << fmax << std::endl;
53 
54  Double_t mom = pmax;
55 
56  // Macro created 02/10/2012 by S.Spataro
57  // It loads a reconstruction file and compute PID informations
58 
59  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
60  Int_t iVerbose = 0; // just forget about it, for the moment
61 
62  // Number of events to process
63  Int_t nEvents = 0; // if 0 all the vents will be processed
64 
65  // Parameter file
66  //TString parFile = "simparams.root"; // at the moment you do not need it
67  TString parFile = Form("simparams_v%d_r%d.root",0,nRun);
68 
69  // Digitisation file (ascii)
70  TString digiFile = "all.par";
71 
72  // Output file
73  //TString outFile = "pid_complete.root";
74  TString outFile = Form("pid_complete_v%d_r%d.root",0,nRun);
75  TString sim_File = Form("sim_complete_v%d_r%d.root",0,nRun);
76  TString digi_File = Form("digi_complete_v%d_r%d.root",0,nRun);
77  TString reco_File = Form("reco_complete_v%d_r%d.root",0,nRun);
78 
79  // ----- Timer --------------------------------------------------------
80  TStopwatch timer;
81  // ------------------------------------------------------------------------
82 
83  // ----- Reconstruction run -------------------------------------------
84  FairRunAna *fRun= new FairRunAna();
85  //fRun->SetInputFile("sim_complete.root");
86  //fRun->AddFriend("digi_complete.root");
87  //fRun->AddFriend("reco_complete.root");
88  fRun->SetInputFile(sim_File);
89  fRun->AddFriend(digi_File);
90  fRun->AddFriend(reco_File);
91  fRun->SetOutputFile(outFile);
92  fRun->SetGenerateRunInfo(kFALSE);
93  fRun->SetUseFairLinks(kTRUE);
94  FairGeane *Geane = new FairGeane();
95  fRun->AddTask(Geane);
96 
97  // ----- Parameter database --------------------------------------------
98  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
99  emcDigiFile += "/macro/params/";
100  emcDigiFile += digiFile;
101 
102  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
103  FairParRootFileIo* parInput1 = new FairParRootFileIo();
104  parInput1->open(parFile.Data());
105 
106  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
107  parIo1->open(emcDigiFile.Data(),"in");
108 
109  rtdb->setFirstInput(parInput1);
110  rtdb->setSecondInput(parIo1);
111 
112  // ------------------------------------------------------------------------
113 
115  //corr->SetVerbose();
116  corr->SetBarrelTrackBranch("SttMvdGemGenTrack");
117  corr->SetInputIDBranch("SttMvdGemGenTrackID");
118  corr->SetForwardTrackBranch("FtsIdealGenTrack");
119  corr->SetInputIDBranch2("FtsIdealGenTrackID");
120  //corr->SetDebugMode(kTRUE);
121  //corr->SetFast(kTRUE);
122  //corr->SetBackPropagate(kFALSE);
123  //corr->SetIdeal(kTRUE);
124  fRun->AddTask(corr);
125 
126  PndPidBremCorrector *bremCorr = new PndPidBremCorrector();
127  fRun->AddTask(bremCorr);
128 
129  PndMcCloner *clone = new PndMcCloner();
130  fRun->AddTask(clone);
131 
133  fRun->AddTask(assMC);
134 
136  fRun->AddTask(assMvd);
137 
139  fRun->AddTask(assMdt);
140 
142  fRun->AddTask(assDrc);
143 
145  fRun->AddTask(assDisc);
146 
148  fRun->AddTask(assStt);
149 
151  fRun->AddTask(assEMC);
152 
154  fRun->AddTask(assRich);
155 
156  // ----- Intialise and run --------------------------------------------
158  cout << "fRun->Init()" << endl;
159  fRun->Init();
160 
161  timer.Start();
162  fRun->Run(0,nEvents);
163  // ------------------------------------------------------------------------
164 
165 
166  // ----- Finish -------------------------------------------------------
167  timer.Stop();
168  Double_t rtime = timer.RealTime();
169  Double_t ctime = timer.CpuTime();
170  cout << endl << endl;
171  cout << "Macro finished successfully." << endl;
172  cout << "Output file is " << outFile << endl;
173  cout << "Parameter file is " << parFile << endl;
174  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
175  cout << endl;
176  // ------------------------------------------------------------------------
177  cout << " Test passed" << endl;
178  cout << " All ok " << endl;
179  exit(0);
180 }
PndPidCorrelator * corr
exit(0)
TString outFile
Definition: hit_dirc.C:17
void SetBarrelTrackBranch(TString branch)
PndPidIdealAssociatorTask * assMC
PndPidMdtHCAssociatorTask * assMdt
int pid()
TString digiFile
Definition: bump_emc.C:20
PndPidDiscAssociatorTask * assDisc
Double_t mom
Definition: plot_dirc.C:14
PndPidMvdAssociatorTask * assMvd
TString emcDigiFile
Definition: bump_emc.C:45
PndPidEmcBayesAssociatorTask * assEMC
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
TString parFile
Definition: hit_dirc.C:14
PndPidSttAssociatorTask * assStt
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
static void Init(Int_t MapVersion)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
PndPidDrcAssociatorTask * assDrc
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
Int_t iVerbose
void SetForwardTrackBranch(TString branch)
Double_t rtime
Definition: hit_dirc.C:113
Double_t mult