2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 **************************************************************************/
12 #include <TEveTrackPropagator.h>
13 #include <TEveManager.h>
15 #include <TPolyLine3D.h>
18 #include <TDatabasePDG.h>
19 #include <TParticlePDG.h>
23 //______________________________________________________________________________
24 // Representation of a reconstructed V0.
28 //______________________________________________________________________________
29 AliEveV0::AliEveV0() :
48 // Default constructor.
50 // Override from TEveElement.
52 fMainColorPtr = &fMarkerColor;
55 //______________________________________________________________________________
56 AliEveV0::AliEveV0(TEveRecTrack* tNeg, TEveRecTrack* tPos,
57 TEveRecV0* v0, TEveTrackPropagator* rs) :
60 fRecBirthV(v0->fV0Birth),
62 fRecDecayP(v0->fPNeg + v0->fPPos),
64 fNegTrack(new AliEveTrack(tNeg, rs)),
65 fPosTrack(new AliEveTrack(tPos, rs)),
68 fPointingLine(new TEveLine("Pointing line")),
78 // Constructor with full V0 specification.
80 // Override from TEveElement.
82 fMainColorPtr = &fMarkerColor;
85 fMarkerColor = kSpring + 6;
88 fPointingLine->SetLineColor(fMarkerColor);
89 fPointingLine->SetLineWidth(2);
90 fPointingLine->IncDenyDestroy();
91 AddElement(fPointingLine);
93 fPosTrack->SetLineColor(2); // red
94 fPosTrack->SetStdTitle();
95 fNegTrack->SetLineColor(7); // light blue
96 fNegTrack->SetStdTitle();
98 fNegTrack->IncDenyDestroy();
99 AddElement(fNegTrack);
100 fPosTrack->IncDenyDestroy();
101 AddElement(fPosTrack);
104 //______________________________________________________________________________
105 AliEveV0::~AliEveV0()
107 // Destructor. Dereferences pos/neg tracks and pointing-line objects.
109 fNegTrack->DecDenyDestroy();
110 fPosTrack->DecDenyDestroy();
111 fPointingLine->DecDenyDestroy();
114 //______________________________________________________________________________
115 void AliEveV0::SetMaxProbPdgPid(Int_t iDaughter, Int_t rPdg, Float_t rPid)
117 // Sets the maximum probability Pdg value and Pid for one daughter
118 // Should be moved to AliEveTrack property eventually (or AliEveTrack creation)
121 fNegMaxProbPdg = rPdg;
122 fNegMaxProbPid = rPid;
124 else if (iDaughter==1){
125 fPosMaxProbPdg = rPdg;
126 fPosMaxProbPid = rPid;
130 //______________________________________________________________________________
131 Float_t AliEveV0::GetInvMass(Int_t nPdgCode, Int_t pPdgCode) const
133 // Returns Invariant Mass assuming the masses of the daughter particles
134 TEveVector lNegMomentum = fNegTrack->GetMomentum();
135 // Does not work properly because momenta at the primary vertex !!!!!!!
136 TEveVector lPosMomentum = fPosTrack->GetMomentum();
137 Double_t nMass=TDatabasePDG::Instance()->GetParticle(nPdgCode)->Mass();
138 Double_t pMass=TDatabasePDG::Instance()->GetParticle(pPdgCode)->Mass();
140 printf("\n check the mass of the particle negative %.5f positive %.5f \n",nMass,pMass);
142 Double_t eNeg = TMath::Sqrt(nMass*nMass + lNegMomentum.Mag2());
143 Double_t ePos = TMath::Sqrt(pMass*pMass + lPosMomentum.Mag2());
145 return TMath::Sqrt( (eNeg+ePos)*(eNeg+ePos) - fRecDecayP.Mag2() );
148 //______________________________________________________________________________
149 void AliEveV0::MakeV0()
151 // Set all dependant components for drawing.
153 SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
155 fNegTrack->MakeTrack();
156 fPosTrack->MakeTrack();
158 fPointingLine->SetPoint(0, fRecBirthV.fX, fRecBirthV.fY, fRecBirthV.fZ);
159 fPointingLine->SetPoint(1, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
163 //==============================================================================
164 //==============================================================================
166 //______________________________________________________________________________
168 // Container for AliEveV0s.
170 // Allows runtime selection by pT and DCA of daughters, radius of V0
171 // creation and PID priobabilities
173 ClassImp(AliEveV0List)
175 //______________________________________________________________________________
176 AliEveV0List::AliEveV0List() :
180 fRnrDaughters(kTRUE),
193 fNegCheckedProb(0.5),
194 fPosCheckedProb(0.5),
195 fMinInvariantMass(0),
196 fMaxInvariantMass(1.2)
198 // Default constructor.
200 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
203 //______________________________________________________________________________
204 AliEveV0List::AliEveV0List(TEveTrackPropagator* rs) :
208 fRnrDaughters(kTRUE),
221 fNegCheckedProb(0.5),
222 fPosCheckedProb(0.5),
223 fMinInvariantMass(0),
224 fMaxInvariantMass(1.2)
226 // Constructor with given track-propagator..
228 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
233 //______________________________________________________________________________
234 AliEveV0List::AliEveV0List(const Text_t* name, TEveTrackPropagator* rs) :
238 fRnrDaughters(kTRUE),
251 fNegCheckedProb(0.5),
252 fPosCheckedProb(0.5),
253 fMinInvariantMass(0),
254 fMaxInvariantMass(1.2)
256 // Standard constructor.
258 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
264 //______________________________________________________________________________
265 void AliEveV0List::Init()
267 // Initialize members needed for drawing operations.
269 if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
272 /******************************************************************************/
274 //______________________________________________________________________________
275 void AliEveV0List::MakeV0s()
277 // Call MakeV0() for all elements.
279 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
280 ((AliEveV0*)(*i))->MakeV0();
285 /******************************************************************************/
287 //______________________________________________________________________________
288 void AliEveV0List::FilterByRadius(Float_t minR, Float_t maxR)
290 // Select visibility of elements based on their axial radius.
295 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
297 AliEveV0* v0 = (AliEveV0*) *i;
298 Float_t rad = v0->GetRadius();
299 Bool_t show = rad >= fMinRCut && rad <= fMaxRCut;
300 v0->SetRnrState(show);
306 /******************************************************************************/
308 //______________________________________________________________________________
309 void AliEveV0List::FilterByDaughterDCA(Float_t minDaughterDCA, Float_t maxDaughterDCA)
311 // Select visibility of elements based on the DCA between daughters.
313 fMinDaughterDCA = minDaughterDCA;
314 fMaxDaughterDCA = maxDaughterDCA;
316 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
318 AliEveV0* v0 = (AliEveV0*) *i;
319 Float_t dca = v0->GetDaughterDCA();
320 Bool_t show = dca >= fMinDaughterDCA && dca <= fMaxDaughterDCA;
321 v0->SetRnrState(show);
327 /******************************************************************************/
329 //______________________________________________________________________________
330 void AliEveV0List::FilterByPt(Float_t minPt, Float_t maxPt)
332 // Select visibility of elements based on the V0 pt.
337 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
339 AliEveV0* v0 = (AliEveV0*) *i;
340 Float_t pt = v0->GetPt();
341 Bool_t show = pt >= fMinPt && pt <= fMaxPt;
342 v0->SetRnrState(show);
348 //______________________________________________________________________________
349 void AliEveV0List::FilterByCheckedPidMinProb(Int_t rFlag,Int_t rDaughter, Int_t rPid, Float_t rProb)
351 // Select visibility of elements based on one of the V0 daughters PID
354 fNegCheckedPid = rPid;
355 fNegCheckedProb = rProb;
358 fPosCheckedPid = rPid;
359 fPosCheckedProb = rProb;
362 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
364 AliEveV0* v0 = (AliEveV0*) *i;
368 if (!rDaughter) {// Negative daughter checked
369 pid = v0->GetNegMaxProbPdg();
370 prob = v0->GetNegMaxProbPid();
371 show = (pid == fNegCheckedPid && prob > fNegCheckedProb) || !rFlag ;
373 else if (rDaughter) {// Positive daughter checked
374 pid = v0->GetPosMaxProbPdg();
375 prob = v0->GetPosMaxProbPid();
376 show = (pid == fPosCheckedPid && prob > fPosCheckedProb) || !rFlag ;
378 v0->SetRnrState(show);
384 //______________________________________________________________________________
385 void AliEveV0List::FilterByInvariantMass(Float_t minInvariantMass, Float_t maxInvariantMass, Int_t nPdgCode, Int_t pPdgCode)
387 // Select visibility of elements based on the V0 invariant mass.
389 fMinInvariantMass = minInvariantMass;
390 fMaxInvariantMass = maxInvariantMass;
392 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
394 AliEveV0* v0 = (AliEveV0*) *i;
395 Float_t invMass = v0->GetInvMass(nPdgCode, pPdgCode);
396 Bool_t show = invMass >= fMinInvariantMass && invMass <= fMaxInvariantMass;
397 v0->SetRnrState(show);