FairRoot/PandaRoot
gem_findTracksQA.C
Go to the documentation of this file.
1 // Macro created by Radoslaw Karabowicz
2 // This macro takes the digis and find hits
3 
4 Int_t gem_findTracksQA(Int_t nStations, Double_t momentum = 15., Int_t nEvents = 1000, int verboseLevel = 0)
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  TString trkFile = baseName + "_tracks.root";
22  TString trkfitFile = baseName + "_fitTracks.root";
23  // ------------------------------------------------------------------------
24  TString outFile = baseName + "_tracksQA.root";
25  std::cout << "Output File: " << outFile.Data()<< std::endl;
26 
27  // ----- Timer --------------------------------------------------------
28  TStopwatch timer;
29  timer.Start();
30 
31 
32  // ----- Reconstruction run -------------------------------------------
33  FairRunAna *fRun= new FairRunAna();
34  fRun->SetInputFile(trkfitFile);
35  fRun->AddFriend(MCFile);
36  fRun->AddFriend(digFile);
37  fRun->AddFriend(hitFile);
38  fRun->AddFriend(trkFile);
39  fRun->SetOutputFile(outFile);
40  fRun->SetUseFairLinks(kTRUE);
41 
42  // ----- Parameter database --------------------------------------------
43  //TString allDigiFile = sysFile+"/macro/params/gem_3Stations.digi.par";
44  TString allDigiFile = sysFile+"/macro/params/gem_3Stations_realistic_v1.digi.par";
45  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/gem_4Stations.digi.par";
46 
47  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
48  FairParRootFileIo* parInput1 = new FairParRootFileIo();
49  parInput1->open(parFile.Data());
50 
51  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
52  parIo1->open(allDigiFile.Data(),"in");
53 
54  rtdb->setFirstInput(parInput1);
55  rtdb->setSecondInput(parIo1);
56  // ------------------------------------------------------------------------
57 
58  //------ Track finder QA ---------------------------
59  PndGemTrackFinderQA* trackFinderQA = new PndGemTrackFinderQA();
60  trackFinderQA->SetVerbose(10);//verboseLevel);
61  fRun->AddTask(trackFinderQA);
62  //--------------------------------------------------
63 
64 
65  // ----- Intialise and run --------------------------------------------
66  fRun->Init();
67  fRun->Run(0,nEvents);
68 
69 
70  // ----- Finish -------------------------------------------------------
71  timer.Stop();
72  Double_t rtime = timer.RealTime();
73  Double_t ctime = timer.CpuTime();
74  cout << endl << endl;
75  cout << "Macro finished succesfully." << endl;
76  cout << "Output file is " << outFile << endl;
77  cout << "Parameter file is " << parFile << endl;
78  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
79  cout << endl;
80 
81  return 1;
82 }
83 
Int_t gem_findTracksQA(Int_t nStations, Double_t momentum=15., Int_t nEvents=1000, int verboseLevel=0)
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
void SetVerbose(const Int_t &verbose)
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
TString MCFile
track finding quality assesment task
Double_t rtime
Definition: hit_dirc.C:113