EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichReconstruction.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichReconstruction.cxx
1 
9 #include "CbmRichRing.h"
10 
13 
18 
19 #include "CbmRichRingFinderHough.h"
20 #include "CbmRichRingFinderIdeal.h"
21 //@@#include "CbmL1RichENNRingFinder.h"
22 //#include "CbmL1RichENNRingFinderParallel.h"
24 
26 #include "CbmRichRingFitterTAU.h"
27 #include "CbmRichRingFitterCOP.h"
31 
33 
34 #include "FairHit.h"
35 #include "CbmGlobalTrack.h"
36 #include "FairRootManager.h"
37 #include "FairLogger.h"
38 #include "CbmRichConverter.h"
39 #include "TClonesArray.h"
40 
41 #include <iostream>
42 
43 using std::cout;
44 using std::endl;
45 
47 : FairTask("CbmRichReconstruction"),
48  fRichHits(NULL),
49  fRichRings(NULL),
50  fRichProjections(NULL),
51  fRichTrackParamZ(NULL),
52  fGlobalTracks(NULL),
53 
54  fRingFinder(NULL),
55  fRingFitter(NULL),
56  fTrackExtrapolation(NULL),
57  fProjectionProducer(NULL),
58  fRingTrackAssign(NULL),
59 
60  fRunExtrapolation(true),
61  fRunProjection(true),
62  fRunFinder(true),
63  fRunFitter(true),
64  fRunTrackAssign(true),
65 
66  fExtrapolationName("kf"),
67  fProjectionName("standard"),
68  fFinderName("hough"),
69  fFitterName("ellipse_tau"),
70  fTrackAssignName("closest_distance"),
71 
72  fZTrackExtrapolation(300.),
73  fMinNofStsHits(4)
74 {
75 
76 }
77 
79 {
80  if (NULL != fRingFinder) delete fRingFinder;
81  if (NULL != fRingFitter) delete fRingFitter;
82  if (NULL != fTrackExtrapolation) delete fTrackExtrapolation;
83  if (NULL != fProjectionProducer) delete fProjectionProducer;
84 }
85 
87 {
89  else if (fProjectionName == "prototype") fProjectionProducer = new CbmRichProtProjectionProducer(1);
90  else {
91  LOG(FATAL) << fProjectionName << " is not correct name for projection algorithm." << FairLogger::endl;
92 // Fatal("CbmRichReconstruction::",(fProjectionName + string(" is not correct name for projection algorithm.")).c_str());
93  }
95 }
96 
98 {
99  cout << "CbmRichReconstruction::Init"<<endl;
101  if (NULL == ioman) { Fatal("CbmRichReconstruction::Init","RootManager not instantised!"); }
102 
103  if (fRunExtrapolation) {
104  fRichTrackParamZ = new TClonesArray("FairTrackParam",100);
105  ioman->Register("RichTrackParamZ", "RICH", fRichTrackParamZ, kFALSE);
106  } //if
108 #if _MODIFY_
109  fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
110  if ( NULL == fGlobalTracks) { Fatal("CbmRichReconstruction::Init", "No GlobalTrack array!");}
111 #endif
112  fRichProjections = new TClonesArray("FairTrackParam");
113  ioman->Register("RichProjection", "RICH", fRichProjections, kTRUE);
114  }
115  fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
116  if ( NULL == fRichHits) { Fatal("CbmRichReconstruction::Init","No RichHit array!"); }
117 
118  fRichRings = new TClonesArray("CbmRichRing", 100);
119  ioman->Register("RichRing", "RICH", fRichRings, kTRUE);
120 
123  if (fRunFinder) InitFinder();
124  if (fRunFitter) InitFitter();
126 
127  return kSUCCESS;
128 }
129 
131  Option_t* opt)
132 {
135  if (fRunFinder) RunFinder();
136  if (fRunFitter) RunFitter();
138 }
139 
141 {
142  // Will need to modify them accordingly like "kf" case;
143 #if _LATER_
144  if (fExtrapolationName == "ideal"){
146  } else if (fExtrapolationName == "mirror_ideal"){
149  } else
150 #endif
151  if (fExtrapolationName == "kf" || fExtrapolationName == "KF"){
153  } else {
154  LOG(FATAL) << fExtrapolationName << " is not correct name for extrapolation algorithm." << FairLogger::endl;
155 // Fatal("CbmRichReconstruction::InitExtrapolation",
156 // (fExtrapolationName + string(" is not correct name for extrapolation algorithm.")).c_str());
157  }
159 }
160 
162 {
164 }
165 
167 {
168  if (fFinderName == "hough"){
170  // Check those first if ever want to try them out;
171 #if _LATER_
172  } else if (fFinderName == "ideal"){
174  } else if (fFinderName == "enn"){
175  fRingFinder = new CbmL1RichENNRingFinder(0);
176  } else if ((fFinderName == "enn_parallel")){
177  // fRingFinder = new CbmL1RichENNRingFinderParallel(0);
178  } else if (fFinderName == "hough_prototype") {
180 #endif
181  } else {
182  LOG(FATAL) << fFinderName << " is not correct name for ring finder algorithm." << FairLogger::endl;
183 // Fatal("CbmRichReconstruction::InitFinder",
184 // (fFinderName + string(" is not correct name for ring finder algorithm.")).c_str());
185  }
186 
187  fRingFinder->Init();
188 }
189 
191 {
192  // Check them first if want to use;
193 #if _LATER_
194  if (fFitterName == "circle_cop"){
196  } else if (fFitterName == "circle_simple") {
198  } else if (fFitterName == "circle_tau") {
200  } else if (fFitterName == "circle_robust_cop") {
202  } else
203 #endif
204  if (fFitterName == "ellipse_tau") {
206 #if _LATER_
207  } else if (fFitterName == "ellipse_minuit") {
209 #endif
210  } else {
211  LOG(FATAL) << fFitterName << " is not correct name for ring fitter algorithm." << FairLogger::endl;
212 // Fatal("CbmRichReconstruction::InitFitter",
213 // (fFitterName + string(" is not correct name for ring fitter algorithm.")).c_str());
214  }
216 }
217 
219 {
220  if (fTrackAssignName == "closest_distance"){
222  } else {
223  LOG(FATAL) << fTrackAssignName << " is not correct name for ring-track assignment algorithm." << FairLogger::endl;
224 // Fatal("CbmRichReconstruction::InitTrackAssign",
225 // (fTrackAssignName + string(" is not correct name for ring-track assignment algorithm.")).c_str());
226  }
228 }
229 
231 {
232  fRichTrackParamZ->Clear();
234 }
235 
237 {
239 }
240 
242 {
243  fRichRings->Clear();
245 }
246 
248 {
249  int nofRings = fRichRings->GetEntriesFast();
250  for (int iRing = 0; iRing < nofRings; iRing++) {
251  CbmRichRing* ring = (CbmRichRing*)fRichRings->At(iRing);
252  if (NULL == ring) continue;
253  CbmRichRingLight ringL;
254 
256  fRingFitter->DoFit(&ringL);
258  }
259 }
260 
262 {
263  // check whether track were assigned to rings.
264  /* Int_t nTracks = fGlobalTracks->GetEntriesFast();
265  for (Int_t iTrack = 0; iTrack < nTracks; iTrack++){
266  CbmGlobalTrack* gTrack = (CbmGlobalTrack*) fGlobalTracks->At(iTrack);
267  Int_t iRing = gTrack->GetRichRingIndex();
268  if (iRing != -1) return;
269  }*/
270 
272 }
273 
275 {
276 
277 }
278