FairRoot/PandaRoot
Functions
gem_idealTracks.C File Reference

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 4 of file gem_idealTracks.C.

References allDigiFile, ctime, Double_t, fRun, Geane, hitFile, MCFile, nEvents, outFile, parFile, parInput1, parIo1, recoKalman, rtdb, rtime, PndGemTrackFinderIdeal::SetPrimary(), PndRecoKalmanTask::SetTrackInBranchName(), PndRecoKalmanTask::SetTrackOutBranchName(), PndGemFindTracks::SetUseHitOrDigi(), PndGemTrackFinderQA::SetVerbose(), PndGemTrackFinderIdeal::SetVerbose(), sysFile, timer, TString, PndGemFindTracks::UseFinder(), 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 hitFile = baseName + "_idealHits.root";
20  TString outFile = baseName + "_idealTracks.root";
21 
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(MCFile);
32  fRun->AddFriend(hitFile);
33  fRun->SetOutputFile(outFile);
34 
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  //------ Ideal Track finder --------------------
52  //Create and add finder task
53  PndGemFindTracks* finderTask = new PndGemFindTracks("PndGemFindTracks");
54  finderTask->SetUseHitOrDigi("hit"); // hit = (default), digi
55  fRun->AddTask(finderTask);
56 
57  PndGemTrackFinderIdeal* mcTrackFinder = new PndGemTrackFinderIdeal();
58  mcTrackFinder->SetVerbose(0); // verbosity level
59  mcTrackFinder->SetPrimary(0); // 1 = Only primary tracks are processed, 0 = all (default)
60  finderTask->UseFinder(mcTrackFinder);
61  //--------------------------------------------------
62 
63  //------ Track finder QA ---------------------------
64  PndGemTrackFinderQA* trackFinderQA = new PndGemTrackFinderQA();
65  trackFinderQA->SetVerbose(verboseLevel);
66  fRun->AddTask(trackFinderQA);
67  //--------------------------------------------------
68 
69  // ----- Prepare GEANE --------------------------------------------
70  // this will load Geant3 and execute setup macros to initialize geometry:
71  FairGeane *Geane = new FairGeane();
72  fRun->AddTask(Geane);
73  //--------------------------------------------------
74 
75  // ----- Run Kalman fitter --------------------------------------------
77  recoKalman->SetTrackInBranchName("GEMTrack");
78  recoKalman->SetTrackOutBranchName("GEMFitTrack");
79  //recoKalman->SetNumIterations(3);
80  fRun->AddTask(recoKalman);
81  // -------------------------------------------------
82 
83  // ----- Intialise and run --------------------------------------------
84  fRun->Init();
85  fRun->Run(0,nEvents);
86 
87 
88  // ----- Finish -------------------------------------------------------
89  timer.Stop();
90  Double_t rtime = timer.RealTime();
91  Double_t ctime = timer.CpuTime();
92  cout << endl << endl;
93  cout << "Macro finished succesfully." << endl;
94  cout << "Output file is " << outFile << endl;
95  cout << "Parameter file is " << parFile << endl;
96  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
97  cout << endl;
98 
99 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
void SetPrimary(const Int_t &primary)
void UseFinder(PndGemTrackFinder *finder)
TString allDigiFile
Definition: hit_muo.C:36
void SetTrackOutBranchName(const TString &name)
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
void SetVerbose(const Int_t &verbose)
void SetVerbose(const Int_t &verbose)
Ideal track finding algorithm.
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
TString hitFile
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
void SetTrackInBranchName(const TString &name)
TString MCFile
PndRecoKalmanTask * recoKalman
track finding quality assesment task
Task class for track finding in the Gem.
Double_t rtime
Definition: hit_dirc.C:113
void SetUseHitOrDigi(TString useHitOrDigi="hit")