]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveBase/AliEveHF.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[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;
9772b83b 170 break;
f8d5a389 171 case 1:
fa3634bd 172 fProngMaxProbPdg[ip] = -13;
9772b83b 173 break;
f8d5a389 174 case 2:
fa3634bd 175 fProngMaxProbPdg[ip] = 211;
9772b83b 176 break;
f8d5a389 177 case 3:
fa3634bd 178 fProngMaxProbPdg[ip] = 321;
9772b83b 179 break;
f8d5a389 180 case 4:
fa3634bd 181 fProngMaxProbPdg[ip] = 2212;
9772b83b 182 break;
fa3634bd 183 }
184 }
f8d5a389 185
fa3634bd 186}
187
188//________________________________________________________________________________________
189void AliEveHF::CalculateInvMass(Int_t decay)
190{
12cc265f 191
192 //Method to calculate the invariant mass of the particle and the antiparticle.
fa3634bd 193 UInt_t pdg2[2];
194 Double_t mPDG,minv;
f8d5a389 195
196 switch (decay)
197 {
fa3634bd 198 case 0: // D0->Kpi
199 pdg2[0]=211; pdg2[1]=321;
200 mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass();
201 minv = fAODobj->InvMass(fnProng,pdg2);
202 fInvariantMassPart=minv;
f8d5a389 203
fa3634bd 204 pdg2[0]=321; pdg2[1]=211;
205 minv = fAODobj->InvMass(fnProng,pdg2);
206 fInvariantMassAntiPart=minv;
207 break;
208 }
f8d5a389 209
fa3634bd 210}
211
212//______________________________________________________________________________
213Bool_t AliEveHF::SelectInvMass(Int_t decay, Float_t decayCuts)
214{
12cc265f 215
216 //Member fuction to select particles using the invariant mass cuts.
fa3634bd 217 UInt_t pdg2[2];
218 Double_t mPDG,minv;
f8d5a389 219
fa3634bd 220 Bool_t retval=kFALSE;
f8d5a389 221 switch (decay)
222 {
fa3634bd 223 case 0: // D0->Kpi
224 pdg2[0]=211; pdg2[1]=321;
225 mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass();
226 minv = fAODobj->InvMass(fnProng,pdg2);
227 fInvariantMassPart=minv;
228 if(TMath::Abs(minv-mPDG)<decayCuts) retval=kTRUE;
229 pdg2[0]=321; pdg2[1]=211;
230 minv = fAODobj->InvMass(fnProng,pdg2);
231 fInvariantMassAntiPart=minv;
232 if(TMath::Abs(minv-mPDG)<decayCuts) retval=kTRUE;
233 break;
234 }
235 return retval;
236
237}
238
239
240//______________________________________________________________________________
241void AliEveHF::MakeHF()
242{
243 // Set all dependant components for drawing.
244
245 SetPoint(0, fRecDecayHF.fX, fRecDecayHF.fY, fRecDecayHF.fZ);
246
247 fNegTrack->MakeTrack();
248 fPosTrack->MakeTrack();
249
250 fPointingLine->SetPoint(0, fRecBirthHF.fX, fRecBirthHF.fY, fRecBirthHF.fZ);
251 fPointingLine->SetPoint(1, fRecDecayHF.fX, fRecDecayHF.fY, fRecDecayHF.fZ);
252}
253
254/***********************************************************************
255*
256* AliEveHFList class
257*
258************************************************************************/
259
260ClassImp(AliEveHFList)
261
262//______________________________________________________________________________
263AliEveHFList::AliEveHFList() :
264 TEveElementList(),
265 fTitle(),
266 fRnrStyle(0),
267 fRnrDaughters(kTRUE),
268 fRnrHFvtx(kTRUE),
269 fRnrHFpath(kTRUE),
270 fProngColor(0),
271 fMinRCut(0),
272 fMaxRCut(250),
273 fMinDaughterDCA(0),
274 fMaxDaughterDCA(1),
275 fMinPt(0),
276 fMaxPt(20),
277 fMinCosPointingAngle(0),
278 fMaxCosPointingAngle(1),
279 fMind0(-3),
280 fMaxd0(3),
281 fProngCheckedPid(0x0),
282 fProngCheckedProb(0x0),
283 fDeltaInvariantMass(0),
284 fDecay(0)
285{
286 // Default constructor.
287
288 fChildClass = AliEveHF::Class(); // override member from base TEveElementList
289}
290
291//______________________________________________________________________________
292AliEveHFList::AliEveHFList(TEveTrackPropagator* rs) :
293 TEveElementList(),
294 fTitle(),
295 fRnrStyle(rs),
296 fRnrDaughters(kTRUE),
297 fRnrHFvtx(kTRUE),
298 fRnrHFpath(kTRUE),
299 fProngColor(0),
300 fMinRCut(0),
301 fMaxRCut(250),
302 fMinDaughterDCA(0),
303 fMaxDaughterDCA(1),
304 fMinPt(0),
305 fMaxPt(20),
306 fMinCosPointingAngle(0),
307 fMaxCosPointingAngle(1),
308 fMind0(-3),
309 fMaxd0(3),
310 fProngCheckedPid(0x0),
311 fProngCheckedProb(0x0),
312 fDeltaInvariantMass(1),
313 fDecay(0)
314{
315 // Constructor with given track-propagator..
316
317 fChildClass = AliEveHF::Class(); // override member from base TEveElementList
318
319 Init();
320}
321
322//______________________________________________________________________________
323AliEveHFList::AliEveHFList(const Text_t* name, TEveTrackPropagator* rs) :
324 TEveElementList(),
325 fTitle(),
326 fRnrStyle(rs),
327 fRnrDaughters(kTRUE),
328 fRnrHFvtx(kTRUE),
329 fRnrHFpath(kTRUE),
330 fProngColor(0),
331 fMinRCut(0),
332 fMaxRCut(100),
333 fMinDaughterDCA(0),
334 fMaxDaughterDCA(1),
335 fMinPt(0),
336 fMaxPt(20),
337 fMinCosPointingAngle(0),
338 fMaxCosPointingAngle(1),
339 fMind0(-3),
340 fMaxd0(3),
341 fProngCheckedPid(0x0),
342 fProngCheckedProb(0x0),
343 fDeltaInvariantMass(1),
344 fDecay(0)
345{
346 // Standard constructor.
347
348 fChildClass = AliEveHF::Class(); // override member from base TEveElementList
349
350 Init();
351 SetName(name);
352}
353
354//______________________________________________________________________________
355void AliEveHFList::Init()
356{
357 // Initialize members needed for drawing operations.
358
359 if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
360}
361
362/******************************************************************************/
363
364//______________________________________________________________________________
365void AliEveHFList::MakeHFs()
366{
367 // Call MakeHF() for all elements.
368
369 for(List_i i=fChildren.begin(); i!=fChildren.end(); i++) {
370 ((AliEveHF*)(*i))->MakeHF();
371 }
372 gEve->Redraw3D();
373}
374
375/******************************************************************************/
376
377
378//______________________________________________________________________________
379void AliEveHFList::FilterByPt(Float_t minPt, Float_t maxPt)
380{
f8d5a389 381
12cc265f 382 //Select visibility of elements based on their Pt
fa3634bd 383
384 fMinPt = minPt;
385 fMaxPt = maxPt;
386
12cc265f 387 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
fa3634bd 388 {
389 AliEveHF *hf = (AliEveHF*) *i;
390 Float_t pt = hf->GetPt();
391 Bool_t show = ((pt >= fMinPt) && (pt <= fMaxPt));
392 hf->SetRnrState(show);
393 }
394 ElementChanged();
395 gEve->Redraw3D();
396}
397//______________________________________________________________________________
398void AliEveHFList::FilterByRadius(Float_t minR, Float_t maxR)
399{
400 // Select visibility of elements based on their axial radius.
401
402 fMinRCut = minR;
403 fMaxRCut = maxR;
404
12cc265f 405 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
fa3634bd 406 {
407 AliEveHF *hf = (AliEveHF*) *i;
408 Float_t rad = hf->GetRadius();
409 Bool_t show = rad >= fMinRCut && rad <= fMaxRCut;
410 hf->SetRnrState(show);
411 }
412 ElementChanged();
413 gEve->Redraw3D();
414}
415
416/******************************************************************************/
417
418
419//______________________________________________________________________________
420void AliEveHFList::FilterByCosPointingAngle(Float_t minCosPointingAngle, Float_t maxCosPointingAngle)
421{
12cc265f 422 // Select visibility of elements based on the HF cosine of the pointing angle
fa3634bd 423
424 fMinCosPointingAngle = minCosPointingAngle;
425 fMaxCosPointingAngle = maxCosPointingAngle;
426
427
12cc265f 428 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
fa3634bd 429 {
430 AliEveHF *hf = (AliEveHF*) *i;
431 Float_t cosPointingAngle = hf->GetCosPointingAngle();
432 Bool_t show = cosPointingAngle >= fMinCosPointingAngle && cosPointingAngle <= fMaxCosPointingAngle;
433 hf->SetRnrState(show);
f8d5a389 434
fa3634bd 435 ElementChanged();
436 gEve->Redraw3D();
437 }
438}
439//______________________________________________________________________________
440void AliEveHFList::FilterByd0(Float_t mind0, Float_t maxd0)
441{
12cc265f 442 // Select visibility of elements based on the HF impact parameter.
fa3634bd 443
444 fMind0 = mind0;
445 fMaxd0 = maxd0;
446
447 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
448 {
449 AliEveHF *hf = (AliEveHF*) *i;
450 Int_t nProng=(Int_t)hf->GetAODobj()->GetNProngs();
f8d5a389 451 for(Int_t ip = 1; ip < nProng; ++ip) {
fa3634bd 452 Double_t d0 = hf->Getd0Prong(ip);
453 Bool_t show = d0 >= fMind0 && d0 <= fMaxd0;
454 hf->SetRnrState(show);
455 }
456 ElementChanged();
457 gEve->Redraw3D();
458 }
459}
460
461
462 //______________________________________________________________________________
463void AliEveHFList::FilterByDCA(Float_t minDaughterDCA, Float_t maxDaughterDCA)
464{
465 // Select visibility of elements based on the DCA between daughters.
466
467 fMinDaughterDCA = minDaughterDCA;
468 fMaxDaughterDCA = maxDaughterDCA;
469
470 Double_t dca;
471 AliEveHF *hf();
f8d5a389 472
fa3634bd 473
474 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
475 {
476 AliEveHF* hf = (AliEveHF*) *i;
477 Int_t nProng=(Int_t)hf->GetAODobj()->GetNProngs();
f8d5a389 478 for(Int_t ip = 1; ip < nProng; ++ip) {
fa3634bd 479 dca = hf->GetProngDCA(ip);
480 Bool_t show = dca >= fMinDaughterDCA && dca <= fMaxDaughterDCA;
481 hf->SetRnrState(show);
f8d5a389 482 }
fa3634bd 483 }
484 ElementChanged();
485 gEve->Redraw3D();
486}
f8d5a389 487
fa3634bd 488/******************************************************************************/
489//______________________________________________________________________________
490/*void AliEveHFList::FilterByCheckedPidMinProb(Int_t rFlag,Int_t rDaughter, Int_t rPid, Float_t rProb)
491{
492
493 if (!rDaughter){
494 fNegCheckedPid = rPid;
495 fNegCheckedProb = rProb;
496 }
497 else {
498 fPosCheckedPid = rPid;
499 fPosCheckedProb = rProb;
500 }
501
502 // Select visibility of elements based on one of the V0 daughters PID
503 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
504 {
505 AliEveHF* hf = (AliEveHF*) *i;
506 Int_t pid = 0;
507 Float_t prob = 0.0;
508 Bool_t show = 0;
509 if (!rDaughter) {// Negative daughter checked
510 pid = hf->GetNegMaxProbPdg();
511 prob = hf->GetNegMaxProbPid();
f8d5a389 512 show = (pid == fNegCheckedPid && prob > fNegCheckedProb) || !rFlag ;
fa3634bd 513 }
514 else if (rDaughter) {// Positive daughter checked
515 pid = hf->GetPosMaxProbPdg();
516 prob = hf->GetPosMaxProbPid();
f8d5a389 517 show = (pid == fPosCheckedPid && prob > fPosCheckedProb) || !rFlag ;
fa3634bd 518 }
519 hf->SetRnrState(show);
520exit }
521 ElementChanged();
522 gEve->Redraw3D();
523 }*/
524
525//______________________________________________________________________________
526
527void AliEveHFList::FilterByInvariantMass(Int_t decay, Float_t deltaInvariantMass)
528{
529 // Select visibility of elements based on the HF invariant mass.
530
531 fDeltaInvariantMass = deltaInvariantMass;
532 fDecay = decay;
533
534 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
535 {
536 AliEveHF* hf = (AliEveHF*) *i;
537 Bool_t show = hf->SelectInvMass(decay, fDeltaInvariantMass);
538 // if (show) show = (invMass >= (fInvariantMass-fDeltaInvariantMass)) && (invMass <= (fInvariantMass+fDeltaInvariantMass));
539 hf->SetRnrState(show);
540 }
541 ElementChanged();
542 gEve->Redraw3D();
543}