FairRoot/PandaRoot
locT_theta.C
Go to the documentation of this file.
1 int locT_theta(Int_t pid = 13, Double_t theta = 5., Int_t nStations = 3) {
2 
3  if ( nStations != 3 && nStations != 4 ) {
4  cout << "WRONG number of stations, only 3 or 4 allowed." << endl;
5  return;
6  }
7 
8  // ========================================================================
9  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
10  Int_t iVerbose = 0;
11 
12  // Input file (MC events)
13  TString inDigiFile = Form("digi_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
14  TString inSimFile = Form("points_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
15 
16  // Parameter file
17  TString parFile = Form("params_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
18 
19  // Output file
20  TString outFile = Form("locT_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
21 
22  // Number of events to process
23  Int_t nEvents = 0;
24 
25  // ---- Load libraries -------------------------------------------------
26  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
27  rootlogon();
28  TString sysFile = gSystem->Getenv("VMCWORKDIR");
29  // ------------------------------------------------------------------------
30  // In general, the following parts need not be touched
31  // ========================================================================
32 
33  // ----- Timer --------------------------------------------------------
34  TStopwatch timer;
35  timer.Start();
36  // ------------------------------------------------------------------------
37 
38  // ----- Digitization run -------------------------------------------
39  FairRunAna *fRun= new FairRunAna();
40  fRun->SetInputFile(inDigiFile);
41  fRun->AddFriend(inSimFile);
42  fRun->SetOutputFile(outFile);
43  FairGeane *Geane = new FairGeane();
44  fRun->AddTask(Geane);
45  // ------------------------------------------------------------------------
46 
47  // ----- Parameter database --------------------------------------------
48  TString allDigiFile = sysFile+"/macro/params/all.par";
49  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/all4.par";
50 
51  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
52  FairParRootFileIo* parInput1 = new FairParRootFileIo();
53  parInput1->open(parFile.Data());
54 
55  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
56  parIo1->open(allDigiFile.Data(),"in");
57 
58  rtdb->setFirstInput(parInput1);
59  rtdb->setSecondInput(parIo1);
60  // ################################################################## MVD
61  // ----- MVD ideal tracking --------------------------------------------
63  mvdTrackFinder->SetVerbose(iVerbose);
64  fRun->AddTask(mvdTrackFinder);
65  // ################################################################## GEM
66  // trackfinding ....
68  PndSttFindTracks* sttFindTracks = new PndSttFindTracks("Track Finder", "FairTask", sttTrackFinder, iVerbose);
69  sttFindTracks->AddHitCollectionName("STTHit", "STTPoint");
70  fRun->AddTask(sttFindTracks);
71  /* // trackmatching ....
72  PndSttMatchTracks* sttTrackMatcher = new PndSttMatchTracks("Match tracks", "STT", iVerbose);
73  sttTrackMatcher->AddHitCollectionName("STTHit", "STTPoint");
74  fRun->AddTask(sttTrackMatcher);
75  // trackfitting ....
76  PndSttTrackFitter* sttTrackFitter = new PndSttHelixTrackFitter(0);
77  PndSttFitTracks* sttFitTracks = new PndSttFitTracks("STT Track Fitter", "FairTask", sttTrackFitter);
78  sttFitTracks->AddHitCollectionName("STTHit");
79  fRun->AddTask(sttFitTracks);*/
80  // helix hit production ....
81 // PndSttHelixHitProducer* sttHHProducer = new PndSttHelixHitProducer();
82 // fRun->AddTask(sttHHProducer);
83  // ################################################################## GEM
84  // ----- GEM ideal tracking --------------------------------------
85  PndGemFindTracks* gemFinderTask = new PndGemFindTracks("PndGemFindTracks");
86  gemFinderTask->SetUseHitOrDigi("hit"); // hit = (default), digi
87  fRun->AddTask(gemFinderTask);
88  // ------------------------------------------------------------------
89  PndGemTrackFinderIdeal* gemMcTrackFinder = new PndGemTrackFinderIdeal();
90  gemMcTrackFinder->SetVerbose(0); // verbosity level
91  gemMcTrackFinder->SetPrimary(0); // 1 = Only primary tracks are processed, 0 = all (default)
92  gemFinderTask->UseFinder(gemMcTrackFinder);
93  // ------------------------------------------------------------------
94  PndGemTrackFinderQA* gemTrackFinderQA = new PndGemTrackFinderQA();
95  gemTrackFinderQA->SetVerbose(0);
96  fRun->AddTask(gemTrackFinderQA);
97  // ##################################################################
98 
99  // ----- Intialise and run --------------------------------------------
100  fRun->Init();
101  fRun->Run(0, nEvents);
102 
103  rtdb->saveOutput();
104  rtdb->print();
105 
106  // ------------------------------------------------------------------------
107 
108  // ----- Finish -------------------------------------------------------
109 
110  timer.Stop();
111  Double_t rtime = timer.RealTime();
112  Double_t ctime = timer.CpuTime();
113  cout << endl << endl;
114  cout << "Macro finished succesfully." << endl;
115  cout << "Output file is " << outFile << endl;
116  cout << "Parameter file is " << parFile << endl;
117  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
118  cout << endl;
119  // ------------------------------------------------------------------------
120 
121 
122  return 0;
123 }
PndMvdRiemannTrackFinderTask * mvdTrackFinder
TString outFile
Definition: hit_dirc.C:17
void SetPrimary(const Int_t &primary)
int pid()
int locT_theta(Int_t pid=13, Double_t theta=5., Int_t nStations=3)
Definition: locT_theta.C:1
void UseFinder(PndGemTrackFinder *finder)
TString allDigiFile
Definition: hit_muo.C:36
PndSttTrackFinderReal * sttTrackFinder
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
TString inSimFile
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
PndSttFindTracks * sttFindTracks
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
TString inDigiFile
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
Int_t iVerbose
track finding quality assesment task
Task class for track finding in the Gem.
Double_t rtime
Definition: hit_dirc.C:113
void AddHitCollectionName(char *hitCollectionName, char *pointCollectionName)
void SetUseHitOrDigi(TString useHitOrDigi="hit")