FairRoot/PandaRoot
runLumiPixel1cDigiSigNoise.C
Go to the documentation of this file.
1 int runLumiPixel1cDigiSigNoise(const int nEvents=10, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const int pitch=1, const unsigned int seed = 0 )
2 {
3  // ----- Timer --------------------------------------------------------
4  TStopwatch timer;
5  timer.Start();
6  gRandom->SetSeed(seed);
7 
8 
9  // Input file (MC events)
10  TString inFile=storePath+"/Lumi_MC_";
11  inFile += startEvent;
12  inFile += ".root";
13  // Parameter file
14  TString parFile=storePath+"/Lumi_Params_";
15  parFile += startEvent;
16  parFile += ".root";
17  TString DigiFile = storePath+"/Lumi_digi_";
18  DigiFile += startEvent;
19  DigiFile += ".root";
20 
21  // Parameter file
22  TString digiparFile = "lumi.digi.par";
23 
24  // In general, the following parts need not be touched
25  // ========================================================================
26  // Output file
27  TString outFile = storePath+"/Lumi_digi_";//noise_";
28  outFile += startEvent;
29  outFile += ".root";
30  std::cout << "DigiFile: " << DigiFile.Data()<< std::endl;
31  std::cout << "RecoFile: " << outFile.Data()<< std::endl;
32 
33  // ----- Reconstruction run -------------------------------------------
34  FairRunAna *fRun= new FairRunAna();
35  fRun->SetInputFile(inFile);
36  fRun->SetOutputFile(outFile);
37  // fRun->SetEventMeanTime(50);//[ns] 50= interaction rate 20 MHz;
38  fRun->SetEventMeanTime(80);//[ns] 80= interaction rate 12.5 MHz;
39  // example: cross-section(DPM el+inlel, 1.5 GeV/c)= 125 mb, L=10^32 -> interaction rate 12.5 MHz
40  //fRun->SetEventMeanTime(2000);//[ns] 200= interaction rate 5 MHz; //15 GeV
41 
42 
43  // ----- Parameter database --------------------------------------------
44  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
45  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
46  parInput1->open(parFile.Data(),"UPDATE");
47  rtdb->setFirstInput(parInput1);
48 // Bool_t kParameterMerged=kTRUE;
49 // FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
50 // output->open(parOutFile);
51 // rtdb->setOutput(output);
52  FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
53  parInput2->open(digiparFile.Data(),"in");
54  rtdb->setSecondInput(parInput2);
55 
56  // fRun->LoadGeometry();
57 
58 
59  // ----- Digitization ---------------------------------------
60  // =========================================================================
61  // ====== Hit Producers ======
62  // =========================================================================
63  //noise hits
64  PndLmdNoiseProducer* lmdNoiseProd = new PndLmdNoiseProducer();
65  lmdNoiseProd->SetVerbose(verboseLevel);
66  fRun->AddTask(lmdNoiseProd);
67 
68  //signal hits
70  lmdStripProd->SetVerbose(verboseLevel);
71  fRun->AddTask(lmdStripProd);
72 
73  rtdb->setOutput(parInput1);
74  rtdb->print();
75  // ===== End of HitProducers =====
76  // =========================================================================
77  PndSdsGeoPar* geoPar = (PndSdsGeoPar*)(rtdb->getContainer("PndSdsGeoPar"));
78 
79  // ----- Intialise and run --------------------------------------------
80  fRun->Init();
81  fRun->Run(0,nEvents);
82 
83  rtdb->saveOutput();
84  rtdb->print();
85 
86  // ----- Finish -------------------------------------------------------
87  timer.Stop();
88  Double_t rtime = timer.RealTime();
89  Double_t ctime = timer.CpuTime();
90  cout << endl << endl;
91  cout << "Macro finished succesfully." << endl;
92  cout << "Output file is " << outFile << endl;
93  cout << "Parameter file is " << parFile << endl;
94  cout << "Real time " << rtime << " s, CPU time " << ctime << " s\a\a" << endl;
95  cout << endl;
96 
97  return 0;
98 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
PndMvdGeoPar * geoPar
TString outFile
Definition: hit_dirc.C:17
int runLumiPixel1cDigiSigNoise(const int nEvents=10, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const int pitch=1, const unsigned int seed=0)
Int_t startEvent
TString storePath
TString inFile
Definition: hit_dirc.C:8
FairRunAna * fRun
Definition: hit_dirc.C:58
TString DigiFile
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
unsigned int seed
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParAsciiFileIo * parInput2
Definition: conMvdDigi.C:26
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
Double_t rtime
Definition: hit_dirc.C:113
TString digiparFile