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