]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveCascade.cxx
From Stefano:
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveCascade.cxx
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
10 //------------------------------------------------------------------------
11 //
12 // AliEveCascade class
13 //
14 //------------------------------------------------------------------------
15
16 //#include <TPolyLine3D.h>
17 //#include <TColor.h>
18
19 //#include <vector>
20
21 #include <TDatabasePDG.h>
22 #include <TEveTrackPropagator.h>
23 #include <TEveManager.h>
24
25 #include "AliEveCascade.h"
26
27
28
29
30 ClassImp(AliEveCascade)
31
32 //______________________________________________________________________________
33 AliEveCascade::AliEveCascade() :
34   TEvePointSet(),
35
36   fRecBirthV(),
37   fRecDecayV(),
38   fRecDecayP(),
39   fRecDecayV0(),
40   fBacTrack(0),
41   fNegTrack(0),
42   fPosTrack(0),
43   fRnrStyle(0),
44   fPointingCurve(0),
45   fV0Path(0),
46   fESDIndex(-1),
47   fDaughterDCA(999),
48   fChi2Cascade(-1),
49   fLambdaP(0.,0.,0.),
50   fBachP(0.,0.,0.)
51 {
52   // Default constructor.
53
54   // Override from TEveElement.
55   fPickable = kTRUE;
56   fMainColorPtr = &fMarkerColor;
57 }
58
59 //______________________________________________________________________________
60 AliEveCascade::AliEveCascade(TEveRecTrack* tBac, TEveRecTrack* tNeg, TEveRecTrack* tPos, TEveRecV0* v0, TEveRecCascade* cascade, TEveTrackPropagator* rs) :
61   TEvePointSet(),
62
63   fRecBirthV(cascade->fCascadeBirth),
64   fRecDecayV(cascade->fCascadeVCa),
65   fRecDecayP(cascade->fPBac + v0->fPNeg + v0->fPPos),
66   fRecDecayV0(v0->fVCa),
67   fBacTrack(new AliEveTrack(tBac, rs)),
68   fNegTrack(new AliEveTrack(tNeg, rs)),
69   fPosTrack(new AliEveTrack(tPos, rs)),
70   
71
72   fRnrStyle(rs),
73   fPointingCurve(new TEveLine("Pointing Curve")),
74   fV0Path(new TEveLine("V0 Path")),
75   fESDIndex(-1),
76   fDaughterDCA(999), // DCA between Xi daughters is properly set in esd_make_cascade via the setter
77   fChi2Cascade(-1),
78   fLambdaP(0.,0.,0.), // Momemtum of Lambda is properly set in esd_make_cascade via the setter
79   fBachP(0.,0.,0.)    // Momemtum of Lambda is properly set in esd_make_cascade via the setter
80 {
81   // Constructor with full Cascade specification.
82
83   // Override from TEveElement.
84   fPickable = kTRUE;
85   fMainColorPtr = &fMarkerColor;
86
87   fMarkerStyle = 2;
88   fMarkerColor = kMagenta+2;
89   fMarkerSize  = 1;
90
91   fPointingCurve->SetTitle("Xi pointing curve");
92   fPointingCurve->SetLineColor(fMarkerColor);
93   fPointingCurve->SetLineStyle(9);
94   fPointingCurve->SetLineWidth(2);  
95   fPointingCurve->IncDenyDestroy();
96   AddElement(fPointingCurve);
97
98   fV0Path->SetTitle("V0 path");
99   fV0Path->SetLineColor(fMarkerColor);
100   fV0Path->SetLineStyle(3);
101   fV0Path->SetLineWidth(2);
102   fV0Path->IncDenyDestroy();
103   AddElement(fV0Path);
104
105   fBacTrack->SetLineColor(kMagenta);
106   fBacTrack->SetStdTitle();
107   fBacTrack->IncDenyDestroy();
108   AddElement(fBacTrack);
109   
110   fNegTrack->SetLineColor(kCyan+2);  // in V0 = kCyan
111   fNegTrack->SetStdTitle();
112   fNegTrack->IncDenyDestroy();
113   AddElement(fNegTrack);
114   
115   fPosTrack->SetLineColor(kRed+2);  // in Eve V0 = kRed
116   fPosTrack->SetStdTitle();
117   fPosTrack->IncDenyDestroy();
118   AddElement(fPosTrack);  
119 }
120
121 //______________________________________________________________________________
122 AliEveCascade::~AliEveCascade()
123 {
124   // Destructor. Dereferences bachelor track and pointing-line objects.
125
126   fBacTrack->DecDenyDestroy();
127   fNegTrack->DecDenyDestroy();
128   fPosTrack->DecDenyDestroy();
129   fPointingCurve->DecDenyDestroy();
130   fV0Path->DecDenyDestroy();
131 }
132
133 //______________________________________________________________________________
134 void AliEveCascade::MakeCascade()
135 {
136   // Set all dependant components for drawing.
137
138   SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
139
140   fBacTrack->MakeTrack();  
141   fNegTrack->MakeTrack();
142   fPosTrack->MakeTrack();
143
144   fPointingCurve->SetPoint(0, fRecBirthV.fX, fRecBirthV.fY, fRecBirthV.fZ);
145   fPointingCurve->SetPoint(1, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
146
147   fV0Path->SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
148   fV0Path->SetPoint(1, fRecDecayV0.fX, fRecDecayV0.fY, fRecDecayV0.fZ);
149 }
150
151
152
153 //______________________________________________________________________________
154 Double_t AliEveCascade::GetInvMass(Int_t cascadePdgCodeHyp) const
155 {
156   // Returns Invariant Mass assuming the masses of the daughter particles
157         TEveVector lBachMomentum = fBacTrack->GetMomentum();
158   // Does not work properly because momenta at the primary vertex for V0 daughters (same for AliEVEv0) + Bach
159         
160         Double_t lBachMass = 0.0;
161         if(cascadePdgCodeHyp == kXiMinus || cascadePdgCodeHyp == -kXiMinus )
162                 lBachMass = TDatabasePDG::Instance()->GetParticle("pi-")->Mass();
163         else if(cascadePdgCodeHyp == kOmegaMinus || cascadePdgCodeHyp == -kOmegaMinus )
164                 lBachMass = TDatabasePDG::Instance()->GetParticle("K-")->Mass();
165         
166         Double_t lLambdaMass = TDatabasePDG::Instance()->GetParticle("Lambda0")->Mass();
167         
168         printf("\n Cascade : check the mass of the bachelor (%.5f) - the Lambda (%.5f)\n",lBachMass, lLambdaMass);
169         
170         Double_t eBach   = TMath::Sqrt(lBachMass*lBachMass     + lBachMomentum.Mag2());
171         //Double_t eBach   = TMath::Sqrt(lBachMass  *lBachMass   + fBachP.Mag2());
172         Double_t eLambda = TMath::Sqrt(lLambdaMass*lLambdaMass + fLambdaP.Mag2());
173         
174         TVector3 lCascadeMom(fBachP + fLambdaP);
175         /*
176         printf("Ptot(Lambda) : %f GeV/c \n", fLambdaP.Mag());
177         printf("Ptot(Bach)   : %f GeV/c \n", lBachMomentum.Mag());
178         printf("Ptot(BachESD): %f GeV/c \n", fBachP.Mag());
179         printf("Ptot(Casc)   : %f GeV/c \n", fRecDecayP.Mag());
180         printf("Ptot(CascESD): %f GeV/c \n", lCascadeMom.Mag());
181         */
182         //return TMath::Sqrt( (eBach+eLambda)*(eBach+eLambda) - fRecDecayP.Mag2() );    // numerically instable ...
183         //return TMath::Sqrt( ((eBach+eLambda) - lCascadeMom.Mag()) * ((eBach+eLambda) + lCascadeMom.Mag()) );
184         return TMath::Sqrt( ((eBach+eLambda) - fRecDecayP.Mag()) * ((eBach+eLambda) + fRecDecayP.Mag()) );
185 }
186
187
188
189 //------------------------------------------------------------------------
190 //
191 // AliEveCascadeList class
192 //
193 //------------------------------------------------------------------------
194
195 ClassImp(AliEveCascadeList)
196
197 //______________________________________________________________________________
198 AliEveCascadeList::AliEveCascadeList() :
199   TEveElementList(),
200   fTitle(),
201   fRnrStyle(0),
202   fRnrDaughters(kTRUE),
203   fRnrCascadevtx(kTRUE),
204   fRnrCascadepath(kTRUE),
205   fBacColor(0),
206   fMinRCut(0),
207   fMaxRCut(250),
208   fMinDaughterDCA(0),
209   fMaxDaughterDCA(1),
210   fMinPt(0),
211   fMaxPt(20),
212   fInvMassHyp(kXiMinus),
213   fMinInvariantMass(1.0),
214   fMaxInvariantMass(6.0)
215 {
216   // Default constructor.
217
218   fChildClass = AliEveCascade::Class(); // override member from base TEveElementList
219 }
220
221 //______________________________________________________________________________
222 AliEveCascadeList::AliEveCascadeList(TEveTrackPropagator* rs) :
223   TEveElementList(),
224   fTitle(),
225   fRnrStyle(rs),
226   fRnrDaughters(kTRUE),
227   fRnrCascadevtx(kTRUE),
228   fRnrCascadepath(kTRUE),
229   fBacColor(0),
230   fMinRCut(0),
231   fMaxRCut(250),
232   fMinDaughterDCA(0),
233   fMaxDaughterDCA(1),
234   fMinPt(0),
235   fMaxPt(20),
236   fInvMassHyp(kXiMinus),
237   fMinInvariantMass(1.0),
238   fMaxInvariantMass(6.0)
239 {
240   // Constructor with given track-propagator..
241
242   fChildClass = AliEveCascade::Class(); // override member from base TEveElementList
243
244   Init();
245 }
246
247 //______________________________________________________________________________
248 AliEveCascadeList::AliEveCascadeList(const Text_t* name, TEveTrackPropagator* rs) :
249   TEveElementList(),
250   fTitle(),
251   fRnrStyle(rs),
252   fRnrDaughters(kTRUE),
253   fRnrCascadevtx(kTRUE),
254   fRnrCascadepath(kTRUE),
255   fBacColor(0),
256   fMinRCut(0),
257   fMaxRCut(100),
258   fMinDaughterDCA(0),
259   fMaxDaughterDCA(1),
260   fMinPt(0),
261   fMaxPt(20),
262   fInvMassHyp(kXiMinus),
263   fMinInvariantMass(1.0),
264   fMaxInvariantMass(6.0)
265 {
266   // Standard constructor.
267
268   fChildClass = AliEveCascade::Class(); // override member from base TEveElementList
269
270   Init();
271   SetName(name);
272 }
273
274 //______________________________________________________________________________
275 void AliEveCascadeList::Init()
276 {
277   // Initialize members needed for drawing operations.
278
279   if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
280 }
281
282 /******************************************************************************/
283
284 //______________________________________________________________________________
285 void AliEveCascadeList::MakeCascades()
286 {
287   // Call MakeCascade() for all elements.
288
289   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
290     ((AliEveCascade*)(*i))->MakeCascade();
291   }
292   gEve->Redraw3D();
293 }
294
295 /******************************************************************************/
296
297 //______________________________________________________________________________
298 void AliEveCascadeList::FilterByRadius(Float_t minR, Float_t maxR)
299 {
300   // Select visibility of elements based on their axial radius.
301
302   fMinRCut = minR;
303   fMaxRCut = maxR;
304
305   for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
306   {
307     AliEveCascade* cascade = (AliEveCascade*) *i;
308     Float_t  rad = cascade->GetRadius();
309     Bool_t  show = rad >= fMinRCut && rad <= fMaxRCut;
310     cascade->SetRnrState(show);
311   }
312   ElementChanged();
313   gEve->Redraw3D();
314 }
315
316 /******************************************************************************/
317
318 //______________________________________________________________________________
319 void AliEveCascadeList::FilterByDaughterDCA(Float_t minDaughterDCA, Float_t maxDaughterDCA)
320 {
321   // Select visibility of elements based on the DCA between daughters.
322
323   fMinDaughterDCA = minDaughterDCA;
324   fMaxDaughterDCA = maxDaughterDCA;
325
326   for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
327   {
328     AliEveCascade* cascade = (AliEveCascade*) *i;
329     Float_t  dca = cascade->GetDaughterDCA();
330     Bool_t  show = dca >= fMinDaughterDCA && dca <= fMaxDaughterDCA;
331     cascade->SetRnrState(show);
332   }
333   ElementChanged();
334   gEve->Redraw3D();
335 }
336
337 /******************************************************************************/
338
339 //______________________________________________________________________________
340 void AliEveCascadeList::FilterByPt(Float_t minPt, Float_t maxPt)
341 {
342   // Select visibility of elements based on the Cascade pt.
343
344   fMinPt = minPt;
345   fMaxPt = maxPt;
346
347   for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
348   {
349     AliEveCascade* cascade = (AliEveCascade*) *i;
350     Float_t  pt = cascade->GetPt();
351     Bool_t  show = pt >= fMinPt && pt <= fMaxPt;
352     cascade->SetRnrState(show);
353   }
354   ElementChanged();
355   gEve->Redraw3D();
356 }
357
358 /******************************************************************************/
359
360 //______________________________________________________________________________
361 void AliEveCascadeList::FilterByInvariantMass(Float_t minInvariantMass, Float_t maxInvariantMass, Int_t cascadePdgCodeHyp)
362 {
363   // Select visibility of elements based on the Cascade invariant mass.
364
365         fMinInvariantMass = minInvariantMass;
366         fMaxInvariantMass = maxInvariantMass;
367
368         for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
369         {
370                 AliEveCascade* cascade = (AliEveCascade*) *i;
371                 Float_t  invMass = (Float_t)cascade->GetInvMass(cascadePdgCodeHyp);
372                 Bool_t   show    = invMass >= fMinInvariantMass && invMass <= fMaxInvariantMass;
373                 cascade->SetRnrState(show);
374         }
375         ElementChanged();
376         gEve->Redraw3D();
377 }
378