FairRoot/PandaRoot
Functions
digi_dirc.C File Reference

Go to the source code of this file.

Functions

Int_t digi_dirc (Int_t nStations, Double_t momentum=15., Int_t nEvents=1000, int verboseLevel=0)
 

Function Documentation

Int_t digi_dirc ( Int_t  nStations,
Double_t  momentum = 15.,
Int_t  nEvents = 1000,
int  verboseLevel = 0 
)

Definition at line 12 of file digi_dirc.C.

References allDigiFile, ctime, Double_t, fRun, gemDigitize, MCFile, nEvents, outFile, parFile, parInput1, parIo1, rtdb, rtime, sysFile, timer, TString, and verboseLevel.

13 {
14  if ( nStations != 3 && nStations != 4 )
15  {
16  cout << "WRONG number of stations, only 3 or 4 allowed." << endl;
17  return;
18  }
19 
20  // ---- Load libraries -------------------------------------------------
21  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
22  TString sysFile = gSystem->Getenv("VMCWORKDIR");
23 
24  // Input file (MC events)
25  TString baseName;
26  baseName.Form("Gem_%dStations_%gGeV_n%d",nStations,momentum,nEvents);
27 
28  TString MCFile = baseName + ".root";
29  TString parFile = baseName + "_par.root";
30  TString outFile = baseName + "_digi.root";
31 
32  std::cout << "Output File: " << outFile.Data()<< std::endl;
33 
34  // ----- Timer --------------------------------------------------------
35  TStopwatch timer;
36  timer.Start();
37 
38 
39  // ----- Reconstruction run -------------------------------------------
40  FairRunAna *fRun= new FairRunAna();
41  fRun->SetInputFile(MCFile);
42  fRun->SetOutputFile(outFile);
43 
44 
45  // ----- Parameter database --------------------------------------------
46  TString allDigiFile = sysFile+"/macro/params/pid.par";
47 
48  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
49  FairParRootFileIo* parInput1 = new FairParRootFileIo();
50  parInput1->open(parFile.Data());
51 
52  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
53  parIo1->open(allDigiFile.Data(),"in");
54 
55  rtdb->setFirstInput(parInput1);
56  rtdb->setSecondInput(parIo1);
57  // ------------------------------------------------------------------------
58 
59  // ----- GEM Digitizer -----------------------------------------------
60  PndGemDigitize* gemDigitize = new PndGemDigitize("GEM Digitizer", verboseLevel);
61  fRun->AddTask(gemDigitize);
62 
63 
64  // ----- Intialise and run --------------------------------------------
65  fRun->Init();
66  fRun->Run(0,nEvents);
67 
68 
69  // ----- Finish -------------------------------------------------------
70  timer.Stop();
71  Double_t rtime = timer.RealTime();
72  Double_t ctime = timer.CpuTime();
73  cout << endl << endl;
74  cout << "Macro finished succesfully." << endl;
75  cout << "Output file is " << outFile << endl;
76  cout << "Parameter file is " << parFile << endl;
77  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
78  cout << endl;
79 
80 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
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_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
PndGemDigitize * gemDigitize
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
TString MCFile
Double_t rtime
Definition: hit_dirc.C:113