FairRoot/PandaRoot
Functions
digi_complete_runs.C File Reference

Go to the source code of this file.

Functions

void digi_complete_runs (Int_t nRun=0)
 

Function Documentation

void digi_complete_runs ( Int_t  nRun = 0)

Definition at line 3 of file digi_complete_runs.C.

References allDigiFile, ctime, digiFile, Double_t, drchit, emcHitsToWaveform, emcMakeBump, emcMakeCluster, emcWaveformToDigi, exit(), fRun, ftofhit, ftsHitProducer, gemDigitize, gemFindHits, inFile, iVerbose, mdtHitProd, mdtTrkProd, mom, mult, mvddigi, mvdmccls, nEvents, outFile, parFile, parInput1, parIo1, pid(), rtdb, rtime, PndRichHitProducer::SetPhDetNoiseON(), PndMdtHitProducerIdeal::SetPositionSmearing(), PndEmcHitsToWaveform::SetStorageOfData(), PndBlackBoxTask::SetVerbose(), sttHitProducer, timer, tofhit, TString, and verboseLevel.

4 {
5  //-----User Settings:-----------------------------------------------
6  TString RunsListFile = "runs.txt";
7  std::ifstream runsFileInput(RunsListFile.Data());
8  char str[1000];
9  bool runexists = false;
10  int nrun, nrunmax = -1;
11  int pid, mult;
12  Float_t pmin, pmax;
13  Float_t tmin, tmax;
14  Float_t fmin, fmax;
15  Int_t nEvents;
16  std::string strg;
17  runsFileInput >> strg;
18  while(!runsFileInput.eof()) {
19  if (strg[0]!='#') {
20  sscanf(strg.c_str(),"%d",&nrun);
21  if (nrun==nRun) {
22  runexists = true;
23  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&pid);
24  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&nEvents);
25  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&mult);
26  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&pmin);
27  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&pmax);
28  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&tmin);
29  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&tmax);
30  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&fmin);
31  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&fmax);
32  }
33  else {
34  for(size_t iw=0;iw<9;iw++) runsFileInput >> strg;
35  }
36  nrunmax = nrun>nrunmax ? nrun : nrunmax;
37  }
38  runsFileInput >> strg;
39  }
40  runsFileInput.close();
41 
42  if (!runexists) {
43  std::cout << "Run number " << nRun << " is not defined!" << std::endl;
44  exit(0);
45  }
46 
47  std::cout << "run = " << nRun << " " << pid << " " << nEvents << " " << mult << " " << pmin << " "
48  << pmax << " " << tmin << " " << tmax << " " << fmin << " " << fmax << std::endl;
49 
50  Double_t mom = pmax;
51 
52  //------------------------------------------------------------------
53  // Macro created 20/09/2006 by S.Spataro
54  // It loads a simulation file and digitize hits
55 
56  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
57  Int_t iVerbose = 0; // just forget about it, for the moment
58 
59  // Input file (MC events)
60  //TString inFile = "sim_complete.root";
61  TString inFile = Form("sim_complete_v%d_r%d.root",0,nRun);
62 
63  // Parameter file
64  //TString parFile = "simparams.root"; // at the moment you do not need it
65  TString parFile = Form("simparams_v%d_r%d.root",0,nRun);
66 
67  // Digitisation file (ascii)
68  TString digiFile = "all.par";
69 
70  // Output file
71  //TString outFile = "digi_complete.root";
72  TString outFile = Form("digi_complete_v%d_r%d.root",0,nRun);
73 
74  // ----- Timer --------------------------------------------------------
75  TStopwatch timer;
76 
77  // ----- Reconstruction run -------------------------------------------
78  FairRunAna *fRun= new FairRunAna();
79  fRun->SetInputFile(inFile);
80  fRun->SetOutputFile(outFile);
81  fRun->SetGenerateRunInfo(kFALSE);
82  fRun->SetUseFairLinks(kTRUE);
83  // ----- Parameter database --------------------------------------------
84  TString allDigiFile = gSystem->Getenv("VMCWORKDIR");
85  allDigiFile += "/macro/params/";
86  allDigiFile += digiFile;
87 
88  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
89  FairParRootFileIo* parInput1 = new FairParRootFileIo();
90  parInput1->open(parFile.Data());
91 
92  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
93  parIo1->open(allDigiFile.Data(),"in");
94 
95  rtdb->setFirstInput(parInput1);
96  rtdb->setSecondInput(parIo1);
97 
98  // ----- STT digi producers ---------------------------------
100  fRun->AddTask(sttHitProducer);
101 
102  // ----- MDV digi producers ---------------------------------
104  mvddigi->SetVerbose(iVerbose);
105  fRun->AddTask(mvddigi);
106 
108  mvdmccls->SetVerbose(iVerbose);
109  fRun->AddTask(mvdmccls);
110 
111  // ----- EMC hit producers ---------------------------------
114  emcHitsToWaveform->SetStorageOfData(kFALSE);
115  //emcWaveformToDigi->SetStorageOfData(kFALSE);
116  fRun->AddTask(emcHitsToWaveform); // full digitization
117  fRun->AddTask(emcWaveformToDigi); // full digitization
118 
120  fRun->AddTask(emcMakeCluster);
121 
123  fRun->AddTask(emcMakeBump);
124 
125  //PndEmcHdrFiller* emcHdrFiller = new PndEmcHdrFiller();
126  //fRun->AddTask(emcHdrFiller); // ECM header
127 
128  // ----- SciT hit producers ---------------------------
130  tofhit->SetVerbose(iVerbose);
131  fRun->AddTask(tofhit);
132 
133  // ----- MDT hit producers ---------------------------------
135  mdtHitProd->SetPositionSmearing(.3); // position smearing [cm]
136  fRun->AddTask(mdtHitProd);
137 
139  fRun->AddTask(mdtTrkProd);
140 
141  // ----- DRC hit producers ---------------------------------
143  drchit->SetVerbose(iVerbose);
144  fRun->AddTask(drchit);
145 
146  // ----- GEM hit producers ---------------------------------
147  Int_t verboseLevel = 0;
148  PndGemDigitize* gemDigitize = new PndGemDigitize("GEM Digitizer", verboseLevel);
149  fRun->AddTask(gemDigitize);
150 
151  PndGemFindHits* gemFindHits = new PndGemFindHits("GEM Hit Finder", verboseLevel);
152  fRun->AddTask(gemFindHits);
153 
154  // ----- FTS hit producers ---------------------------------
156  fRun->AddTask(ftsHitProducer);
157 
158  // ----- Ftof hit producers ---------------------------
160  ftofhit->SetVerbose(iVerbose);
161  fRun->AddTask(ftofhit);
162 
163  // ----- RICH hit producers ---------------------------------
164  PndRichHitProducer* richhit = new PndRichHitProducer();
165  richhit->SetVerbose(iVerbose);
166  richhit->SetPhDetNoiseON(kTRUE);
167  fRun->AddTask(richhit);
168 
169  // ----- Intialise and run --------------------------------------------
170  fRun->Init();
171 
172  timer.Start();
173  fRun->Run();
174 
175  // ----- Finish -------------------------------------------------------
176  timer.Stop();
177  Double_t rtime = timer.RealTime();
178  Double_t ctime = timer.CpuTime();
179  cout << endl << endl;
180  cout << "Macro finished successfully." << endl;
181  cout << "Output file is " << outFile << endl;
182  cout << "Parameter file is " << parFile << endl;
183  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
184  cout << endl;
185  // ------------------------------------------------------------------------
186  cout << " Test passed" << endl;
187  cout << " All ok " << endl;
188 
189  exit(0);
190 }
Takes list of PndEmcHits and creates PndEmcWaveform.
PndGemFindHits * gemFindHits
int verboseLevel
Definition: Lars/runMvdSim.C:7
PndEmcHitsToWaveform * emcHitsToWaveform
Definition: full_emc.C:60
exit(0)
TString outFile
Definition: hit_dirc.C:17
int pid()
TString digiFile
Definition: bump_emc.C:20
Double_t mom
Definition: plot_dirc.C:14
PndEmcMakeBump * emcMakeBump
Definition: bump_emc.C:63
void SetPhDetNoiseON(UInt_t phDetNoise)
PndMvdStripClusterTask * mvdmccls
Definition: runclust.C:45
PndSttHitProducerRealFast * sttHitProducer
TString allDigiFile
Definition: hit_muo.C:36
PndFtofHitProducerIdeal * tofhit
Definition: hit_ftof.C:68
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
void SetStorageOfData(Bool_t val)
PndMdtHitProducerIdeal * mdtHitProd
Definition: hit_muo.C:162
PndDrcHitProducerReal * drchit
Definition: hit_dirc_draw.C:73
Double_t
TString parFile
Definition: hit_dirc.C:14
PndEmcMakeCluster * emcMakeCluster
Definition: full_emc.C:65
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
Takes clusters and slits them up into bumps.
void SetVerbose(Int_t iVerbose)
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
PndFtofHitProducerIdeal * ftofhit
Double_t ctime
Definition: hit_dirc.C:114
PndGemDigitize * gemDigitize
PndEmcWaveformToDigi * emcWaveformToDigi
Definition: full_emc.C:61
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
Task to cluster PndEmcDigis.
Int_t iVerbose
PndMdtTrkProducer * mdtTrkProd
Definition: hit_muo.C:166
Takes list of PndEmcWaveform and creates PndEmcDigi.
PndMvdDigiTask * mvddigi
PndFtsHitProducerRealFast * ftsHitProducer
Double_t rtime
Definition: hit_dirc.C:113
void SetPositionSmearing(Float_t res)
Set the smearing of the PndMdtHit position.
Double_t mult