]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/blacklisted-classes/AliEveV0.h
Add a protection against empty chambers
[u/mrichter/AliRoot.git] / EVE / EveDet / blacklisted-classes / AliEveV0.h
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9 #ifndef ALIEVE_V0_H
10 #define ALIEVE_V0_H
11
12 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
13  * See cxx source for full Copyright notice                               */
14
15
16 /***********************************************************************
17 * This code defines the reconstructed v0 visualized with EVE
18 *
19 * Ludovic Gaudichet (gaudichet@to.infn.it)
20 ************************************************************************/
21
22 #include <TEveVSDStructs.h>
23 #include <TEveElement.h>
24 #include <TEveTrack.h>
25
26 #include <TPolyMarker3D.h>
27 #include <TPolyLine3D.h>
28
29 class TH1F;
30 class TH2F;
31
32
33 class V0List;
34
35 class AliEveV0 : public TEveElement,
36            public TPolyMarker3D
37 {
38   friend class V0List;
39
40   AliEveV0(const AliEveV0&);            // Not implemented
41   AliEveV0& operator=(const AliEveV0&); // Not implemented
42
43 public:
44   AliEveV0();
45   AliEveV0(TEveRecTrack* tNeg, TEveRecTrack* tPos, TEveRecV0* v0,
46      TEveTrackPropagator* rs);
47   virtual ~AliEveV0();
48
49   typedef std::vector<TEvePathMark*>           vpPathMark_t;
50   typedef std::vector<TEvePathMark*>::iterator vpPathMark_i;
51   void  AddPathMarkPos(TEvePathMark* pm) { fPathMarksPos.push_back(pm); }
52   void  AddPathMarkNeg(TEvePathMark* pm) { fPathMarksNeg.push_back(pm); }
53
54   void Reset(TPolyLine3D* polyLine);
55
56   void MakeTrack(vpPathMark_t& pathMark, TEveVector& vtx,  TEveVector& p,
57                  Int_t charge, Float_t beta, TPolyLine3D& polyLine);
58
59   void MakeV0path();
60   void MakeV0();
61
62   virtual void PaintDaughters(Option_t* option="") {
63     if(fRnrSelf) {fPolyLineNeg.Paint(option);fPolyLinePos.Paint(option);} }
64   virtual void Paint(Option_t* option="") {
65     if(fRnrSelf) TPolyMarker3D::Paint(option);}
66   virtual void PaintPath(Option_t* option="") {
67     if(fRnrSelf) fPolyLineV0.Paint(option);}
68
69   virtual void  SetMainColor(Color_t col) {
70     fMarkerColor = col; fMainColorPtr = &fMarkerColor;
71     fPolyLineV0.SetLineColor(fMarkerColor);}
72   virtual void  SetTracksColor(Color_t cNeg, Color_t cPos) {
73     fPolyLineNeg.SetLineColor(cNeg); fPolyLinePos.SetLineColor(cPos); }
74   void          SetRnrStyle(TEveTrackPropagator* rs) { fRnrStyle = rs; }
75   void          SetESDIndex(Int_t ind) { fESDIndex = ind;}
76   void          SetDaughterDCA(Float_t dca);
77   void          SetCosPointingAngle(Float_t cos);
78   void          SetDecayLength(Float_t len);
79   void          SetDecayLength(Float_t primx, Float_t primy, Float_t primz);
80
81   Float_t GetDaughterDCA() const;
82   Float_t GetCosPointingAngle() const;
83   Float_t GetRadius() const;
84   Float_t GetDecayLength() const;
85
86   Float_t GetP2() const;
87   Float_t GetMomentum() const;
88   Float_t GetPt() const;
89   Float_t GetPt2() const;
90   Float_t GetPx() const;
91   Float_t GetPy() const;
92   Float_t GetPz() const;
93   Float_t GetPseudoRapidity() const;
94   Float_t GetAlphaArmenteros() const;
95   Float_t GetPtArmenteros() const;
96
97   Float_t GetK0sE() const {return 0;};
98   Float_t GetLamE() const {return 0;};
99   Float_t GetAntiLamE() const {return 0;};
100   Float_t GetK0mass() const;
101   Float_t GetLamMass() const;
102   Float_t GetAntiLamMass() const;
103
104   Float_t GetPionMinusE() const;
105   Float_t GetPionPlusE() const;
106   Float_t GetProtonE() const;
107   Float_t GetPBarE() const;
108
109   Float_t GetPosDCAtoPrim() const;
110   Float_t GetPosP2() const;
111   Float_t GetPosP() const;
112   Float_t GetPosPt() const;
113   Float_t GetPosPseudoRapidity() const;
114
115   Float_t GetNegDCAtoPrim() const;
116   Float_t GetNegP2() const;
117   Float_t GetNegP() const;
118   Float_t GetNegPt() const;
119   Float_t GetNegPseudoRapidity() const;
120   Int_t   GetESDIndex() const {return fESDIndex;};
121
122   virtual const Text_t* GetName() const    { return Form("ESDv0_%i",fESDIndex); }
123   virtual const Text_t* GetTitle() const   { return Form("ESDv0_%i",fESDIndex); }
124   Int_t          GetLabelPos() const { return fLabel_pos; }
125   Int_t          GetLabelNeg() const { return fLabel_neg; }
126   TEveTrackPropagator* GetPropagator() const  { return fRnrStyle; }
127   TPolyLine3D*   GetPolyLineNeg() {return &fPolyLineNeg;}
128   TPolyLine3D*   GetPolyLinePos() {return &fPolyLinePos;}
129   TPolyLine3D*   GetPolyLineV0() {return &fPolyLineV0;}
130
131 protected:
132
133   TEveVector fV_neg;       // Vertex of negative track
134   TEveVector fP_neg;       // Momentum of negative track
135   TEveVector fV_pos;       // Vertex of positive track
136   TEveVector fP_pos;       // Momentum of positive track
137
138   TEveVector fV_v0;        // Point of closest approach
139   TEveVector fV0_birth;    // Reconstucted birth point of neutral particle
140
141   Float_t           fBeta_neg;
142   Float_t           fBeta_pos;
143
144   Int_t             fLabel_neg;
145   Int_t             fLabel_pos;
146
147   vpPathMark_t         fPathMarksNeg;
148   vpPathMark_t         fPathMarksPos;
149   TEveTrackPropagator *fRnrStyle;
150
151   TPolyLine3D       fPolyLineNeg;
152   TPolyLine3D       fPolyLinePos;
153   TPolyLine3D       fPolyLineV0;
154
155   Int_t             fESDIndex;
156   Float_t           fDaughterDCA;
157   Float_t           fCosPointingAngle;
158   Float_t           fDecayLength;
159
160   static const Float_t fgkMassPion2;
161   static const Float_t fgkMassProton2;
162
163   ClassDef(AliEveV0, 1); // Visual representation of a AliEveV0.
164 }; // endclass AliEveV0
165
166
167 //______________________________________________________________________________
168 inline void AliEveV0::SetDaughterDCA(Float_t dca) {
169   fDaughterDCA = dca;
170 }
171
172 inline void AliEveV0::SetCosPointingAngle(Float_t cos) {
173   fCosPointingAngle = cos;
174 }
175
176 inline void AliEveV0::SetDecayLength(Float_t len) {
177   fDecayLength = len;
178 }
179
180
181 //______________________________________________________________________________
182 inline Float_t AliEveV0::GetPt2() const {
183   Float_t px = fP_neg.x+fP_pos.x, py = fP_neg.y+fP_pos.y;
184   return (px*px+py*py);
185 }
186
187 inline Float_t AliEveV0::GetP2() const {
188
189   Float_t px = fP_neg.x+fP_pos.x, py = fP_neg.y+fP_pos.y, pz = fP_neg.z+fP_pos.z;
190   return (px*px+py*py+pz*pz);
191 }
192
193 inline Float_t AliEveV0::GetPt() const {
194   return sqrt(GetPt2());
195 }
196
197 inline Float_t AliEveV0::GetMomentum() const {
198   return sqrt(GetP2());
199 }
200
201 inline Float_t AliEveV0::GetPx() const {
202   return (fP_neg.x+fP_pos.x);
203 }
204
205 inline Float_t AliEveV0::GetPy() const {
206   return (fP_neg.y+fP_pos.y);
207 }
208
209 inline Float_t AliEveV0::GetPz() const {
210   return (fP_neg.z+fP_pos.z);
211 }
212
213 //______________________________________________________________________________
214
215 inline Float_t AliEveV0::GetDaughterDCA() const {
216   return fDaughterDCA;
217 }
218
219 inline Float_t AliEveV0::GetCosPointingAngle() const {
220 return fCosPointingAngle;
221 }
222
223 inline Float_t AliEveV0::GetRadius() const {
224   return sqrt(fV_v0.x*fV_v0.x + fV_v0.y*fV_v0.y);
225 }
226
227 inline Float_t AliEveV0::GetDecayLength() const {
228 return fDecayLength;
229 }
230
231 inline Float_t AliEveV0::GetPseudoRapidity() const {
232   Float_t theta = acos( GetPz()/GetMomentum() );
233   return ( -log(tan(theta/2.)) );
234 }
235
236 //______________________________________________________________________________
237
238 inline Float_t AliEveV0::GetPionMinusE() const {
239   return sqrt(fgkMassPion2+GetNegP2());
240 }
241
242 inline Float_t AliEveV0::GetPionPlusE() const {
243   return sqrt(fgkMassPion2+GetPosP2());
244 }
245 inline Float_t AliEveV0::GetProtonE() const {
246   return sqrt(fgkMassProton2+GetPosP2());
247
248 }
249 inline Float_t AliEveV0::GetPBarE() const {
250   return sqrt(fgkMassProton2+GetNegP2());
251 }
252
253 //______________________________________________________________________________
254
255 inline Float_t AliEveV0::GetPosP2() const {
256   return (fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y + fP_pos.z*fP_pos.z);
257 }
258
259 inline Float_t AliEveV0::GetPosP() const {
260   return sqrt(GetPosP2());
261 }
262
263 inline Float_t AliEveV0::GetPosPt() const {
264   return sqrt(fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y);
265 }
266
267 inline Float_t AliEveV0::GetPosPseudoRapidity() const {
268   Float_t theta = acos( fP_pos.z/GetPosP() );
269   return ( -log(tan(theta/2.)) );
270 }
271
272 inline Float_t AliEveV0::GetPosDCAtoPrim() const {
273   return 0;
274 }
275
276 //______________________________________________________________________________
277 inline Float_t AliEveV0::GetNegP2() const {
278   return (fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y + fP_neg.z*fP_neg.z);
279 }
280
281 inline Float_t AliEveV0::GetNegP() const {
282   return sqrt(GetNegP2());
283 }
284
285 inline Float_t AliEveV0::GetNegPt() const {
286   return sqrt(fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y);
287 }
288
289 inline Float_t AliEveV0::GetNegPseudoRapidity() const {
290   Float_t theta = acos( fP_neg.z/GetNegP() );
291   return ( -log(tan(theta/2.)) );
292 }
293
294 inline Float_t AliEveV0::GetNegDCAtoPrim() const {
295   return 0;
296 }
297
298 //______________________________________________________________________________
299
300 inline Float_t AliEveV0::GetK0mass() const {
301   Float_t energy = GetPionMinusE() + GetPionPlusE();
302   return sqrt( energy*energy - GetP2() );
303 }
304
305 inline Float_t AliEveV0::GetLamMass() const {
306   Float_t energy = GetPionMinusE() + GetProtonE();
307   return sqrt( energy*energy - GetP2() );
308 }
309
310 inline Float_t AliEveV0::GetAntiLamMass() const {
311   Float_t energy = GetPionPlusE() + GetPBarE();
312   return sqrt( energy*energy - GetP2() );
313 }
314
315
316
317 /******************************************************************************/
318 // V0List
319 /******************************************************************************/
320
321 class V0List : public TEveElementList
322 {
323   V0List(const V0List&);            // Not implemented
324   V0List& operator=(const V0List&); // Not implemented
325
326 public:
327   V0List();
328   V0List(TEveTrackPropagator* rs);
329   V0List(const Text_t* name, TEveTrackPropagator* rs=0);
330   virtual ~V0List();
331
332   virtual const Text_t* GetTitle() const { return fTitle; }
333   virtual void SetTitle(const Text_t* t) { fTitle = t; }
334   virtual void SetTracksColor(Color_t cNeg, Color_t cPos) {
335     fNegColor = cNeg; fPosColor = cPos;}
336
337   virtual Bool_t CanEditMainColor()  { return kTRUE; }
338
339   virtual void Paint(Option_t* option="");
340
341   void  SetRnrStyle(TEveTrackPropagator* rst) { fRnrStyle= rst; }
342   TEveTrackPropagator* GetPropagator()          { return fRnrStyle; }
343
344   Bool_t GetRnrV0vtx() const { return fRnrV0vtx; }
345   Bool_t GetRnrV0path() const { return fRnrV0path; }
346   Bool_t GetRnrDaughters() const { return fRnrDaughters; }
347
348   void   SetRnrV0vtx(Bool_t);
349   void   SetRnrV0path(Bool_t);
350   void   SetRnrDaughters(Bool_t);
351   void   SetMin(Int_t i, Float_t val) {
352     if ((i>=0)&&(i<fgkNcutVar)) fMin[i]=val;}
353   void   SetMax(Int_t i, Float_t val) {
354     if ((i>=0)&&(i<fgkNcutVar)) fMax[i]=val;}
355
356   void   MakeV0s();
357   void   MakeMarkers();
358
359   TH1F*   GetHist(Int_t i) {
360     if ((i>=0)&&(i<fgkNcutVar)) return fHist[i]; else return 0;}
361   TH2F*   GetHist2D(Int_t i) {
362     if ((i>=0)&&(i<fgkNcutVar2D)) return fHist2D[i]; else return 0;}
363   Float_t GetMin(Int_t i) {
364     if ((i>=0)&&(i<fgkNcutVar)) return fMin[i]; else return 0;}
365   Float_t GetMax(Int_t i) {
366     if ((i>=0)&&(i<fgkNcutVar)) return fMax[i]; else return 0;}
367   void GetV0IndexRange(Int_t &imin, Int_t &imax);
368
369   Float_t GetMaxR()         const { return fRnrStyle->fMaxZ; }
370   Float_t GetMaxZ()         const { return fRnrStyle->fMaxR; }
371   Float_t GetMaxOrbs()      const { return fRnrStyle->fMaxOrbs; }
372   Float_t GetMinAng()       const { return fRnrStyle->fMinAng; }
373   Float_t GetDelta()        const { return fRnrStyle->fDelta; }
374   Bool_t  GetFitDaughters() const { return fRnrStyle->fFitDaughters; }
375   Bool_t  GetFitDecay()     const { return fRnrStyle->fFitDecay; }
376
377   void AdjustHist(Int_t iHist);
378   void UnFill(AliEveV0* v0);
379   void Filter(AliEveV0* v0);
380   void FilterAll();
381   void PtFilter(Float_t min, Float_t max);
382
383   void K0sMFilter(Float_t min, Float_t max);
384   void LamMFilter(Float_t min, Float_t max);
385   void ALamMFilter(Float_t min, Float_t max);
386   void CosPointingFilter(Float_t min, Float_t max);
387   void DaughterDCAFilter(Float_t min, Float_t max);
388   void RadiusFilter(Float_t min, Float_t max);
389   void EtaFilter(Float_t min, Float_t max);
390   void NegPtFilter(Float_t min, Float_t max);
391   void NegEtaFilter(Float_t min, Float_t max);
392   void PosPtFilter(Float_t min, Float_t max);
393   void PosEtaFilter(Float_t min, Float_t max);
394   void IndexFilter(Float_t min, Float_t max);
395
396
397 private:
398   void  Init();
399
400 protected:
401   TString              fTitle;
402
403   TEveTrackPropagator *fRnrStyle;
404
405   Bool_t               fRnrDaughters;
406   Bool_t               fRnrV0vtx;
407   Bool_t               fRnrV0path;
408
409   Color_t              fNegColor;
410   Color_t              fPosColor;
411
412   static const Int_t fgkNcutVar = 13;
413   TH1F *fHist[fgkNcutVar];
414   Float_t fMin[fgkNcutVar];
415   Float_t fMax[fgkNcutVar];
416
417   static const Int_t fgkNcutVar2D = 1;
418   TH2F *fHist2D[fgkNcutVar2D];
419   Float_t fMinX[fgkNcutVar2D];
420   Float_t fMinY[fgkNcutVar2D];
421   Float_t fMaxX[fgkNcutVar2D];
422   Float_t fMaxY[fgkNcutVar2D];
423
424   ClassDef(V0List, 1); // A list of AliEveV0 objecs.
425 };
426
427
428 #endif