FairRoot/PandaRoot
Functions
gem_hits.C File Reference

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 4 of file gem_hits.C.

References allDigiFile, ctime, Double_t, fRun, gemFindHits, 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 0;
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 parFile = baseName + "_par.root";
18  TString MCFile = baseName + ".root";
19  TString digFile = baseName + "_digi.root";
20  // ------------------------------------------------------------------------
21  TString outFile = baseName + "_hits.root";
22  std::cout << "Output File: " << outFile.Data()<< std::endl;
23 
24  // ----- Timer --------------------------------------------------------
25  TStopwatch timer;
26  timer.Start();
27 
28 
29  // ----- Reconstruction run -------------------------------------------
30  FairRunAna *fRun= new FairRunAna();
31  fRun->SetInputFile(digFile);
32  fRun->AddFriend(MCFile);
33  fRun->SetOutputFile(outFile);
34  fRun->SetUseFairLinks(kTRUE);
35 
36  // ----- Parameter database --------------------------------------------
37  //TString allDigiFile = sysFile+"/macro/params/gem_3Stations.digi.par";
38  TString allDigiFile = sysFile+"/macro/params/gem_3Stations_realistic_v1.digi.par";
39  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/gem_4Stations.digi.par";
40 
41  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
42  FairParRootFileIo* parInput1 = new FairParRootFileIo();
43  parInput1->open(parFile.Data());
44 
45  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
46  parIo1->open(allDigiFile.Data(),"in");
47 
48  rtdb->setFirstInput(parInput1);
49  rtdb->setSecondInput(parIo1);
50  // ------------------------------------------------------------------------
51 
52  // ----- GEM Hit Finder -----------------------------------------------
53  PndGemFindHits* gemFindHits = new PndGemFindHits("GEM Hit Finder", verboseLevel);
54  fRun->AddTask(gemFindHits);
55 
56 
57  // ----- Intialise and run --------------------------------------------
58  fRun->Init();
59  fRun->Run(0,nEvents);
60 
61 
62  // ----- Finish -------------------------------------------------------
63  timer.Stop();
64  Double_t rtime = timer.RealTime();
65  Double_t ctime = timer.CpuTime();
66  cout << endl << endl;
67  cout << "Macro finished succesfully." << endl;
68  cout << "Output file is " << outFile << endl;
69  cout << "Parameter file is " << parFile << endl;
70  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
71  cout << endl;
72 
73  return 1;
74 }
PndGemFindHits * gemFindHits
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
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
TString MCFile
Double_t rtime
Definition: hit_dirc.C:113