FairRoot/PandaRoot
runLumi1FastDigi.C
Go to the documentation of this file.
1 int runLumi1FastDigi(const int nEvents=100000, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const double pitch=0.005)
2 {
3  // ----- Timer --------------------------------------------------------
4  TStopwatch timer;
5  timer.Start();
6 
7  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
8  gSystem->Load("libSds");
9  gSystem->Load("libSdsReco");
10  gSystem->Load("libLmd");
11  gSystem->Load("libLmdReco");
12  gSystem->Load("libLmdTrk");
13 
14  // Input file (MC events)
15  TString inFile=storePath+"/Lumi_MC_";
16  inFile += startEvent;
17  inFile += ".root";
18  // Parameter file
19  TString parFile=storePath+"/Lumi_Params_";
20  parFile += startEvent;
21  parFile += ".root";
22 
23  // Parameter file
24  //TString digiparFile = "lumi.digi.par";
25  //TString digiparFile = "noMClumi.digi.par";
26  // TString digiparFile = "lumi";
27  // switch(pitch){
28  // case 0:{
29  // digiparFile += "50";
30  // break;}
31  // }
32 
33  // digiparFile += ".digi.par";
34 
35  // cout<<"digiparFile = "<<digiparFile<<endl;
36  // In general, the following parts need not be touched
37  // ========================================================================
38  // Output file
39  TString outFile = storePath+"/Lumi_reco_";
40  outFile += startEvent;
41  outFile += ".root";
42  std::cout << "DigiFileName: " << outFile.Data() << std::endl;
43 
44  // ----- Reconstruction run -------------------------------------------
45  FairRunAna *fRun= new FairRunAna();
46  fRun->SetInputFile(inFile);
47  fRun->SetOutputFile(outFile);
48 
49 
50  // ----- Parameter database --------------------------------------------
51  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
52  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
53  parInput1->open(parFile.Data(),"UPDATE");
54  rtdb->setFirstInput(parInput1);
55 // Bool_t kParameterMerged=kTRUE;
56 // FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
57 // output->open(parOutFile);
58 // rtdb->setOutput(output);
59  // FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
60  // parInput2->open(digiparFile.Data(),"in");
61  // rtdb->setSecondInput(parInput2);
62 
63  // fRun->LoadGeometry();
64 
65 
66  // ----- Digitization ---------------------------------------
67 // PndMvdDigiTask* mvddigi = new PndMvdDigiTask();
68 // mvddigi->SetVerbose(verboseLevel);
69 // fRun->AddTask(mvddigi);
70  // =========================================================================
71  // ====== Hit Producers ======
72  // =========================================================================
73 
74  // ----- MVD Strip hit producer ---------------------------------------
75 // double topPitch=0.015,
76 // botPitch=0.015,
77 // orient=TMath::Pi()*(0.5),
78 // skew=TMath::Pi()*(0.5);
79 // TVector2 topAnchor(0.,0.);
80 // TVector2 botAnchor(0.,0.);
81 // int topFE = 10,
82 // botFE = 4,
83 // nrFEChannels = 128;
84 // double threshold=3000., noise=1000.;
85 // PndMvdStripHitProducer* mvdStripProd
86 // = new PndMvdStripHitProducer(topPitch, botPitch,
87 // orient, skew,
88 // topAnchor,botAnchor,
89 // topFE, botFE, nrFEChannels,
90 // threshold, noise);
91 
92  //PndLmdStripHitProducer* lmdStripProd = new PndLmdStripHitProducer();
93  // PndLmdStripHitProducerDif* ssdStripProd = new PndLmdStripHitProducerDif(); //TEST
94  //lmdStripProd->SetVerbose(verboseLevel);
95  //fRun->AddTask(lmdStripProd);
96  // ----- MVD Pixel hit producer ---------------------------------------
97 // Double_t lx=0.01, ly=0.01, threshold=600, noise=200;
98  //PndLmdHybridHitProducer* mvdPixProd = new PndLmdHybridHitProducer(lx,ly,threshold,noise);
99  PndLmdPixelHitProducerFast* ssdHitProd = new PndLmdPixelHitProducerFast(pitch,pitch);
100  ssdHitProd->SetVerbose(verboseLevel);
101  fRun->AddTask(ssdHitProd);
102 
103  // PndLmdNoiseProducer* lmdNoiseMaker = new PndLmdNoiseProducer();
104  // lmdNoiseMaker->SetVerbose(verboseLevel);
105  // fRun->AddTask(lmdNoiseMaker);
106  //PndLmdHitProducerIdeal* lmdStripProd = new PndLmdHitProducerIdeal();
107 
108 
109 // FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
110 // output->open(parOutFile.Data());
111 // rtdb->setOutput(output);
112  rtdb->setOutput(parInput1);
113  rtdb->print();
114  // ===== End of HitProducers =====
115  // =========================================================================
116  PndSdsGeoPar* geoPar = (PndSdsGeoPar*)(rtdb->getContainer("PndSdsGeoPar"));
117 
118  // ----- Intialise and run --------------------------------------------
119  fRun->Init();
120  fRun->Run(0,nEvents);
121  rtdb->saveOutput();
122  rtdb->print();
123 
124  // ----- Finish -------------------------------------------------------
125  timer.Stop();
126  Double_t rtime = timer.RealTime();
127  Double_t ctime = timer.CpuTime();
128  cout << endl << endl;
129  cout << "Macro finished succesfully." << endl;
130  cout << "Output file is " << outFile << endl;
131  cout << "Parameter file is " << parFile << endl;
132  cout << "Real time " << rtime << " s, CPU time " << ctime << " s\a\a" << endl;
133  cout << endl;
134 
135  return 0;
136 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
PndMvdGeoPar * geoPar
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
int runLumi1FastDigi(const int nEvents=100000, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const double pitch=0.005)
Double_t rtime
Definition: hit_dirc.C:113