FairRoot/PandaRoot
digi_theta.C
Go to the documentation of this file.
1 int digi_theta(Int_t pid = 13, Double_t theta = 5., 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_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
14 
15  // Parameter file
16  TString parFile = Form("params_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
17 
18  // Output file
19  TString outFile = Form("digi_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
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 
74  /*// ----- MDV strip digi producer --------------------------------
75  PndMvdStripHitProducer* mvdHitProd = new PndMvdStripHitProducer();
76  mvdHitProd->SetVerbose(iVerbose);
77  fRun->AddTask(mvdHitProd);
78  // ----- MDV hybrid digi producer -------------------------------
79  PndMvdHybridHitProducer* mvdPixProd = new PndMvdHybridHitProducer();
80  mvdPixProd->SetVerbose(iVerbose);
81  fRun->AddTask(mvdPixProd);
82  // ----- MVD strip cluster task ---------------------------------
83  Double_t chargecut = 5000.
84  PndMvdStripClusterTask* mvdmccls = new PndMvdStripClusterTask(chargecut, inFile);
85  mvdmccls->SetVerbose(iVerbose);
86  fRun->AddTask(mvdmccls);
87  // ----- MVD pixel cluster task ---------------------------------
88  PndMvdPixelClusterTask* mvdClusterizer = new PndMvdPixelClusterTask(1.8, inFile);
89  mvdClusterizer->SetVerbose(iVerbose);
90  fRun->AddTask(mvdClusterizer);*/
91 
92  // ################################################################## STT
94  //PndSttHitProducerRealFast* sttHitProducer = new PndSttHitProducerRealFast();
95  fRun->AddTask(sttHitProducer);
96 
97  // ################################################################## GEM
98  // ----- GEM digi producer --------------------------------------
99  Int_t verboseLevel = 0;
100  PndGemDigitize* gemDigitize = new PndGemDigitize("GEM Digitizer", verboseLevel);
101  fRun->AddTask(gemDigitize);
102  // ----- GEM hit producer ---------------------------------------
103  PndGemFindHits* gemFindHits = new PndGemFindHits("GEM Hit Finder", verboseLevel);
104  fRun->AddTask(gemFindHits);
105 
106  // ##################################################################
107 
108  // ----- Intialise and run --------------------------------------------
109  fRun->Init();
110  fRun->Run(0, nEvents);
111 
112  rtdb->saveOutput();
113  rtdb->print();
114  // ------------------------------------------------------------------------
115 
116  // ----- Finish -------------------------------------------------------
117  timer.Stop();
118  Double_t rtime = timer.RealTime();
119  Double_t ctime = timer.CpuTime();
120  cout << endl << endl;
121  cout << "Macro finished succesfully." << endl;
122  cout << "Output file is " << outFile << endl;
123  cout << "Parameter file is " << parFile << endl;
124  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
125  cout << endl;
126  // ------------------------------------------------------------------------
127 
128 
129  return 0;
130 }
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
TString inFile
Definition: hit_dirc.C:8
PndMvdStripClusterTask * mvdmccls
Definition: runclust.C:45
PndSttHitProducerRealFast * sttHitProducer
TString allDigiFile
Definition: hit_muo.C:36
FairRunAna * fRun
Definition: hit_dirc.C:58
TString sysFile
Double_t
TString parFile
Definition: hit_dirc.C:14
int digi_theta(Int_t pid=13, Double_t theta=5., Int_t nStations=3)
Definition: digi_theta.C:1
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
Int_t iVerbose
PndMvdDigiTask * mvddigi
Double_t rtime
Definition: hit_dirc.C:113