]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveBase/AliEveHF.cxx
Remove obsolete comments about TTree::Refresh() not working.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveHF.cxx
CommitLineData
fa3634bd 1// $Id$
2// Main author: Davide Caffarri 2009
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * ee http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
9
10#include "AliEveHF.h"
11#include "AliAODRecoDecay.h"
12
13#include <TEveTrack.h>
14#include <TEveTrackPropagator.h>
15#include <TEveManager.h>
16
17#include <TPolyLine3D.h>
18#include <TPolyMarker3D.h>
19#include <TColor.h>
20
21#include <TDatabasePDG.h>
22#include <TParticlePDG.h>
23
24#include <vector>
25
26
27/***********************************************************************
28*
29* AliEveHF class
30*
31************************************************************************/
32
33
34ClassImp(AliEveHF)
35
36//______________________________________________________________________________
37AliEveHF::AliEveHF():
38 TEvePointSet(),
39
40 fAODobj(0x0),
41 fRecBirthHF(0,0,0),
f8d5a389 42 fRecDecayHF(0,0,0),
12cc265f 43 fRecDecayMomHF(0,0,0),
fa3634bd 44 fPointingAngleHF(0),
45
46 fNegTrack(0),
47 fPosTrack(0),
48 fRnrStyle(0),
49 fPointingLine(0),
f8d5a389 50
fa3634bd 51 fnProng(0),
52 fAODIndex(-1),
53 fChi2SecondVtx(-1),
f8d5a389 54
fa3634bd 55 fProngDCA(0x0),
56 fProngd0(0x0),
57 fProngMaxProbPdg(0x0),
58 fProngMaxProbPid(0x0),
59 fInvariantMassPart(0),
60 fInvariantMassAntiPart(0),
61 fDecay(0)
62
63{
64 // Default constructor.
65
66 // Override from TEveElement.
67 fPickable = kTRUE;
68 fMainColorPtr = &fMarkerColor;
69}
70
71//______________________________________________________________________________
12cc265f 72AliEveHF::AliEveHF(TEveRecTrack* tNeg, TEveRecTrack* tPos, Double_t primVtx[3], AliAODRecoDecay* aodObj, TEveTrackPropagator* rs) :
f8d5a389 73
fa3634bd 74 TEvePointSet(),
75
76 fAODobj(aodObj),
77 fRecBirthHF(primVtx[0], primVtx[1], primVtx[2]),
78 fRecDecayHF(aodObj->GetSecVtxX(), aodObj->GetSecVtxY(), aodObj->GetSecVtxZ()),
12cc265f 79 fRecDecayMomHF(aodObj->Px(),aodObj->Py(),aodObj->Pz()),
fa3634bd 80 fPointingAngleHF(aodObj->CosPointingAngle(primVtx)),
81
82 fNegTrack(new TEveTrack(tNeg, rs)),
83 fPosTrack(new TEveTrack(tPos, rs)),
84 fRnrStyle(rs),
85 fPointingLine(new TEveLine("Pointing line")),
f8d5a389 86
fa3634bd 87 fnProng(aodObj->GetNProngs()),
88 fAODIndex(-1),
89 fChi2SecondVtx(aodObj->GetReducedChi2()),
f8d5a389 90
fa3634bd 91 fProngDCA(0),
92 fProngd0(0),
93 fProngMaxProbPdg(0),
94 fProngMaxProbPid(0),
95 fInvariantMassPart(0),
96 fInvariantMassAntiPart(0),
97 fDecay(0)
98{
f8d5a389 99
fa3634bd 100 // Constructor with full HF specification.
101 // Override from TEveElement.
102 fPickable = kTRUE;
103 fMainColorPtr = &fMarkerColor;
104
105 fMarkerStyle = 2;
106 fMarkerColor = kSpring + 6;
107 fMarkerSize = 0.3;
108
109 fPointingLine->SetLineColor(fMarkerColor);
110 fPointingLine->SetLineWidth(2);
111 fPointingLine->IncDenyDestroy();
112 AddElement(fPointingLine);
113
114 fPosTrack->SetLineColor(2); // red
115 fPosTrack->SetStdTitle();
116 fNegTrack->SetLineColor(7); // light blue
117 fNegTrack->SetStdTitle();
118
119 fNegTrack->IncDenyDestroy();
120 AddElement(fNegTrack);
121 fPosTrack->IncDenyDestroy();
122 AddElement(fPosTrack);
123}
124
125//______________________________________________________________________________
126AliEveHF::~AliEveHF()
127{
128 // Destructor. Dereferences pos/neg tracks and pointing-line objects.
129
130 fNegTrack->DecDenyDestroy();
131 fPosTrack->DecDenyDestroy();
132 fPointingLine->DecDenyDestroy();
133}
134
135//_____________________________________________________________________________
136void AliEveHF::SetProngDCA() const
f8d5a389 137{
fa3634bd 138 for(Int_t ip=0; ip<fnProng; ip++)
139 fProngDCA[ip] = fAODobj->GetDCA(ip);
140}
141
142//______________________________________________________________________________
143void AliEveHF::Setd0Prong() const
f8d5a389 144{
fa3634bd 145 for(Int_t ip=0; ip<fnProng; ip++)
146 fProngd0[ip] = fAODobj->Getd0Prong(ip);
147}
148
149
150//______________________________________________________________________________
151void AliEveHF::SetMaxProbPdgPid()
152{
153 // Sets the maximum probability Pdg value and Pid for one daughter
154 // Should be moved to TEveTrack property eventually (or AliEveTrack creation)
155 Double_t pid[5];
156 Int_t pos = -1;
f8d5a389 157
fa3634bd 158 for (Int_t ip=0; ip<fnProng; ip++){
f8d5a389 159 fAODobj->GetPIDProng(ip, pid);
fa3634bd 160
12cc265f 161 fProngMaxProbPid[ip]=pid[0];
fa3634bd 162 for (Int_t pp=1; pp<5; pp++)
f8d5a389 163 if (pid[pp]>pid[pp-1]) {
fa3634bd 164 fProngMaxProbPid[ip]=pid[pp];
165 pos = pp;}
166 switch (pos)
f8d5a389 167 {
168 case 0:
fa3634bd 169 fProngMaxProbPdg[ip] = -11;
f8d5a389 170 case 1:
fa3634bd 171 fProngMaxProbPdg[ip] = -13;
f8d5a389 172 case 2:
fa3634bd 173 fProngMaxProbPdg[ip] = 211;
f8d5a389 174 case 3:
fa3634bd 175 fProngMaxProbPdg[ip] = 321;
f8d5a389 176 case 4:
fa3634bd 177 fProngMaxProbPdg[ip] = 2212;
178 }
179 }
f8d5a389 180
fa3634bd 181}
182
183//________________________________________________________________________________________
184void AliEveHF::CalculateInvMass(Int_t decay)
185{
12cc265f 186
187 //Method to calculate the invariant mass of the particle and the antiparticle.
fa3634bd 188 UInt_t pdg2[2];
189 Double_t mPDG,minv;
f8d5a389 190
191 switch (decay)
192 {
fa3634bd 193 case 0: // D0->Kpi
194 pdg2[0]=211; pdg2[1]=321;
195 mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass();
196 minv = fAODobj->InvMass(fnProng,pdg2);
197 fInvariantMassPart=minv;
f8d5a389 198
fa3634bd 199 pdg2[0]=321; pdg2[1]=211;
200 minv = fAODobj->InvMass(fnProng,pdg2);
201 fInvariantMassAntiPart=minv;
202 break;
203 }
f8d5a389 204
fa3634bd 205}
206
207//______________________________________________________________________________
208Bool_t AliEveHF::SelectInvMass(Int_t decay, Float_t decayCuts)
209{
12cc265f 210
211 //Member fuction to select particles using the invariant mass cuts.
fa3634bd 212 UInt_t pdg2[2];
213 Double_t mPDG,minv;
f8d5a389 214
fa3634bd 215 Bool_t retval=kFALSE;
f8d5a389 216 switch (decay)
217 {
fa3634bd 218 case 0: // D0->Kpi
219 pdg2[0]=211; pdg2[1]=321;
220 mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass();
221 minv = fAODobj->InvMass(fnProng,pdg2);
222 fInvariantMassPart=minv;
223 if(TMath::Abs(minv-mPDG)<decayCuts) retval=kTRUE;
224 pdg2[0]=321; pdg2[1]=211;
225 minv = fAODobj->InvMass(fnProng,pdg2);
226 fInvariantMassAntiPart=minv;
227 if(TMath::Abs(minv-mPDG)<decayCuts) retval=kTRUE;
228 break;
229 }
230 return retval;
231
232}
233
234
235//______________________________________________________________________________
236void AliEveHF::MakeHF()
237{
238 // Set all dependant components for drawing.
239
240 SetPoint(0, fRecDecayHF.fX, fRecDecayHF.fY, fRecDecayHF.fZ);
241
242 fNegTrack->MakeTrack();
243 fPosTrack->MakeTrack();
244
245 fPointingLine->SetPoint(0, fRecBirthHF.fX, fRecBirthHF.fY, fRecBirthHF.fZ);
246 fPointingLine->SetPoint(1, fRecDecayHF.fX, fRecDecayHF.fY, fRecDecayHF.fZ);
247}
248
249/***********************************************************************
250*
251* AliEveHFList class
252*
253************************************************************************/
254
255ClassImp(AliEveHFList)
256
257//______________________________________________________________________________
258AliEveHFList::AliEveHFList() :
259 TEveElementList(),
260 fTitle(),
261 fRnrStyle(0),
262 fRnrDaughters(kTRUE),
263 fRnrHFvtx(kTRUE),
264 fRnrHFpath(kTRUE),
265 fProngColor(0),
266 fMinRCut(0),
267 fMaxRCut(250),
268 fMinDaughterDCA(0),
269 fMaxDaughterDCA(1),
270 fMinPt(0),
271 fMaxPt(20),
272 fMinCosPointingAngle(0),
273 fMaxCosPointingAngle(1),
274 fMind0(-3),
275 fMaxd0(3),
276 fProngCheckedPid(0x0),
277 fProngCheckedProb(0x0),
278 fDeltaInvariantMass(0),
279 fDecay(0)
280{
281 // Default constructor.
282
283 fChildClass = AliEveHF::Class(); // override member from base TEveElementList
284}
285
286//______________________________________________________________________________
287AliEveHFList::AliEveHFList(TEveTrackPropagator* rs) :
288 TEveElementList(),
289 fTitle(),
290 fRnrStyle(rs),
291 fRnrDaughters(kTRUE),
292 fRnrHFvtx(kTRUE),
293 fRnrHFpath(kTRUE),
294 fProngColor(0),
295 fMinRCut(0),
296 fMaxRCut(250),
297 fMinDaughterDCA(0),
298 fMaxDaughterDCA(1),
299 fMinPt(0),
300 fMaxPt(20),
301 fMinCosPointingAngle(0),
302 fMaxCosPointingAngle(1),
303 fMind0(-3),
304 fMaxd0(3),
305 fProngCheckedPid(0x0),
306 fProngCheckedProb(0x0),
307 fDeltaInvariantMass(1),
308 fDecay(0)
309{
310 // Constructor with given track-propagator..
311
312 fChildClass = AliEveHF::Class(); // override member from base TEveElementList
313
314 Init();
315}
316
317//______________________________________________________________________________
318AliEveHFList::AliEveHFList(const Text_t* name, TEveTrackPropagator* rs) :
319 TEveElementList(),
320 fTitle(),
321 fRnrStyle(rs),
322 fRnrDaughters(kTRUE),
323 fRnrHFvtx(kTRUE),
324 fRnrHFpath(kTRUE),
325 fProngColor(0),
326 fMinRCut(0),
327 fMaxRCut(100),
328 fMinDaughterDCA(0),
329 fMaxDaughterDCA(1),
330 fMinPt(0),
331 fMaxPt(20),
332 fMinCosPointingAngle(0),
333 fMaxCosPointingAngle(1),
334 fMind0(-3),
335 fMaxd0(3),
336 fProngCheckedPid(0x0),
337 fProngCheckedProb(0x0),
338 fDeltaInvariantMass(1),
339 fDecay(0)
340{
341 // Standard constructor.
342
343 fChildClass = AliEveHF::Class(); // override member from base TEveElementList
344
345 Init();
346 SetName(name);
347}
348
349//______________________________________________________________________________
350void AliEveHFList::Init()
351{
352 // Initialize members needed for drawing operations.
353
354 if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
355}
356
357/******************************************************************************/
358
359//______________________________________________________________________________
360void AliEveHFList::MakeHFs()
361{
362 // Call MakeHF() for all elements.
363
364 for(List_i i=fChildren.begin(); i!=fChildren.end(); i++) {
365 ((AliEveHF*)(*i))->MakeHF();
366 }
367 gEve->Redraw3D();
368}
369
370/******************************************************************************/
371
372
373//______________________________________________________________________________
374void AliEveHFList::FilterByPt(Float_t minPt, Float_t maxPt)
375{
f8d5a389 376
12cc265f 377 //Select visibility of elements based on their Pt
fa3634bd 378
379 fMinPt = minPt;
380 fMaxPt = maxPt;
381
12cc265f 382 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
fa3634bd 383 {
384 AliEveHF *hf = (AliEveHF*) *i;
385 Float_t pt = hf->GetPt();
386 Bool_t show = ((pt >= fMinPt) && (pt <= fMaxPt));
387 hf->SetRnrState(show);
388 }
389 ElementChanged();
390 gEve->Redraw3D();
391}
392//______________________________________________________________________________
393void AliEveHFList::FilterByRadius(Float_t minR, Float_t maxR)
394{
395 // Select visibility of elements based on their axial radius.
396
397 fMinRCut = minR;
398 fMaxRCut = maxR;
399
12cc265f 400 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
fa3634bd 401 {
402 AliEveHF *hf = (AliEveHF*) *i;
403 Float_t rad = hf->GetRadius();
404 Bool_t show = rad >= fMinRCut && rad <= fMaxRCut;
405 hf->SetRnrState(show);
406 }
407 ElementChanged();
408 gEve->Redraw3D();
409}
410
411/******************************************************************************/
412
413
414//______________________________________________________________________________
415void AliEveHFList::FilterByCosPointingAngle(Float_t minCosPointingAngle, Float_t maxCosPointingAngle)
416{
12cc265f 417 // Select visibility of elements based on the HF cosine of the pointing angle
fa3634bd 418
419 fMinCosPointingAngle = minCosPointingAngle;
420 fMaxCosPointingAngle = maxCosPointingAngle;
421
422
12cc265f 423 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
fa3634bd 424 {
425 AliEveHF *hf = (AliEveHF*) *i;
426 Float_t cosPointingAngle = hf->GetCosPointingAngle();
427 Bool_t show = cosPointingAngle >= fMinCosPointingAngle && cosPointingAngle <= fMaxCosPointingAngle;
428 hf->SetRnrState(show);
f8d5a389 429
fa3634bd 430 ElementChanged();
431 gEve->Redraw3D();
432 }
433}
434//______________________________________________________________________________
435void AliEveHFList::FilterByd0(Float_t mind0, Float_t maxd0)
436{
12cc265f 437 // Select visibility of elements based on the HF impact parameter.
fa3634bd 438
439 fMind0 = mind0;
440 fMaxd0 = maxd0;
441
442 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
443 {
444 AliEveHF *hf = (AliEveHF*) *i;
445 Int_t nProng=(Int_t)hf->GetAODobj()->GetNProngs();
f8d5a389 446 for(Int_t ip = 1; ip < nProng; ++ip) {
fa3634bd 447 Double_t d0 = hf->Getd0Prong(ip);
448 Bool_t show = d0 >= fMind0 && d0 <= fMaxd0;
449 hf->SetRnrState(show);
450 }
451 ElementChanged();
452 gEve->Redraw3D();
453 }
454}
455
456
457 //______________________________________________________________________________
458void AliEveHFList::FilterByDCA(Float_t minDaughterDCA, Float_t maxDaughterDCA)
459{
460 // Select visibility of elements based on the DCA between daughters.
461
462 fMinDaughterDCA = minDaughterDCA;
463 fMaxDaughterDCA = maxDaughterDCA;
464
465 Double_t dca;
466 AliEveHF *hf();
f8d5a389 467
fa3634bd 468
469 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
470 {
471 AliEveHF* hf = (AliEveHF*) *i;
472 Int_t nProng=(Int_t)hf->GetAODobj()->GetNProngs();
f8d5a389 473 for(Int_t ip = 1; ip < nProng; ++ip) {
fa3634bd 474 dca = hf->GetProngDCA(ip);
475 Bool_t show = dca >= fMinDaughterDCA && dca <= fMaxDaughterDCA;
476 hf->SetRnrState(show);
f8d5a389 477 }
fa3634bd 478 }
479 ElementChanged();
480 gEve->Redraw3D();
481}
f8d5a389 482
fa3634bd 483/******************************************************************************/
484//______________________________________________________________________________
485/*void AliEveHFList::FilterByCheckedPidMinProb(Int_t rFlag,Int_t rDaughter, Int_t rPid, Float_t rProb)
486{
487
488 if (!rDaughter){
489 fNegCheckedPid = rPid;
490 fNegCheckedProb = rProb;
491 }
492 else {
493 fPosCheckedPid = rPid;
494 fPosCheckedProb = rProb;
495 }
496
497 // Select visibility of elements based on one of the V0 daughters PID
498 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
499 {
500 AliEveHF* hf = (AliEveHF*) *i;
501 Int_t pid = 0;
502 Float_t prob = 0.0;
503 Bool_t show = 0;
504 if (!rDaughter) {// Negative daughter checked
505 pid = hf->GetNegMaxProbPdg();
506 prob = hf->GetNegMaxProbPid();
f8d5a389 507 show = (pid == fNegCheckedPid && prob > fNegCheckedProb) || !rFlag ;
fa3634bd 508 }
509 else if (rDaughter) {// Positive daughter checked
510 pid = hf->GetPosMaxProbPdg();
511 prob = hf->GetPosMaxProbPid();
f8d5a389 512 show = (pid == fPosCheckedPid && prob > fPosCheckedProb) || !rFlag ;
fa3634bd 513 }
514 hf->SetRnrState(show);
515exit }
516 ElementChanged();
517 gEve->Redraw3D();
518 }*/
519
520//______________________________________________________________________________
521
522void AliEveHFList::FilterByInvariantMass(Int_t decay, Float_t deltaInvariantMass)
523{
524 // Select visibility of elements based on the HF invariant mass.
525
526 fDeltaInvariantMass = deltaInvariantMass;
527 fDecay = decay;
528
529 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
530 {
531 AliEveHF* hf = (AliEveHF*) *i;
532 Bool_t show = hf->SelectInvMass(decay, fDeltaInvariantMass);
533 // if (show) show = (invMass >= (fInvariantMass-fDeltaInvariantMass)) && (invMass <= (fInvariantMass+fDeltaInvariantMass));
534 hf->SetRnrState(show);
535 }
536 ElementChanged();
537 gEve->Redraw3D();
538}