]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnDaughter.h
fix for bug #70582 (change from L. Molnar)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnDaughter.h
CommitLineData
e2bafbbc 1//
06351446 2// Class AliRsnDaughter
3//
5eb970a4 4// Interface to candidate daughters of a resonance (tracks).
5// Points to the source of information, which is generally an AliVParticle-derived object
6// and contains few internal data-members to store "on fly" some important information
7// for the computations required during resonance analysis.
8// ---
9// Since the package revision, this object is not supposed to be stacked in memory
10// but created "on fly" during analysis and used just for computations, as an interface.
c37c6481 11//
e0baff8c 12// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
13// M. Vala (martin.vala@cern.ch)
e2bafbbc 14//
a62a2d82 15
16#ifndef ALIRSNDAUGHTER_H
17#define ALIRSNDAUGHTER_H
18
7c2974c8 19#include <TMath.h>
20
5eb970a4 21#include "AliPID.h"
7c2974c8 22#include "AliVParticle.h"
4fbb2459 23#include "AliESDtrack.h"
24#include "AliAODTrack.h"
25#include "AliMCParticle.h"
a62a2d82 26
2f769150 27class TParticle;
5eb970a4 28class AliStack;
4fbb2459 29class AliMCParticle;
30// class AliESDtrack;
31// class AliESDtrack;
32// class AliAODTrack;
5eb970a4 33class AliAODEvent;
7a3ae0d2 34class AliRsnPIDDefESD;
7c2974c8 35
5eb970a4 36class AliRsnDaughter : public TObject
a62a2d82 37{
06351446 38 public:
aec0ec32 39
4fbb2459 40 enum EPIDMethod {
aec0ec32 41 kNoPID = 0,
42 kRealistic,
aec0ec32 43 kPerfect,
44 kMethods
45 };
46
5eb970a4 47 AliRsnDaughter(AliVParticle *ref = 0, TParticle *refMC = 0);
aec0ec32 48 AliRsnDaughter(const AliRsnDaughter &copy);
7c2974c8 49 virtual ~AliRsnDaughter();
06351446 50 AliRsnDaughter& operator= (const AliRsnDaughter& copy);
7c2974c8 51
5eb970a4 52 // momentum
53 Double_t Px() const {return fRef->Px();}
54 Double_t Py() const {return fRef->Py();}
55 Double_t Pz() const {return fRef->Pz();}
56 Double_t Pt() const {return fRef->Pt();}
57 Double_t P2() const {return Pt()*Pt() + Pz()*Pz();}
58 Double_t P() const {return TMath::Sqrt(P2());}
59 Double_t Eta() const {return fRef->Eta();}
60 Double_t Y() const {return fRef->Y();}
61 Double_t Y(Double_t mass) const {return 0.5*TMath::Log((E(mass) + Pz()) / (E(mass) - Pz()));}
62 Double_t E() const {return fRef->E();}
63 Double_t E(Double_t mass) const {return TMath::Sqrt(mass*mass + P2());}
64 Double_t Phi() const {return fRef->Phi();}
65 Double_t Theta() const {return fRef->Theta();}
66 Double_t PhiDeg() const {return TMath::RadToDeg() * Phi();}
67 Double_t ThetaDeg() const {return TMath::RadToDeg() * Theta();}
9477aa42 68 void RotateP(Double_t angle, Double_t &x, Double_t &y, Bool_t isDegrees = kTRUE) const;
5eb970a4 69 Double_t AngleTo(AliRsnDaughter d, Bool_t outInDegrees = kTRUE);
7c2974c8 70
71 // DCA vertex
5eb970a4 72 Double_t Xv() const {return fRef->Xv();}
73 Double_t Yv() const {return fRef->Yv();}
74 Double_t Zv() const {return fRef->Zv();}
75 Double_t Dr() const {return fDr;}
76 Double_t Dz() const {return fDz;}
77 void SetDr(Double_t value) {fDr = value;}
78 void SetDz(Double_t value) {fDz = value;}
7c2974c8 79
80 // PID
5eb970a4 81 const Double_t *PID() const {return fRef->PID();}
4fbb2459 82 const Double_t *ComputedWeights() const {return fPID;}
83 Bool_t CombineWithPriors(const Double_t* priors, AliRsnPIDDefESD* pidDef = 0x0);
5eb970a4 84 AliPID::EParticleType RealisticPID() const;
85 AliPID::EParticleType PerfectPID() const;
4fbb2459 86 Bool_t IsPerfectPID(const AliPID::EParticleType type) const {return (PerfectPID() == type);}
87 Bool_t IsRealisticPID(const AliPID::EParticleType type) const {return (RealisticPID() == type);}
5eb970a4 88 Double_t PIDProb(AliPID::EParticleType type) const {return PID()[(Int_t)type];}
89 AliPID::EParticleType PIDType(Double_t &prob) const;
90 AliPID::EParticleType AssignedPID() const;
5bd59e02 91 AliPID::EParticleType RequiredPID() const {return fReqPID;}
92 void SetRequiredPID(AliPID::EParticleType type) {fReqPID = type;}
5eb970a4 93
94 // integer parameters
4fbb2459 95 Bool_t IsPos() const {return (fRef->Charge() > 0);}
96 Bool_t IsNeg() const {return (fRef->Charge() < 0);}
97 Bool_t IsNeutral() const {return (!IsPos() && !IsNeg());}
9477aa42 98 Bool_t IsSign(Char_t sign) const { if (sign=='+') return IsPos(); else if (sign=='-') return IsNeg(); else return IsNeutral();}
4fbb2459 99 Short_t Charge() const {if (IsPos()) return 1; else if (IsNeg()) return -1; else return 0;}
100 Char_t ChargeC() const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';}
5eb970a4 101 Int_t GetLabel() const {return fRef->GetLabel();}
102 Int_t GetID() const;
103 void SetStatus(ULong_t value) {fStatus = value;}
104 ULong_t GetStatus() const {return fStatus;}
105 Bool_t CheckFlag(ULong_t flag) const {return ((fStatus & flag) > 0);}
106 void SetGood() {fOK = kTRUE;}
107 void SetBad() {fOK = kFALSE;}
4fbb2459 108 Bool_t IsOK() const { return fOK; }
413bbf44 109 Int_t PairIndex() {return fPairIndex;}
110 void SetPairIndex(Int_t value) {fPairIndex = value;}
5eb970a4 111
112 // Kinkness
113 Char_t KinkIndex() const {return fKinkIndex;}
114 Bool_t IsKinkMother() const {return (fKinkIndex < 0);}
115 Bool_t IsKinkDaughter() const {return (fKinkIndex > 0);}
116 Bool_t IsKink() const {return (IsKinkMother() || IsKinkDaughter());}
117 void SetKink(Char_t kink) {fKinkIndex = kink;}
118 void SetKinkMother() {fKinkIndex = -1;}
119 void SetKinkDaughter() {fKinkIndex = 1;}
120 void SetNoKink() {fKinkIndex = 0;}
4fbb2459 121 void FindKinkIndex(const AliESDtrack* track);
122 void FindKinkIndex(AliAODEvent*const event);
5eb970a4 123
124 // MC info & references
4fbb2459 125 AliVParticle* GetRef() const {return fRef;}
126 AliESDtrack* GetRefESD() {return dynamic_cast<AliESDtrack*>(fRef);}
127 AliAODTrack* GetRefAOD() {return dynamic_cast<AliAODTrack*>(fRef);}
128 AliMCParticle* GetRefMC() {return dynamic_cast<AliMCParticle*>(fRef);}
129 TParticle* GetParticle() const {return fParticle;}
130 Int_t GetMotherPDG() const {return fMotherPDG;}
131 void SetRef(AliVParticle * const ref) {fRef = ref;}
132 void SetParticle(TParticle * const p) {fParticle = p;}
133 void SetMotherPDG(Int_t value) {fMotherPDG = value;}
134 void FindMotherPDG(AliStack *const stack);
135 Double_t GetMCEnergy(Double_t mass);
5eb970a4 136
137 // utilities
138 void Reset();
4fbb2459 139 void Print(Option_t*const option = "ALL") const;
5eb970a4 140
141 // static functions
142 static void SetPIDMethod(EPIDMethod method) {fgPIDMethod = method;}
143 static AliPID::EParticleType InternalType(Int_t pdgCode);
4fbb2459 144 static const char* MethodName(EPIDMethod method);
7c2974c8 145
06351446 146 private:
7c2974c8 147
5eb970a4 148 Bool_t fOK; // status flag for usability
149 Int_t fKinkIndex; // indicator of kinkness of the track
150 TParticle *fParticle; // pointer to (eventual) MC information
151 Int_t fMotherPDG; // PDG code of mother (if any)
152 ULong_t fStatus; // track status (if available)
413bbf44 153 Int_t fPairIndex; // to know if it is member #1 or #2 of the pair (cfr. to PairDef)
e0baff8c 154
5eb970a4 155 Double_t fDr; // transverse impact parameter
156 Double_t fDz; // longitudinal impact parameter
157 Double_t fPID[AliPID::kSPECIES]; // PID probabilities
5bd59e02 158 AliPID::EParticleType fReqPID; // PID assigned by pairdef
7c2974c8 159
5eb970a4 160 AliVParticle *fRef; // reference to read object
7c2974c8 161
5eb970a4 162 static EPIDMethod fgPIDMethod; // PID method used for analysis
7c2974c8 163
5eb970a4 164 ClassDef(AliRsnDaughter, 7)
a62a2d82 165};
166
167#endif