FairRoot/PandaRoot
Functions
gem_findTracks.C File Reference

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 4 of file gem_findTracks.C.

References allDigiFile, ctime, Double_t, fRun, hitFile, MCFile, nEvents, outFile, parFile, parInput1, parIo1, rtdb, rtime, PndGemTrackFinderOnHits::SetPrimary(), PndGemFindTracks::SetUseHitOrDigi(), PndGemTrackFinderOnHits::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 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  TString hitFile = baseName + "_hits.root";
21  // ------------------------------------------------------------------------
22  TString outFile = baseName + "_tracks.root";
23  std::cout << "Output File: " << outFile.Data()<< std::endl;
24 
25  // ----- Timer --------------------------------------------------------
26  TStopwatch timer;
27  timer.Start();
28 
29 
30  // ----- Reconstruction run -------------------------------------------
31  FairRunAna *fRun= new FairRunAna();
32  fRun->SetInputFile(hitFile);
33  fRun->AddFriend(MCFile);
34  fRun->AddFriend(digFile);
35  fRun->SetOutputFile(outFile);
36  fRun->SetUseFairLinks(kTRUE);
37 
38  // ----- Parameter database --------------------------------------------
39  //TString allDigiFile = sysFile+"/macro/params/gem_3Stations.digi.par";
40  TString allDigiFile = sysFile+"/macro/params/gem_3Stations_realistic_v1.digi.par";
41  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/gem_4Stations.digi.par";
42 
43  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
44  FairParRootFileIo* parInput1 = new FairParRootFileIo();
45  parInput1->open(parFile.Data());
46 
47  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
48  parIo1->open(allDigiFile.Data(),"in");
49 
50  rtdb->setFirstInput(parInput1);
51  rtdb->setSecondInput(parIo1);
52  // ------------------------------------------------------------------------
53 
54  //------ Track finder ------------------------------
55  //Create and add finder task
56  PndGemFindTracks* finderTask = new PndGemFindTracks("PndGemFindTracks");
57  finderTask->SetUseHitOrDigi("hit"); // hit = (default), digi
58  fRun->AddTask(finderTask);
59 
60  //------ Realistic Track finder --------------------
61  PndGemTrackFinderOnHits* mcTrackFinder = new PndGemTrackFinderOnHits();
62  mcTrackFinder->SetVerbose(verboseLevel); // verbosity level
63  mcTrackFinder->SetPrimary(0); // 1 = Only primary tracks are processed, 0 = all (default)
64  finderTask->UseFinder(mcTrackFinder);
65  //--------------------------------------------------
66 
67 
68  // ----- Intialise and run --------------------------------------------
69  fRun->Init();
70  fRun->Run(0,nEvents);
71 
72 
73  // ----- Finish -------------------------------------------------------
74  timer.Stop();
75  Double_t rtime = timer.RealTime();
76  Double_t ctime = timer.CpuTime();
77  cout << endl << endl;
78  cout << "Macro finished succesfully." << endl;
79  cout << "Output file is " << outFile << endl;
80  cout << "Parameter file is " << parFile << endl;
81  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
82  cout << endl;
83 
84  return 1;
85 }
void SetPrimary(const Int_t &primary)
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
OnHits track finding algorithm.
void UseFinder(PndGemTrackFinder *finder)
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
TString hitFile
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetVerbose(const Int_t &verbose)
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
TString MCFile
Task class for track finding in the Gem.
Double_t rtime
Definition: hit_dirc.C:113
void SetUseHitOrDigi(TString useHitOrDigi="hit")