FairRoot/PandaRoot
digi_BARREL.C
Go to the documentation of this file.
1 int digi_BARREL(Int_t nEvents, Int_t nparts = 33, Int_t pid = 13, Int_t nStations = 3) {
2 
3  if ( nStations != 3 && nStations != 4 ) {
4  cout << "WRONG number of stations, only 3 or 4 allowed." << endl;
5  return;
6  }
7 
8  // ========================================================================
9  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
10  Int_t iVerbose = 0;
11 
12  // Input file (MC events)
13  TString inFile = Form("points_%dPart_n%d.root",nparts,nEvents);
14 
15  // Parameter file
16  TString parFile = Form("params_%dPart_n%d.root",nparts,nEvents);
17 
18  // Output file
19  TString outFile = Form("digi_%dPart_n%d_BTF.root",nparts,nEvents);
20 
21  // Number of events to process
22  Int_t nEvents = 0;
23 
24  // ---- Load libraries -------------------------------------------------
25  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
26  rootlogon();
27  TString sysFile = gSystem->Getenv("VMCWORKDIR");
28  // ------------------------------------------------------------------------
29 
30  // --- Now choose concrete engines for the different tasks -------------
31  // ------------------------------------------------------------------------
32 
33  // In general, the following parts need not be touched
34  // ========================================================================
35 
36  // ----- Timer --------------------------------------------------------
37  TStopwatch timer;
38  timer.Start();
39  // ------------------------------------------------------------------------
40 
41  // ----- Digitization run -------------------------------------------
42  FairRunAna *fRun= new FairRunAna();
43  fRun->SetInputFile(inFile);
44  fRun->SetOutputFile(outFile);
45 
46  // ------------------------------------------------------------------------
47 
48  // ----- Parameter database --------------------------------------------
49  TString allDigiFile = sysFile+"/macro/params/all.par";
50  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/all4.par";
51 
52  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
53  FairParRootFileIo* parInput1 = new FairParRootFileIo();
54  parInput1->open(parFile.Data());
55 
56  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
57  parIo1->open(allDigiFile.Data(),"in");
58 
59  rtdb->setFirstInput(parInput1);
60  rtdb->setSecondInput(parIo1);
61  // ------------------------------------------------------------------------
62 
63  // ################################################################## MVD
64  // ----- MDV digi producer ----------------------------------------
66  mvddigi->SetVerbose(iVerbose);
67  fRun->AddTask(mvddigi);
68  // ----- MDV cluster producer -----------------------------------
69  Double_t chargecut = 5000., pixelrad=1.8; // one day this will move to the parameter db.
71  mvdmccls->SetVerbose(iVerbose);
72  fRun->AddTask(mvdmccls);
73  // ----- MDV cluster producer -----------------------------------
74  // Double_t chargecut = 5000., pixelrad=1.8; // one day this will move to the parameter db.
75 // PndMvdClusterTask* mvdmccls = new PndMvdClusterTask();
76 // mvdmccls->SetVerbose(iVerbose);
77 // fRun->AddTask(mvdmccls);
78 
79  /*// ----- MDV strip digi producer --------------------------------
80  PndMvdStripHitProducer* mvdHitProd = new PndMvdStripHitProducer();
81  mvdHitProd->SetVerbose(iVerbose);
82  fRun->AddTask(mvdHitProd);
83  // ----- MDV hybrid digi producer -------------------------------
84  PndMvdHybridHitProducer* mvdPixProd = new PndMvdHybridHitProducer();
85  mvdPixProd->SetVerbose(iVerbose);
86  fRun->AddTask(mvdPixProd);
87  // ----- MVD strip cluster task ---------------------------------
88  Double_t chargecut = 5000.
89  PndMvdStripClusterTask* mvdmccls = new PndMvdStripClusterTask(chargecut, inFile);
90  mvdmccls->SetVerbose(iVerbose);
91  fRun->AddTask(mvdmccls);
92  // ----- MVD pixel cluster task ---------------------------------
93  PndMvdPixelClusterTask* mvdClusterizer = new PndMvdPixelClusterTask(1.8, inFile);
94  mvdClusterizer->SetVerbose(iVerbose);
95  fRun->AddTask(mvdClusterizer);*/
96 
97  // ################################################################## STT
99  //PndSttHitProducerRealFast* sttHitProducer = new PndSttHitProducerRealFast();
100  fRun->AddTask(sttHitProducer);
101 
102  // ################################################################## GEM
103  // ----- GEM digi producer --------------------------------------
104  Int_t verboseLevel = 0;
105  PndGemDigitize* gemDigitize = new PndGemDigitize("GEM Digitizer", verboseLevel);
106  fRun->AddTask(gemDigitize);
107  // ----- GEM hit producer ---------------------------------------
108  PndGemFindHits* gemFindHits = new PndGemFindHits("GEM Hit Finder", verboseLevel);
109  fRun->AddTask(gemFindHits);
110 
111  // ----- GEM Ideal Hit Producer ---------------------------------------
112  //PndGemIdealHitProducer* gemHitProducer = new PndGemIdealHitProducer("GEM Ideal hit producer", verboseLevel);
113  //fRun->AddTask(gemHitProducer);
114 
115  // ##################################################################
116 
117  PndBarrelTrackFinder* barrelTF = new PndBarrelTrackFinder();
118  barrelTF->SetVerbose(0);
119  barrelTF->UseMvdSttGem(kTRUE,kTRUE,kTRUE);
120  fRun->AddTask(barrelTF);
121 
122  PndBarrelTrackFinderQA* barrelQA = new PndBarrelTrackFinderQA();
123  barrelQA->SetVerbose(0);
124  barrelQA->UseMvdSttGem(kTRUE,kTRUE,kTRUE);
125  fRun->AddTask(barrelQA);
126 
127  // ##################################################################
128 
129  // ----- Intialise and run --------------------------------------------
130  fRun->Init();
131  fRun->Run(0,nEvents);
132 
133  rtdb->saveOutput();
134  rtdb->print();
135  // ------------------------------------------------------------------------
136 
137  // ----- Finish -------------------------------------------------------
138  timer.Stop();
139  Double_t rtime = timer.RealTime();
140  Double_t ctime = timer.CpuTime();
141  cout << endl << endl;
142  cout << "Macro finished succesfully." << endl;
143  cout << "Output file is " << outFile << endl;
144  cout << "Parameter file is " << parFile << endl;
145  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
146  cout << endl;
147  // ------------------------------------------------------------------------
148 
149 
150  return 0;
151 }
PndGemFindHits * gemFindHits
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
int pid()
Double_t chargecut
Definition: runclust.C:44
PndMvdStripClusterTask * mvdmccls
Definition: runclust.C:45
PndSttHitProducerRealFast * sttHitProducer
TString allDigiFile
Definition: hit_muo.C:36
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
TString sysFile
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
void SetVerbose(Int_t iVerbose)
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
PndGemDigitize * gemDigitize
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
void UseMvdSttGem(const Bool_t useMvd, const Bool_t useStt, const Bool_t useGem)
int digi_BARREL(Int_t nEvents, Int_t nparts=33, Int_t pid=13, Int_t nStations=3)
Definition: digi_BARREL.C:1
Int_t iVerbose
PndMvdDigiTask * mvddigi
Double_t rtime
Definition: hit_dirc.C:113