FEDRA emulsion software from the OPERA Collaboration
EdbShowAlg.h
Go to the documentation of this file.
1 #ifndef ROOT_EdbShowAlg
2 #define ROOT_EdbShowAlg
3 
4 #include "TROOT.h"
5 #include "TFile.h"
6 #include "TVector3.h"
7 #include "TIndexCell.h"
8 #include "TArrayF.h"
9 #include "TBenchmark.h"
10 #include "EdbVertex.h"
11 #include "EdbPVRec.h"
12 #include "EdbPhys.h"
13 #include "EdbMath.h"
14 #include "EdbMomentumEstimator.h"
15 #include "EdbLog.h"
16 #include "EdbPattern.h"
17 #include "EdbShowerP.h"
18 using namespace std;
19 
20 //______________________________________________________________________________
21 //___
22 //___ Declaration of EdbShowAlg Class:
23 //___ Following structure is foreseen: The (inherited) class instances of
24 //___ EdbShowAlg DO the reconstruction. They DONT manage the data.
25 //___ Following the principle "separate algorithms and data" (like ATHENA,
26 //___ the ATLAS framework). Therefore the EdbPVRec Object, the Initiator
27 //___ Base Tracks and the shower arrays are only handed over either as
28 //___ reference or as pointers. Saving/manipulating/preparing of these
29 //___ objects will only be done in the EdbShowRec class instances!
30 //___
31 //______________________________________________________________________________
32 
33 
34 
35 
36 
37 
38 //______________________________________________________________________________
39 
40 class EdbShowAlg : public TObject {
41 
42 private:
43 // nothing...
44 
45 protected:
46 
47 // A algorithm here should not have more than 10 different parameters, otherwise we
48 // will have to use TObjArray implementations.
49  TString eAlgName;
50  Int_t eAlgValue;
51  Int_t eParaN;
52  Float_t eParaValue[10];
53  TString eParaString[10];
54  Int_t eActualAlgParametersetNr; // Used when more sets of same algorithm
55 
56 
57 // Pointer copies from class EdbShowRec to be used for reconstruction of showers
58 // EdbPVRec object:
60  Int_t eAliNpat;
61 // TObjArray storing Initiator Basetracks:
62  TObjArray* eInBTArray;
63  Int_t eInBTArrayN;
64 // Variables describing plate number cuts.
69 // TObjArray storing Reconstructed Showers:
70  TObjArray* eRecoShowerArray;
72 
73 // Transformed (smaller) EdbPVRec object:
75  Int_t eAli_SubNpat;
76 // Flag wheter to use the small EdbPvrec Object or not. Using small object, this will not be deleted ue to
77 // pointer problems. See in implementation of Transform() for details.
78  Int_t eUseAliSub;
79 
80 
81 // In constructor this is created on heap...
83 
84 // Reset All Default Variables:
85  void Set0();
86 
87 
88 public:
89 
91  EdbShowAlg(TString AlgName, Int_t AlgValue);
92 // EdbShowAlg(TString AlgName, Int_t AlgValue, Float_t* ParaValue[10], TString ParaString[10]);
93 // EdbShowAlg(EdbPVRec* gAli, TObjArray* InBTArray);
94 
95 
96  virtual ~EdbShowAlg(); // virtual constructor due to inherited class
97 
98 
99 // Hand over eAli eInBTArray from EdbShowerRec
100  inline void SetEdbPVRec( EdbPVRec* Ali ) {
101  eAli = Ali;
102  eAliNpat=eAli->Npatterns();
103  }
104  inline void SetInBTArray( TObjArray* InBTArray ) {
105  eInBTArray = InBTArray;
106  eInBTArrayN=eInBTArray->GetEntries();
107  }
108  inline void SetEdbPVRecPIDNumbers(Int_t FirstPlate_eAliPID, Int_t LastPlate_eAliPID, Int_t MiddlePlate_eAliPID, Int_t NumberPlate_eAliPID) {
109  eFirstPlate_eAliPID=FirstPlate_eAliPID;
110  eLastPlate_eAliPID=LastPlate_eAliPID;
111  eMiddlePlate_eAliPID=MiddlePlate_eAliPID;
112  eNumberPlate_eAliPID=NumberPlate_eAliPID;
113  }
114  inline void SetRecoShowerArray(TObjArray* RecoShowerArray) {
115  eRecoShowerArray=RecoShowerArray;
116  }
117  inline void SetRecoShowerArrayN(Int_t RecoShowerArrayN) {
118  eRecoShowerArrayN=RecoShowerArrayN;
119  }
120  inline void AddRecoShowerArray(EdbShowerP* shower) {
121  eRecoShowerArray->Add(shower);
122  ++eRecoShowerArrayN;
123  }
124 
125 
126  inline void SetActualAlgParameterset(Int_t ActualAlgParametersetNr) {
127  eActualAlgParametersetNr=ActualAlgParametersetNr;
128  }
129 
130  inline Int_t GetAlgValue() const {
131  return eAlgValue;
132  }
133  inline TString GetAlgName() const {
134  return eAlgName;
135  }
136  inline Int_t GetRecoShowerArrayN() const {
137  return eRecoShowerArrayN;
138  }
139  inline TObjArray* GetRecoShowerArray() const {
140  return eRecoShowerArray;
141  }
142  inline EdbShowerP* GetShower(Int_t i) const {
143  EdbShowerP* shower = (EdbShowerP*)eRecoShowerArray->At(i);
144  return shower;
145  }
146 
147  inline void SetUseAliSub(Bool_t UseAliSub) {
148  eUseAliSub=UseAliSub;
149  }
150 
151 
152  Double_t DeltaR_WithPropagation(EdbSegP* s,EdbSegP* stest);
153  Double_t DeltaR_WithoutPropagation(EdbSegP* s,EdbSegP* stest);
154  Double_t DeltaR_NoPropagation(EdbSegP* s,EdbSegP* stest);
155 
156  Double_t DeltaTheta(EdbSegP* s1,EdbSegP* s2);
157  Double_t DeltaThetaComponentwise(EdbSegP* s1,EdbSegP* s2);
158  Double_t DeltaThetaSingleAngles(EdbSegP* s1,EdbSegP* s2);
159  Double_t GetSpatialDist(EdbSegP* s1,EdbSegP* s2);
160  Double_t GetMinimumDist(EdbSegP* seg1,EdbSegP* seg2);
161 
162 
163  void SetParameters(Float_t* par);
164  void SetParameter(Int_t parNr, Float_t par);
165 //void Transform_eAli(EdbSegP* InitiatorBT);
166  void Transform_eAli( EdbSegP* InitiatorBT, Float_t ExtractSize);
167  Bool_t IsInConeTube(EdbSegP* sTest, EdbSegP* sStart, Double_t CylinderRadius, Double_t ConeAngle);
168 
169  void UpdateShowerIDs();
170  void UpdateShowerMetaData();
171 
172  void Print();
173  void PrintParameters();
174  void PrintParametersShort();
175  void PrintMore();
176  void PrintAll();
177 
178  void Help();
179 
180 
181 // Main functions for using this ShowerAlgorithm Object.
182 // Structure is made similar to OpRelease, where
183 // Initialize, Execute, Finalize
184 // give the three columns of the whole thing.
185 // Since these functions depend on the algorithm type they are made virtual
186 // and implemented in the inherited classes.
187  virtual void Initialize();
188  virtual void Execute();
189  virtual void Finalize();
190 
191  ClassDef(EdbShowAlg,1); // Root Class Definition for my Objects
192 };
193 
194 
195 //______________________________________________________________________________
196 
197 class EdbShowAlg_SA : public EdbShowAlg {
198 
199 // S_imple A_lg, just collecting every BT which belongs to same MC Event as InBT
200 
201 public:
202 
203  EdbShowAlg_SA();
204  virtual ~EdbShowAlg_SA(); // virtual constructor due to inherited class
205 
206  void Init();
207 
208 // Main functions for using this ShowerAlgorithm Object.
209 // Structure is made similar to OpRelease, where
210 // Initialize, Execute, Finalize
211 // give the three columns of the whole thing.
212  void Initialize();
213  void Execute();
214  void Finalize();
215 
216  ClassDef(EdbShowAlg_SA,1); // Root Class Definition for my Objects
217 };
218 
219 
220 
221 //______________________________________________________________________________
222 
223 class EdbShowAlg_CA : public EdbShowAlg {
224 
225 // C_one A_dvanced Alg
226 
227 private:
228  Bool_t GetConeTubeDistanceToInBT(EdbSegP* sa, EdbSegP* s, Double_t CylinderRadius, Double_t ConeAngle);
229  Bool_t FindPrecedingBTs(EdbSegP* s, EdbSegP* InBT, EdbPVRec *gAli, EdbShowerP* shower);
230 
231 public:
232 
233  EdbShowAlg_CA();
234  virtual ~EdbShowAlg_CA(); // virtual constructor due to inherited class
235 
236 // Main functions for using this ShowerAlgorithm Object.
237 // Structure is made similar to OpRelease, where
238 // Initialize, Execute, Finalize
239 // give the three columns of the whole thing.
240  void Initialize();
241  void Execute();
242  void Finalize();
243 
244  ClassDef(EdbShowAlg_CA,1); // Root Class Definition for my Objects
245 };
246 
247 
248 
249 
250 //______________________________________________________________________________
251 
252 class EdbShowAlg_OI : public EdbShowAlg {
253 
254 // O_fficial I_mplementation Alg. Try of the "libShower recdown" algorithm to keep backward compability.
255 
256 private:
257  Bool_t FindPrecedingBTs(EdbSegP* s, EdbSegP* InBT, EdbPVRec *gAli, EdbShowerP* shower);
258 
259 public:
260 
261  EdbShowAlg_OI();
262  virtual ~EdbShowAlg_OI(); // virtual constructor due to inherited class
263 
264 // Main functions for using this ShowerAlgorithm Object.
265 // Structure is made similar to OpRelease, where
266 // Initialize, Execute, Finalize
267 // give the three columns of the whole thing.
268  void Initialize();
269  void Execute();
270  void Finalize();
271 
272  ClassDef(EdbShowAlg_OI,1); // Root Class Definition for my Objects
273 };
274 
275 
276 //______________________________________________________________________________
277 
278 class EdbShowAlg_RC : public EdbShowAlg {
279 
280 // R_ecursive C_one algorithm.
281 
282 private:
283  Bool_t FindPrecedingBTs(EdbSegP* s, EdbSegP* InBT, EdbPVRec *gAli, EdbShowerP* shower);
284 
285 public:
286  EdbShowAlg_RC();
287  virtual ~EdbShowAlg_RC(); // virtual constructor due to inherited class
288 
289  Bool_t GetConeOrTubeDistanceToBTOfShowerArray(EdbSegP* sa, EdbSegP* InBT, EdbShowerP* shower, Double_t CylinderRadius, Double_t ConeAngle);
290 
291  void Initialize();
292  void Execute();
293  void Finalize();
294 
295  ClassDef(EdbShowAlg_RC,1); // Root Class Definition for my Objects
296 };
297 
298 
299 //______________________________________________________________________________
300 
301 class EdbShowAlg_BW : public EdbShowAlg {
302 
303  // B_ack_W_ard algorithm.
304 
305 private:
306  Bool_t DummyBWFunction();
307 
308 public:
309  EdbShowAlg_BW();
310  virtual ~EdbShowAlg_BW(); // virtual constructor due to inherited class
311 
312  void Initialize();
313  void Execute();
314  void Finalize();
315 
316  ClassDef(EdbShowAlg_BW,1); // Root Class Definition for my Objects
317 };
318 
319 //______________________________________________________________________________
320 // class EdbShowAlg_NN : public EdbShowAlg
321 // ->Declared in File "EdbShowAlg_NN.h"
322 // ->Implemented in File "EdbShowAlg_NN.cxx"
323 //______________________________________________________________________________
324 // class EdbShowAlg_N3 : public EdbShowAlg
325 // ->Declared in File "EdbShowAlg_NN.h"
326 // ->Implemented in File "EdbShowAlg_NN.cxx"
327 //______________________________________________________________________________
328 
329 /*
330 TO BE IMPLEMENTED ALGORITHMS IF TIME (and needed, if not available from "showrec" standalone program):
331 0 CT (ConeTube)
332 1 CL (CLuster)
333 2 CA (ConetubeAdvanced)
334 3 NN (NeuralNet)
335 4 OI (OfficialImplementation)
336 5 SA (?? SA ??)
337 6 TC (TrackCone)
338 7 RC (RecursiveCone)
339 8 BW (BackWard)
340 9 AG (AdvancedGamma)
341 10 GS (GammaSearch)
342 11 N3 (NewNeuralNet)
343 */
344 //______________________________________________________________________________
345 
346 
347 #endif /* ROOT_EdbShowAlg */
TObjArray * RecoShowerArray
Definition: Shower_E_FromShowerRoot.C:12
Bool_t FindPrecedingBTs(EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
Definition: ShowRec.cpp:6764
Double_t GetSpatialDist(EdbSegP *s1, EdbSegP *s2)
Definition: ShowRec.cpp:7276
Bool_t GetConeOrTubeDistanceToBTOfShowerArray(EdbSegP *sa, EdbSegP *InBT, TObjArray *showersegarray, Double_t CylinderRadius, Double_t ConeAngle)
Definition: ShowRec.cpp:7072
Double_t GetMinimumDist(EdbSegP *seg1, EdbSegP *seg2)
Definition: ShowRec.cpp:8581
Definition: EdbPVRec.h:148
Int_t Npatterns() const
Definition: EdbPattern.h:380
Definition: EdbSegP.h:18
Definition: EdbShowAlg.h:301
ClassDef(EdbShowAlg_BW, 1)
Definition: EdbShowAlg.h:223
ClassDef(EdbShowAlg_CA, 1)
Definition: EdbShowAlg.h:252
ClassDef(EdbShowAlg_OI, 1)
Definition: EdbShowAlg.h:278
ClassDef(EdbShowAlg_RC, 1)
Definition: EdbShowAlg.h:197
ClassDef(EdbShowAlg_SA, 1)
Definition: EdbShowAlg.h:40
Int_t GetAlgValue() const
Definition: EdbShowAlg.h:130
Int_t GetRecoShowerArrayN() const
Definition: EdbShowAlg.h:136
Int_t eAliNpat
Definition: EdbShowAlg.h:60
void SetUseAliSub(Bool_t UseAliSub)
Definition: EdbShowAlg.h:147
void SetEdbPVRecPIDNumbers(Int_t FirstPlate_eAliPID, Int_t LastPlate_eAliPID, Int_t MiddlePlate_eAliPID, Int_t NumberPlate_eAliPID)
Definition: EdbShowAlg.h:108
void AddRecoShowerArray(EdbShowerP *shower)
Definition: EdbShowAlg.h:120
void SetRecoShowerArray(TObjArray *RecoShowerArray)
Definition: EdbShowAlg.h:114
void SetRecoShowerArrayN(Int_t RecoShowerArrayN)
Definition: EdbShowAlg.h:117
ClassDef(EdbShowAlg, 1)
TString eAlgName
Definition: EdbShowAlg.h:49
void SetInBTArray(TObjArray *InBTArray)
Definition: EdbShowAlg.h:104
TObjArray * eRecoShowerArray
Definition: EdbShowAlg.h:70
Int_t eAli_SubNpat
Definition: EdbShowAlg.h:75
Int_t eAlgValue
Definition: EdbShowAlg.h:50
Int_t eFirstPlate_eAliPID
Definition: EdbShowAlg.h:65
void SetEdbPVRec(EdbPVRec *Ali)
Definition: EdbShowAlg.h:100
Int_t eLastPlate_eAliPID
Definition: EdbShowAlg.h:66
Int_t eInBTArrayN
Definition: EdbShowAlg.h:63
Int_t eMiddlePlate_eAliPID
Definition: EdbShowAlg.h:67
Int_t eParaN
Definition: EdbShowAlg.h:51
EdbShowerP * GetShower(Int_t i) const
Definition: EdbShowAlg.h:142
TObjArray * eInBTArray
Definition: EdbShowAlg.h:62
EdbPVRec * eAli
Definition: EdbShowAlg.h:59
Int_t eNumberPlate_eAliPID
Definition: EdbShowAlg.h:68
EdbShowerP * eRecoShower
Definition: EdbShowAlg.h:82
Int_t eUseAliSub
Definition: EdbShowAlg.h:78
void SetActualAlgParameterset(Int_t ActualAlgParametersetNr)
Definition: EdbShowAlg.h:126
Int_t eRecoShowerArrayN
Definition: EdbShowAlg.h:71
EdbPVRec * eAli_Sub
Definition: EdbShowAlg.h:74
TString GetAlgName() const
Definition: EdbShowAlg.h:133
TObjArray * GetRecoShowerArray() const
Definition: EdbShowAlg.h:139
Int_t eActualAlgParametersetNr
Definition: EdbShowAlg.h:54
Definition: EdbShowerP.h:28
EdbPVRec gAli
Definition: emvertex.cpp:20
Alg Print()
Alg Execute()
void Finalize()
Definition: ShowRec.cpp:513
void Help()
Definition: mc2raw.cxx:20
void Initialize()
Definition: rwcToEdb.cpp:28
EdbSegP * s1
Definition: tlg2pattern.C:30
EdbSegP * s2
Definition: tlg2pattern.C:31
EdbSegP * s
Definition: tlg2pattern.C:32