FairRoot/PandaRoot
softrig/prod_rec.C
Go to the documentation of this file.
1 int prod_rec(TString outpre="")
2 {
3  // Macro created 20/09/2006 by S.Spataro
4  // It loads a digi file and performs tracking
5 
6  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
7  Int_t iVerbose = 0; // just forget about it, for the moment
8 
9  // Number of events to process
10  Int_t nEvents = 0; // if 0 all the vents will be processed
11 
12  // Parameter file
13  TString parFile = outpre+"_par.root"; // at the moment you do not need it
14 
15  // Digitisation file (ascii)
16  TString digiFile = "all.par";
17 
18  // Output file
19  TString outFile = outpre+"_rec.root";
20 
21  // ----- Timer --------------------------------------------------------
22  TStopwatch timer;
23  // ------------------------------------------------------------------------
24 
25  // ----- Reconstruction run -------------------------------------------
26  FairRunAna *fRun= new FairRunAna();
27  fRun->SetInputFile(outpre+"_sim.root");
28  fRun->AddFriend(outpre+"_dig.root");
29  fRun->SetOutputFile(outFile);
30  fRun->SetGenerateRunInfo(kFALSE);
31  FairGeane *Geane = new FairGeane();
32  fRun->AddTask(Geane);
33 
34  // ----- Parameter database --------------------------------------------
35  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
36  emcDigiFile += "/macro/params/";
37  emcDigiFile += digiFile;
38 
39  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
40  FairParRootFileIo* parInput1 = new FairParRootFileIo();
41  parInput1->open(parFile.Data());
42 
43  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
44  parIo1->open(emcDigiFile.Data(),"in");
45 
46  rtdb->setFirstInput(parInput1);
47  rtdb->setSecondInput(parIo1);
48 
49  // ------------------------------------------------------------------------
50  // use the constructor with input :
51  // printout flag (int) , plotting flag (bool), MC comparison flag (bool), SciTil.
52  PndTrkTracking2* tracking = new PndTrkTracking2(0,false,false,true);
53  tracking->SetInputBranchName("STTHit","MVDHitsPixel","MVDHitsStrip");
54  // tracking->SetInputBranchName("STTHitMix","MVDHitsPixelMix","MVDHitsStripMix");
55  // don't do the Pattern Recognition second part, starting from the Mvd;
56  tracking->NoMvdAloneTracking();
57  // do Cleanup only when there is Mixing;
58  // tracking->Cleanup();
59  tracking->SetPersistence(kFALSE);
60  fRun->AddTask(tracking);
61 
63  //SttMvdGemTracking->SetPdgFromMC();
64  SttMvdGemTracking->SetPersistence(kFALSE);
65  fRun->AddTask(SttMvdGemTracking);
66 
67 // PndMCTrackAssociator* trackMC = new PndMCTrackAssociator();
68 // trackMC->SetTrackInBranchName("SttMvdGemTrack");
69 // trackMC->SetTrackOutBranchName("SttMvdGemTrackID");
70 // trackMC->SetPersistence(kFALSE);
71 // fRun->AddTask(trackMC);
72 
74  recoKalman->SetTrackInBranchName("SttMvdGemTrack");
75 // recoKalman->SetTrackInIDBranchName("SttMvdGemTrackID");
76  recoKalman->SetTrackOutBranchName("SttMvdGemGenTrack");
77  recoKalman->SetBusyCut(50); // CHECK to be tuned
78  //recoKalman->SetIdealHyp(kTRUE);
79  //recoKalman->SetNumIterations(3);
80  recoKalman->SetTrackRep(0); // 0 Geane (default), 1 RK
81  //recoKalman->SetPropagateToIP(kFALSE);
82  fRun->AddTask(recoKalman);
83 
84 // PndMCTrackAssociator* trackMC2 = new PndMCTrackAssociator();
85 // trackMC2->SetTrackInBranchName("SttMvdGemGenTrack");
86 // trackMC2->SetTrackOutBranchName("SttMvdGemGenTrackID");
87 // fRun->AddTask(trackMC2);
88 
90  trackFts->SetRelativeMomentumSmearing(0.05);
91  trackFts->SetVertexSmearing(0.05, 0.05, 0.05);
92  trackFts->SetTrackingEfficiency(1.);
93  trackFts->SetTrackOutput("FtsIdealTrack");
94  trackFts->SetPersistence(kFALSE);
95  fRun->AddTask(trackFts);
96 
97 // PndMCTrackAssociator* trackMCfwd = new PndMCTrackAssociator();
98 // trackMCfwd->SetTrackInBranchName("FtsIdealTrack");
99 // trackMCfwd->SetTrackOutBranchName("FtsIdealTrackID");
100 // fRun->AddTask(trackMCfwd);
101 
103  recoKalmanFwd->SetTrackInBranchName("FtsIdealTrack");
104  //recoKalmanFwd->SetTrackInIDBranchName("FtsIdealTrackID");
105  recoKalmanFwd->SetTrackOutBranchName("FtsIdealGenTrack");
106  recoKalmanFwd->SetBusyCut(50); // CHECK to be tuned
107  //recoKalmanFwd->SetIdealHyp(kTRUE);
108  //recoKalmanFwd->SetNumIterations(3);
109  recoKalmanFwd->SetTrackRep(0); // 0 Geane (default), 1 RK
110  //recoKalmanFwd->SetPropagateToIP(kFALSE);
111  fRun->AddTask(recoKalmanFwd);
112 
113 // PndMCTrackAssociator* trackMC3 = new PndMCTrackAssociator();
114 // trackMC3->SetTrackInBranchName("FtsIdealGenTrack");
115 // trackMC3->SetTrackOutBranchName("FtsIdealGenTrackID");
116 // fRun->AddTask(trackMC3);
117 
118  // ----- Intialise and run --------------------------------------------
120  cout << "fRun->Init()" << endl;
121  fRun->Init();
122 
123  timer.Start();
124  fRun->Run(0,nEvents);
125  // ------------------------------------------------------------------------
126 
127 
128  // ----- Finish -------------------------------------------------------
129  timer.Stop();
130  Double_t rtime = timer.RealTime();
131  Double_t ctime = timer.CpuTime();
132  cout << endl << endl;
133  cout << "Macro finished successfully." << endl;
134  cout << "Output file is " << outFile << endl;
135  cout << "Parameter file is " << parFile << endl;
136  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
137  cout << endl;
138  // ------------------------------------------------------------------------
139  cout << " Test passed" << endl;
140  cout << " All ok " << endl;
141  //exit(0);
142  return 0;
143 }
TString outFile
Definition: hit_dirc.C:17
void SetTrackOutput(TString name="FTSTrkIdeal")
void SetTrackingEfficiency(Double_t eff=1.)
TString digiFile
Definition: bump_emc.C:20
TString emcDigiFile
Definition: bump_emc.C:45
void SetTrackOutBranchName(const TString &name)
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
TString parFile
Definition: hit_dirc.C:14
void SetVertexSmearing(Double_t sigmax=-1., Double_t sigmay=-1., Double_t sigmaz=-1.)
PndRecoKalmanTask * recoKalmanFwd
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
void SetPersistence(Bool_t persistence)
static void Init(Int_t MapVersion)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetPersistence(Bool_t persistence)
PndTrkTracking * tracking
PndFtsTrackerIdeal * trackFts
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
void SetInputBranchName(const char *string1, const char *string2, const char *string3)
void SetTrackRep(Short_t num)
void NoMvdAloneTracking()
void SetBusyCut(Int_t b)
void SetTrackInBranchName(const TString &name)
PndSttMvdGemTracking * SttMvdGemTracking
Int_t iVerbose
PndRecoKalmanTask * recoKalman
int prod_rec(TString outpre="")
Double_t rtime
Definition: hit_dirc.C:113
void SetRelativeMomentumSmearing(Double_t dpop=-1.)