FairRoot/PandaRoot
detectors/lmd/reco_LMD.C
Go to the documentation of this file.
1 // reco macro for lmd
2 // hit reco
3 // hit merge
4 // track search with Trk-Following
5 // track fit with "broken-lines" method
6 // track filter (erase double track-candidates, aply X&Y cuts)
7 // back-propagation with GEANE
8 // created 23/07/2015 by A.Karavdina
9 
10 int reco_LMD(const int nEvents=2000, const int startEvent=0, TString storePath="", const int verboseLevel=0, const double mom=1.5)
11 {
12  // parameters ================================================================
13  bool misalign=false; //no misalignment is expected: important for hit reco and track search
14  bool missPl=true; // switch on "missing plane" in track reconstruction
15  bool mergedHits=true;
16  int nplanes = 4;
17  int nsensors = 100;
18  double radlen=0.31;
19  TString inHits = "LMDHitsMerged";//"LMDHitsPixel";
20  TString inClusters = "LMDPixelClusterCand";
21  TString inDigis = "LMDPixelDigis";
22  TString inTrks="LMDTrackCand";
23  //=========================================================================
24 
25 
26  // ========================================================================
27  // Input file (MC events)
28  TString MCFile = storePath+"Lumi_MC_";
29  MCFile += startEvent;
30  MCFile += ".root";
31  TString DigiFile = storePath+"Lumi_digi_";
32  DigiFile += startEvent;
33  DigiFile += ".root";
34  // Parameter file
35  TString parFile = storePath+"Lumi_Params_";
36  parFile += startEvent;
37  parFile += ".root";
38 
39  // Output file
40  TString outFile = storePath + "Lumi_Geane_";
41  outFile += startEvent;
42  outFile += ".root";
43 
44 
45  std::cout << "MCFile : " << MCFile.Data()<< std::endl;
46  std::cout << "DigiFile: " << DigiFile.Data()<< std::endl;
47  std::cout << "RecoFile: " << outFile.Data()<< std::endl;
48 
49  // ----- Timer --------------------------------------------------------
50  TStopwatch timer;
51  timer.Start();
52  // ------------------------------------------------------------------------
53 
54 
55 
56  // ----- Reconstruction run -------------------------------------------
57  FairRunAna *fRun= new FairRunAna();
58  fRun->SetInputFile(MCFile);
59  fRun->AddFriend(DigiFile);
60  // fRun->SetInputFile(DigiFile);
61  // fRun->AddFriend(MCFile);
62  fRun->SetOutputFile(outFile);
63  // ------------------------------------------------------------------------
64 
65 
66 
67  // ----- Parameter database --------------------------------------------
68  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
69  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
70  parInput1->open(parFile.Data(),"UPDATE");
71  rtdb->setFirstInput(parInput1);
72 
73  // alignment parameter file
74  //TString alignparFile = "LMD_alignment/lumi.align_pixel_ideal.par";//perfect
75 TString alignparFile = "../params/lumi.align_pixel_ideal.par";//perfect
76 
77  FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
78  parInput2->open(alignparFile.Data(),"in");
79  rtdb->setSecondInput(parInput2);
80 
81  // ------------------------------------------------------------------------
82 
83  // ----- LMD hit reco --------------------------------------------
84 
86  lmdhitrec->SetVerbose(verboseLevel);
87  // lmdhitrec->SetMSflag(useMSerr);//switch on\off error calculation due to multiple scaterring
88  lmdhitrec->SetAlignFlag(misalign);
89  if(misalign) lmdhitrec->SetMtxPath(storePath);
90  fRun->AddTask(lmdhitrec);
91 
92  PndLmdHitMergeTask* lmdhitmg = new PndLmdHitMergeTask();
93  lmdhitmg->SetVerbose(verboseLevel);
94  lmdhitmg->SetAlignFlag(misalign);
95  if(misalign) lmdhitmg->SetMtxPath(storePath);
96  fRun->AddTask(lmdhitmg);
97 
98  // ===== End of HitProducers =======
99 
100  // ----- LMD trk reco -------------------------------------------------
101 
102  // ====== Track Finder ======
103  PndLmdTrackFinderTask* lmdfinder = new PndLmdTrackFinderTask(missPl,inHits,inClusters,inDigis, nsensors);
104  lmdfinder->SetInaccuracy(1e-2);
105  lmdfinder->SetSensPixelFlag(true);
106  lmdfinder->SetVerbose(verboseLevel);
107  fRun->AddTask(lmdfinder);
108  // =========================================================================
109 
110  // ====== Track Fitter ======
111  PndLmdLinFitTask* lmdfit = new PndLmdLinFitTask(inTrks,inHits);
112  lmdfit->SetRadLen(1e-2*radlen);
113  lmdfit->SetVerbose(verboseLevel);
114  fRun->AddTask(lmdfit);
115  // =========================================================================
116 
117  //===== Track Fillter ======
119  lmdfilt->SetSkipKinFilt(false);
120  lmdfilt->SetXThFilt(true);
121  lmdfilt->SetDX(0.);
122  lmdfilt->SetYPhFilt(true);
123  lmdfilt->SetDY(0.);
124  lmdfilt->SetVerbose(verboseLevel);
125  fRun->AddTask(lmdfilt);
126  // =========================================================================
127 
128  // ====== Back-Propagating ======
129  FairGeane *Geane = new FairGeane();
130  fRun->AddTask(Geane);
131  TVector3 IP(0., 0., 0.);
132  PndLmdGeaneTask* lmdgeane = new PndLmdGeaneTask(mom, IP);
133  lmdgeane->SetVerbose(verboseLevel);
134  fRun->AddTask(lmdgeane);
135  // =========================================================================
136 
137  rtdb->setOutput(parInput1);
138  rtdb->print();
139 
140  // =========================================================================
141 
142  // ----- Intialise and run --------------------------------------------
143  fRun->Init();
144 
145  fRun->Run(0,nEvents);
146  // ------------------------------------------------------------------------
147 
148  rtdb->saveOutput();
149  rtdb->print();
150  // ----- Finish -------------------------------------------------------
151  timer.Stop();
152  Double_t rtime = timer.RealTime();
153  Double_t ctime = timer.CpuTime();
154  cout << endl << endl;
155  cout << "Macro finished succesfully." << endl;
156  cout << "Output file is " << outFile << endl;
157  cout << "Parameter file is " << parFile << endl;
158  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
159  cout << endl;
160  // ------------------------------------------------------------------------
161 
162  return 0;
163 
164 }
const int nplanes(120)
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
virtual InitStatus Init()
Int_t startEvent
TString storePath
Double_t mom
Definition: plot_dirc.C:14
void SetRadLen(double x)
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
TString DigiFile
void SetInaccuracy(Double_t accu)
Double_t
TString parFile
Definition: hit_dirc.C:14
int reco_LMD(const int nEvents=2000, const int startEvent=0, TString storePath="", const int verboseLevel=0, const double mom=1.5)
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParAsciiFileIo * parInput2
Definition: conMvdDigi.C:26
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
void SetVerbose(Int_t verbose)
TString MCFile
PndLmdLinFitTask * lmdfit
Double_t rtime
Definition: hit_dirc.C:113