FairRoot/PandaRoot
Functions
gem_idealHits.C File Reference

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 4 of file gem_idealHits.C.

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

5 {
6  if ( nStations != 3 && nStations != 4 ) {
7  cout << "WRONG number of stations, only 3 or 4 allowed." << endl;
8  return;
9  }
10 
11  TString sysFile = gSystem->Getenv("VMCWORKDIR");
12 
13  // Input file (MC events)
14  TString baseName;
15  baseName.Form("Gem_%dStations_%gGeV_n%d",nStations,momentum,nEvents);
16 
17  TString MCFile = baseName + ".root";
18  TString parFile = baseName + "_par.root";
19  TString outFile = baseName + "_idealHits.root";
20 
21  std::cout << "Output File: " << outFile.Data()<< std::endl;
22 
23  // ----- Timer --------------------------------------------------------
24  TStopwatch timer;
25  timer.Start();
26 
27 
28  // ----- Reconstruction run -------------------------------------------
29  FairRunAna *fRun= new FairRunAna();
30  fRun->SetInputFile(MCFile);
31  fRun->SetOutputFile(outFile);
32 
33 
34  // ----- Parameter database --------------------------------------------
35  TString allDigiFile = sysFile+"/macro/params/gem_3Stations.digi.par";
36  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/gem_4Stations.digi.par";
37 
38  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
39  FairParRootFileIo* parInput1 = new FairParRootFileIo();
40  parInput1->open(parFile.Data());
41 
42  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
43  parIo1->open(allDigiFile.Data(),"in");
44 
45  rtdb->setFirstInput(parInput1);
46  rtdb->setSecondInput(parIo1);
47  // ------------------------------------------------------------------------
48 
49  // ----- GEM Ideal Hit Producer ---------------------------------------
50  PndGemIdealHitProducer* gemHitProducer = new PndGemIdealHitProducer("GEM Ideal hit producer", verboseLevel);
51  fRun->AddTask(gemHitProducer);
52 
53 
54  // ----- Intialise and run --------------------------------------------
55  fRun->Init();
56  fRun->Run(0,nEvents);
57 
58 
59  // ----- Finish -------------------------------------------------------
60  timer.Stop();
61  Double_t rtime = timer.RealTime();
62  Double_t ctime = timer.CpuTime();
63  cout << endl << endl;
64  cout << "Macro finished succesfully." << endl;
65  cout << "Output file is " << outFile << endl;
66  cout << "Parameter file is " << parFile << endl;
67  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
68  cout << endl;
69 
70 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
Class for conversion points to hits.
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
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
TString MCFile
Double_t rtime
Definition: hit_dirc.C:113