]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/blacklisted-classes/Cascade.h
First big commit of the mchview program and its accompanying library,
[u/mrichter/AliRoot.git] / EVE / Alieve / blacklisted-classes / Cascade.h
1 #ifndef ALIEVE_CASCADE_H
2 #define ALIEVE_CASCADE_H
3
4 /***********************************************************************
5 *  This code defines the reconstructed cascades visualized with EVE
6 *
7 * Ludovic Gaudichet (gaudichet@to.infn.it)
8 ************************************************************************/
9
10 #include <Reve/PODs.h>
11 #include <Reve/RenderElement.h>
12 #include <Reve/Track.h>
13
14 #include <TPolyMarker3D.h>
15 #include <TPolyLine3D.h>
16
17 class TH1F;
18 class TH2F;
19
20
21 namespace Alieve {
22
23 class CascadeList;
24
25 class Cascade : public Reve::RenderElement,
26                 public TPolyMarker3D
27 {
28 public:
29   typedef std::vector<Reve::PathMark*>           vpPathMark_t;
30
31 private:
32   friend class CascadeList;
33
34   Cascade(const Cascade&);            // Not implemented
35   Cascade& operator=(const Cascade&); // Not implemented
36
37 protected:
38   typedef std::vector<Reve::PathMark*>::iterator vpPathMark_i;
39
40   Reve::Vector fV_neg;       // Vertex of negative track
41   Reve::Vector fP_neg;       // Momentum of negative track
42   Reve::Vector fV_pos;       // Vertex of positive track
43   Reve::Vector fP_pos;       // Momentum of positive track
44   Reve::Vector fV_bach;      // Vertex of positive track
45   Reve::Vector fP_bach;      // Momentum of positive track
46
47   Reve::Vector fV_decay;     //decay point of the cascade
48   Reve::Vector fV_birth;    // Reconstructed birth point of neutral particle
49
50   vpPathMark_t         fPathMarksNeg;
51   vpPathMark_t         fPathMarksPos;
52   vpPathMark_t         fPathMarksBach;
53   Reve::TrackRnrStyle *fRnrStyle;
54
55   TPolyLine3D       fPolyLineNeg;
56   TPolyLine3D       fPolyLinePos;
57   TPolyLine3D       fPolyLineBach;
58   TPolyLine3D       fPolyLineV0;   // line of V0 travel
59   TPolyLine3D       fPolyLineCas;  // line of cascade travel
60
61   Float_t           fBeta_neg;
62   Float_t           fBeta_pos;
63   Float_t           fBeta_bach;
64
65   Int_t             fESDIndex;
66
67   Float_t           fDCA_v0_Bach;
68   Float_t           fCasCosPointingAngle;
69   Float_t           fCasDecayLength;
70
71   static const Float_t fgkMassPion2;
72   static const Float_t fgkMassKaon2;
73   static const Float_t fgkMassProton2;
74   static const Float_t fgkMassLambda2;
75
76 public: 
77   Cascade();
78   Cascade(Reve::TrackRnrStyle* rs);
79   virtual ~Cascade();
80
81   virtual void  SetESDIndex(Int_t ind) { fESDIndex = ind;}
82   virtual void  SetMainColor(Color_t col)
83   {
84     fMarkerColor = col; fMainColorPtr = &fMarkerColor;
85     fPolyLineV0.SetLineColor(fMarkerColor);
86   }
87   virtual void  SetTracksColor(Color_t cNeg, Color_t cPos, Color_t cBach)
88   {
89     fPolyLineNeg.SetLineColor(cNeg); fPolyLinePos.SetLineColor(cPos);
90     fPolyLineBach.SetLineColor(cBach);
91   }
92   void        SetRnrStyle(Reve::TrackRnrStyle* rs) { fRnrStyle = rs; }
93
94   void  AddPathMarkPos(Reve::PathMark* pm) { fPathMarksPos.push_back(pm); }
95   void  AddPathMarkNeg(Reve::PathMark* pm) { fPathMarksNeg.push_back(pm); }
96   void  AddPathMarkBach(Reve::PathMark* pm) { fPathMarksBach.push_back(pm); }
97
98   virtual void PaintV0Daughters(Option_t* option="") {
99     if(fRnrSelf) {fPolyLineNeg.Paint(option);fPolyLinePos.Paint(option); } }
100   virtual void PaintBachelor(Option_t* option="") {
101     if(fRnrSelf) fPolyLineBach.Paint(option); }
102   virtual void Paint(Option_t* option="") {
103     if(fRnrSelf) TPolyMarker3D::Paint(option);}
104   virtual void PaintV0Path(Option_t* option="") {
105     if(fRnrSelf) fPolyLineV0.Paint(option);}
106   virtual void PaintCasPath(Option_t* option="") {
107     if(fRnrSelf) fPolyLineCas.Paint(option);}
108
109   void Reset(TPolyLine3D* polyLine);
110   void MakeTrack(vpPathMark_t& pathMark, Reve::Vector& vtx,  Reve::Vector& p,
111                  Int_t charge, Float_t beta, TPolyLine3D& polyLine);
112   void MakeV0path();
113   void MakeCasPath();
114   void MakeCascade();
115
116   void SetBeta(Float_t betaNeg, Float_t betaPos, Float_t betaBach);
117   void SetDCA_v0_Bach(Float_t dca) {fDCA_v0_Bach = dca;}
118   void SetCasCosPointingAngle(Float_t cos) {fCasCosPointingAngle = cos;}
119   void SetNegP(Float_t px, Float_t py, Float_t pz) {fP_neg.x = px; fP_neg.y = py; fP_neg.z = pz;}
120   void SetPosP(Float_t px, Float_t py, Float_t pz) {fP_pos.x = px; fP_pos.y = py; fP_pos.z = pz;}
121   void SetBachP(Float_t px, Float_t py, Float_t pz) {fP_bach.x = px; fP_bach.y = py; fP_bach.z = pz;}
122
123   void SetV0vtx(Float_t vx, Float_t vy, Float_t vz)  {
124     fV_neg.x = vx; fV_neg.y = vy; fV_neg.z = vz; 
125     fV_pos.x = vx; fV_pos.y = vy; fV_pos.z = vz; 
126   }
127   void SetCascadeVtx(Float_t vx, Float_t vy, Float_t vz) {
128     fV_decay.x = vx; fV_decay.y = vy; fV_decay.z = vz; }
129
130   void SetDecayLength(Float_t primx, Float_t primy, Float_t primz);
131
132   Int_t   GetESDIndex() const { return fESDIndex; }
133   virtual const Text_t* GetName()  const { return Form("ESDcascade_%i",fESDIndex); }
134   virtual const Text_t* GetTitle() const { return Form("ESDcascade_%i",fESDIndex); }
135
136   Float_t GetDCA_v0_Bach() const;
137   Float_t GetCasCosPointingAngle() const;
138   Float_t GetRadius() const;
139   Float_t GetPseudoRapidity() const;
140   Float_t GetPt2() const;
141   Float_t GetPt() const;
142   Float_t GetP2() const;
143   Float_t GetMomentum() const;
144   Float_t GetPx() const;
145   Float_t GetPy() const;
146   Float_t GetPz() const;
147   Float_t GetCasAlphaArmenteros() const;
148   Float_t GetCasPtArmenteros() const;
149   Float_t GetPosP2() const;
150   Float_t GetPosP() const;
151   Float_t GetPosPt() const;
152   Float_t GetPosPseudoRapidity() const;
153   Float_t GetNegP2() const;
154   Float_t GetNegP() const;
155   Float_t GetNegPt() const;
156   Float_t GetNegPseudoRapidity() const;
157   Float_t GetBachP2() const;
158   Float_t GetBachP() const;
159   Float_t GetBachPt() const;
160   Float_t GetBachPseudoRapidity() const;
161
162   Float_t GetV0P2() const;
163   Float_t GetLambdaE() const;
164   Float_t GetXiE() const;
165   Float_t GetOmegaE() const;
166   Float_t GetXiMass() const;
167   Float_t GetAntiXiMass() const;
168   Float_t GetOmegaMass() const;
169   Float_t GetAntiOmegaMass() const;
170
171   ClassDef(Cascade, 1); // Visual representation of a cascade.
172 }; // endclass Cascade
173
174
175
176 //______________________________________________________________________
177
178 inline void Cascade::SetBeta(Float_t betaNeg, Float_t betaPos, Float_t betaBach) {
179    fBeta_neg = betaNeg;
180    fBeta_pos = betaPos;
181    fBeta_bach = betaBach;
182  }
183
184
185 //______________________________________________________________________
186
187 inline Float_t Cascade::GetV0P2() const {
188   Float_t px = fP_neg.x + fP_pos.x, py = fP_neg.y + fP_pos.y,
189     pz = fP_neg.z+fP_pos.z;
190   return px*px + py*py + pz*pz;
191 }
192
193
194 inline Float_t Cascade::GetLambdaE() const {
195   return sqrt(fgkMassLambda2+GetV0P2());
196 }
197
198 inline Float_t Cascade::GetXiE() const {
199   Float_t e = GetLambdaE() +
200     sqrt(fgkMassPion2 + fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y +
201          fP_bach.z*fP_bach.z);
202   return e;
203 }
204
205 inline Float_t Cascade::GetOmegaE() const {
206   Float_t e = GetLambdaE() +
207     sqrt(fgkMassKaon2 + fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y +
208          fP_bach.z*fP_bach.z);
209   return e;
210 }
211
212 inline Float_t Cascade::GetXiMass() const {
213   Float_t e = GetXiE();
214   return sqrt(e*e - GetP2());
215 }
216
217 inline Float_t Cascade::GetAntiXiMass() const { return GetXiMass();}
218
219 inline Float_t Cascade::GetOmegaMass() const {
220   Float_t e = GetOmegaE();
221   return sqrt(e*e - GetP2());
222 }
223
224 inline Float_t Cascade::GetAntiOmegaMass() const { return GetOmegaMass();}
225
226
227 //______________________________________________________________________
228
229 inline Float_t Cascade::GetDCA_v0_Bach() const {
230   return fDCA_v0_Bach;
231 }
232
233 inline Float_t Cascade::GetCasCosPointingAngle() const {
234 return fCasCosPointingAngle;
235 }
236
237 inline Float_t Cascade::GetRadius() const {
238   return sqrt(fV_birth.x*fV_birth.x + fV_birth.y*fV_birth.y);
239 }
240
241 //inline Float_t Cascade::GetDecayLength() const {
242 //return fDecayLength;
243 //}
244
245 inline Float_t Cascade::GetPseudoRapidity() const {
246   Float_t theta = acos( GetPz()/GetMomentum() );
247   return ( -log(tan(theta/2.)) );
248 }
249
250
251 //______________________________________________________________________
252 inline Float_t Cascade::GetPt2() const {
253   Float_t px = GetPx(), py = GetPy();
254   return (px*px+py*py);
255 }
256
257 inline Float_t Cascade::GetP2() const {
258
259   Float_t px = GetPx(), py = GetPy(), pz = GetPz();
260   return (px*px+py*py+pz*pz);
261 }
262
263 inline Float_t Cascade::GetPt() const {
264   return sqrt(GetPt2());
265 }
266
267 inline Float_t Cascade::GetMomentum() const {
268   return sqrt(GetP2());
269 }
270
271 inline Float_t Cascade::GetPx() const {
272   return (fP_neg.x + fP_pos.x + fP_bach.x);
273 }
274
275 inline Float_t Cascade::GetPy() const {
276   return (fP_neg.y + fP_pos.y + fP_bach.y);
277 }
278
279 inline Float_t Cascade::GetPz() const {
280   return (fP_neg.z + fP_pos.z + fP_bach.z);
281 }
282
283 //______________________________________________________________________
284
285 inline Float_t Cascade::GetPosP2() const {
286   return (fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y + fP_pos.z*fP_pos.z);
287 }
288
289 inline Float_t Cascade::GetPosP() const {
290   return sqrt(GetPosP2());
291 }
292
293 inline Float_t Cascade::GetPosPt() const {
294   return sqrt(fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y);
295 }
296
297 inline Float_t Cascade::GetPosPseudoRapidity() const {
298   Float_t theta = acos( fP_pos.z/GetPosP() );
299   return ( -log(tan(theta/2.)) );
300 }
301
302 //______________________________________________________________________
303 inline Float_t Cascade::GetNegP2() const {
304   return (fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y + fP_neg.z*fP_neg.z);
305 }
306
307 inline Float_t Cascade::GetNegP() const {
308   return sqrt(GetNegP2());
309 }
310
311 inline Float_t Cascade::GetNegPt() const {
312   return sqrt(fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y);
313 }
314
315 inline Float_t Cascade::GetNegPseudoRapidity() const {
316   Float_t theta = acos( fP_neg.z/GetNegP() );
317   return ( -log(tan(theta/2.)) );
318 }
319
320
321 //______________________________________________________________________
322 inline Float_t Cascade::GetBachP2() const {
323   return (fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y + fP_bach.z*fP_bach.z);
324 }
325
326 inline Float_t Cascade::GetBachP() const {
327   return sqrt(GetBachP2());
328 }
329
330 inline Float_t Cascade::GetBachPt() const {
331   return sqrt(fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y);
332 }
333
334 inline Float_t Cascade::GetBachPseudoRapidity() const {
335   Float_t theta = acos( fP_bach.z/GetBachP() );
336   return ( -log(tan(theta/2.)) );
337 }
338
339
340 /***********************************************************************
341 *
342 *  CascadeList class
343 *
344 ************************************************************************/
345
346 class CascadeList : public Reve::RenderElementList
347 {
348   CascadeList(const CascadeList&);            // Not implemented
349   CascadeList& operator=(const CascadeList&); // Not implemented
350
351 private:
352   void  Init();
353
354 protected:
355   TString              fTitle;
356
357   Reve::TrackRnrStyle *fRnrStyle;
358
359   Bool_t               fRnrBach;
360   Bool_t               fRnrV0Daughters;
361   Bool_t               fRnrV0vtx;
362   Bool_t               fRnrV0path;
363   Bool_t               fRnrCasVtx;
364   Bool_t               fRnrCasPath;
365
366   Color_t              fNegColor;
367   Color_t              fPosColor;
368   Color_t              fBachColor;
369
370   static const Int_t fgkNcutVar = 14;
371   TH1F *fHist[fgkNcutVar];
372   Float_t fMin[fgkNcutVar];
373   Float_t fMax[fgkNcutVar];
374
375   static const Int_t fgkNcutVar2D = 1;
376   TH2F *fHist2D[fgkNcutVar2D];
377   Float_t fMinX[fgkNcutVar2D];
378   Float_t fMinY[fgkNcutVar2D];
379   Float_t fMaxX[fgkNcutVar2D];
380   Float_t fMaxY[fgkNcutVar2D];
381
382 public:
383   CascadeList(Reve::TrackRnrStyle* rs=0);
384   CascadeList(const Text_t* name, Reve::TrackRnrStyle* rs=0);
385
386   virtual const Text_t* GetTitle() const { return fTitle; }
387   virtual void SetTitle(const Text_t* t) { fTitle = t; }
388   virtual void SetTracksColor(Color_t cNeg, Color_t cPos, Color_t cBach)
389   { fNegColor = cNeg; fPosColor = cPos; fBachColor = cBach; }
390
391   virtual Bool_t CanEditMainColor()  { return kTRUE; }
392
393   virtual void Paint(Option_t* option="");
394
395   void  SetRnrStyle(Reve::TrackRnrStyle* rst) { fRnrStyle= rst; }
396   Reve::TrackRnrStyle* GetRnrStyle()          { return fRnrStyle; } 
397
398   Bool_t GetRnrCasVtx() const { return fRnrCasVtx; }
399   Bool_t GetRnrCasPath() const { return fRnrCasPath; }
400   Bool_t GetRnrV0vtx() const { return fRnrV0vtx; }
401   Bool_t GetRnrV0path() const { return fRnrV0path; }
402   Bool_t GetRnrV0Daughters() const { return fRnrV0Daughters; }
403   Bool_t GetRnrBachelor() const { return fRnrBach; }
404
405   void   SetRnrV0vtx(Bool_t);
406   void   SetRnrV0path(Bool_t);
407   void   SetRnrV0Daughters(Bool_t);
408   void   SetRnrBachelor(Bool_t);
409   void   SetRnrCasPath(Bool_t);
410   void   SetRnrCasVtx(Bool_t);
411   void   SetMin(Int_t i, Float_t val) {
412     if ((i>=0)&&(i<fgkNcutVar)) fMin[i]=val;}
413   void   SetMax(Int_t i, Float_t val) {
414     if ((i>=0)&&(i<fgkNcutVar)) fMax[i]=val;}
415
416   void   MakeCascades();
417
418   TH1F*   GetHist(Int_t i) {
419     if ((i>=0)&&(i<fgkNcutVar)) return fHist[i]; else return 0;}
420   TH2F*   GetHist2D(Int_t i) {
421     if ((i>=0)&&(i<fgkNcutVar2D)) return fHist2D[i]; else return 0;}
422   Float_t GetMin(Int_t i) {
423     if ((i>=0)&&(i<fgkNcutVar)) return fMin[i]; else return 0;}
424   Float_t GetMax(Int_t i) {
425     if ((i>=0)&&(i<fgkNcutVar)) return fMax[i]; else return 0;}
426   void GetCasIndexRange(Int_t &imin, Int_t &imax);
427
428   void AdjustHist(Int_t iHist);
429   void UnFill(Cascade* cas);
430   void Filter(Cascade* cas);
431   void FilterAll();
432
433   void XiMassFilter(Float_t min, Float_t max);
434   void OmegaMassFilter(Float_t min, Float_t max);
435   void IndexFilter(Float_t min, Float_t max);
436   void CosPointingFilter(Float_t min, Float_t max);
437   void BachV0DCAFilter(Float_t min, Float_t max);
438   void RadiusFilter(Float_t min, Float_t max);
439   void PtFilter(Float_t min, Float_t max);
440   void PseudoRapFilter(Float_t min, Float_t max);
441   void NegPtFilter(Float_t min, Float_t max);
442   void NegEtaFilter(Float_t min, Float_t max);
443   void PosPtFilter(Float_t min, Float_t max);
444   void PosEtaFilter(Float_t min, Float_t max);
445   void BachPtFilter(Float_t min, Float_t max);
446   void BachEtaFilter(Float_t min, Float_t max);
447
448   //--------------------------------
449
450   ClassDef(CascadeList, 1); // A list of Cascade objects.
451 };
452
453 } // namespace Alieve
454
455 #endif