FairRoot/PandaRoot
gem_boxHitsQAN.C
Go to the documentation of this file.
1 Int_t gem_boxHitsQAN(Int_t nStations, Int_t nparts, Int_t nEvents = 1000, Double_t pointEffDist = 0.1, Int_t pdgC = 211, int verboseLevel = 0)
2 {
3  if ( nStations != 3 && nStations != 4 ) {
4  cout << "WRONG number of stations, only 3 or 4 allowed." << endl;
5  return;
6  }
7 
8  TString sysFile = gSystem->Getenv("VMCWORKDIR");
9 
10  // Input file (MC events)
11  TString baseName;
12  baseName.Form("Gem_%dStations_%d_%dpart_n%d",nStations,pdgC,nparts,nEvents);
13 
14  TString MCFile = baseName + ".root";
15  TString parFile = baseName + "_par.root";
16  TString hitFile = baseName + "_hits.root";
17  TString outFile = baseName + Form("_QAhits_e%.1f.root",pointEffDist);
18 
19  // ----- Timer --------------------------------------------------------
20  TStopwatch timer;
21  timer.Start();
22 
23  // ----- Reconstruction run -------------------------------------------
24  FairRunAna *fRun= new FairRunAna();
25  fRun->SetInputFile(MCFile);
26  fRun->AddFriend(hitFile);
27  fRun->SetOutputFile(outFile);
28 
29  // ----- Parameter database --------------------------------------------
30  TString allDigiFile = sysFile+"/macro/params/gem_3Stations.digi.par";
31  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/gem_4Stations.digi.par";
32 
33  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
34  FairParRootFileIo* parInput1 = new FairParRootFileIo();
35  parInput1->open(parFile.Data());
36 
37  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
38  parIo1->open(allDigiFile.Data(),"in");
39 
40  rtdb->setFirstInput(parInput1);
41  rtdb->setSecondInput(parIo1);
42  // ------------------------------------------------------------------------
43 
44  // ----- Digitizer and Hit Finder -------------------------------------
45 
46  PndGemFindHitsQA* gemFindHitsQA = new PndGemFindHitsQA(verboseLevel);
47  gemFindHitsQA->SetPointEffDist(pointEffDist);
48  fRun->AddTask(gemFindHitsQA);
49 
50  // ----- Ideal Hit Producer ---------------------------------------
51 // PndGemIdealHitProducer* gemHitProducer = new PndGemIdealHitProducer("GEM Ideal hit producer", verboseLevel);
52 // fRun->AddTask(gemHitProducer);
53 
54 /*
55  //------ Track finder ------------------------------
56  //Create and add finder task
57  PndGemFindTracks* finderTask = new PndGemFindTracks("PndGemFindTracks");
58  finderTask->SetUseHitOrDigi("hit"); // hit = (default), digi
59  fRun->AddTask(finderTask);
60 
61  //------ Ideal Track finder ------------------------
62 // PndGemTrackFinderIdeal* mcTrackFinder = new PndGemTrackFinderIdeal();
63 // mcTrackFinder->SetVerbose(verboseLevel); // verbosity level
64 // mcTrackFinder->SetPrimary(0); // 1 = Only primary tracks are processed, 0 = all (default)
65 // finderTask->UseFinder(mcTrackFinder);
66 
67  //------ Realistic Track finder --------------------
68  PndGemTrackFinderOnHits* mcTrackFinder = new PndGemTrackFinderOnHits();
69  mcTrackFinder->SetVerbose(verboseLevel); // verbosity level
70  mcTrackFinder->SetPrimary(0); // 1 = Only primary tracks are processed, 0 = all (default)
71  finderTask->UseFinder(mcTrackFinder);
72  //--------------------------------------------------
73 
74  // ----- Prepare GEANE --------------------------------------------
75  // this will load Geant3 and execute setup macros to initialize geometry:
76  FairGeane *Geane = new FairGeane();
77  fRun->AddTask(Geane);
78  //--------------------------------------------------
79 
80  // ----- Run Kalman fitter --------------------------------------------
81  PndRecoKalmanTask* recoKalman = new PndRecoKalmanTask();
82  recoKalman->SetTrackInBranchName("GEMTrack");
83  recoKalman->SetTrackOutBranchName("GEMFitTrack");
84  //recoKalman->SetNumIterations(3);
85  fRun->AddTask(recoKalman);
86  // -------------------------------------------------
87 
88  PndGemTrackFinderQA* trackFinderQA = new PndGemTrackFinderQA();
89  trackFinderQA->SetVerbose(verboseLevel);
90  fRun->AddTask(trackFinderQA);
91 */
92 
93  // ----- Intialise and run --------------------------------------------
94  fRun->Init();
95  fRun->Run(0,nEvents);
96  // fRun->Run(858,859);
97 
98  // ----- Finish -------------------------------------------------------
99  timer.Stop();
100  Double_t rtime = timer.RealTime();
101  Double_t ctime = timer.CpuTime();
102  cout << endl << endl;
103  cout << "Macro finished succesfully." << endl;
104  cout << "Output file is " << outFile << endl;
105  cout << "Parameter file is " << parFile << endl;
106  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
107  cout << endl;
108 
109 }
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
TString hitFile
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetPointEffDist(Double_t dn)
track finding quality assesment task
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
TString MCFile
Int_t gem_boxHitsQAN(Int_t nStations, Int_t nparts, Int_t nEvents=1000, Double_t pointEffDist=0.1, Int_t pdgC=211, int verboseLevel=0)
Definition: gem_boxHitsQAN.C:1
Double_t rtime
Definition: hit_dirc.C:113