FairRoot/PandaRoot
Functions
TB_gem_eventBuild.C File Reference

Go to the source code of this file.

Functions

Int_t TB_gem_eventBuild (Int_t nEvents=1000, Int_t anaEv=1000, Int_t nofC=1000, Int_t cWid=10, Int_t nStations=3, int verboseLevel=0)
 

Function Documentation

Int_t TB_gem_eventBuild ( Int_t  nEvents = 1000,
Int_t  anaEv = 1000,
Int_t  nofC = 1000,
Int_t  cWid = 10,
Int_t  nStations = 3,
int  verboseLevel = 0 
)

Definition at line 4 of file TB_gem_eventBuild.C.

References allDigiFile, ctime, Double_t, fRun, PndEventBuilderManager::Init(), MCFile, nEvents, parFile, parInput1, parIo1, rtdb, rtime, sysFile, timer, trackFile, and TString.

5 {
6  if ( nStations != 3 && nStations != 4 ) {
7  cout << "WRONG number of stations (" << nStations << "), 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_MvdStt_%dStations_DPM_n%d_orig",nStations,nEvents);
16 
17  baseName.Form("Gem_MvdStt_%dStations_DPM_n%d",nStations,nEvents);
18 
19  TString MCFile = baseName + ".root";
20  TString parFile = baseName + "_par.root";
21  TString trackFile = baseName + Form("_CluHiTrack_a%d_c%dx%d.root",anaEv,nofC,cWid);
22  TString rEventFile = baseName + Form("_RecoEvents_a%d_c%dx%d.root",anaEv,nofC,cWid);
23 
24  std::cout << "Output File: " << rEventFile.Data()<< std::endl;
25 
26  // ----- Timer --------------------------------------------------------
27  TStopwatch timer;
28  timer.Start();
29 
30 
31  // ----- Reconstruction run -------------------------------------------
32  FairRunAna *fRun= new FairRunAna();
33  fRun->SetInputFile(trackFile);
34  fRun->SetOutputFile(rEventFile);
35 
36  // ----- Parameter database --------------------------------------------
37  TString allDigiFile = sysFile+"/macro/params/gem_3Stations.digi.par";
38  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/gem_4Stations.digi.par";
39 
40  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
41  FairParRootFileIo* parInput1 = new FairParRootFileIo();
42  parInput1->open(parFile.Data());
43 
44  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
45  parIo1->open(allDigiFile.Data(),"in");
46 
47  rtdb->setFirstInput(parInput1);
48  rtdb->setSecondInput(parIo1);
49  // ------------------------------------------------------------------------
50 
51  // ----- Event Builder -------------------------------------
52  PndEventBuilderManager* eventBuilder = new PndEventBuilderManager("Panda Event Builder", 0);//verboseLevel);
53  fRun->AddTask(eventBuilder);
54 
55  PndEventBuilderOnMCEvents* eBOnMCEvents = new PndEventBuilderOnMCEvents ("EBOnMCEvents",0);
56  eventBuilder->AddEventBuilder(eBOnMCEvents);
57  PndGemEventBuilderOnTracks* gemEBOnTracks = new PndGemEventBuilderOnTracks("GemEBOnTracks",0);
58  eventBuilder->AddEventBuilder(gemEBOnTracks);
59  // ------------------------------------------------------------------------
60 
61  // ----- Intialise and run --------------------------------------------
62  fRun->Init();
63  fRun->RunEventReco(0,nEvents);
64 
65 
66  // ----- Finish -------------------------------------------------------
67  timer.Stop();
68  Double_t rtime = timer.RealTime();
69  Double_t ctime = timer.CpuTime();
70  cout << endl << endl;
71  cout << "Macro finished succesfully." << endl;
72  cout << "Output file is " << rEventFile << endl;
73  cout << "Parameter file is " << parFile << endl;
74  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
75  cout << endl;
76 
77 }
TString trackFile
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