//
// Class AliRsnDaughter
//
-// Light-weight AOD object which contains all required track details
-// which are used for resonance analysis.
-// Provides converters from all kinds of input track type: ESD, AOD and MC.
+// Interface to candidate daughters of a resonance (tracks).
+// Points to the source of information, which is generally an AliVParticle-derived object
+// and contains few internal data-members to store "on fly" some important information
+// for the computations required during resonance analysis.
+// ---
+// Since the package revision, this object is not supposed to be stacked in memory
+// but created "on fly" during analysis and used just for computations, as an interface.
//
// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
// M. Vala (martin.vala@cern.ch)
#ifndef ALIRSNDAUGHTER_H
#define ALIRSNDAUGHTER_H
-#include <TMath.h>
+#include <TLorentzVector.h>
-#include "AliVParticle.h"
-#include "AliRsnPID.h"
-#include "AliESDtrackCuts.h"
+#include "AliESDtrack.h"
+#include "AliAODTrack.h"
+#include "AliESDv0.h"
+#include "AliAODv0.h"
+#include "AliMCParticle.h"
-class TParticle;
+typedef AliPID::EParticleType EPARTYPE;
-class AliESDtrack;
-class AliAODTrack;
-class AliMCParticle;
+class AliStack;
+class AliVEvent;
+class AliMCEvent;
+class AliRsnPIDDefESD;
-class AliRsnMCInfo;
-
-class AliRsnDaughter : public AliVParticle
+class AliRsnDaughter : public TObject
{
public:
-
- enum EPIDMethod
- {
- kNoPID = 0,
- kRealistic,
- kWeighted,
- kPerfect,
- kMethods
- };
-
- enum EPIDType
+
+ enum ERefType
{
- kEsd=0,
- kITS,
- kTPC,
- kTOF,
- kITS_TPC,
- kITS_TOF,
- kTPC_TOF,
- kITS_TPC_TOF,
- kITS_TPC_TOF_SP,
- kLastPIDType
+ kTrack = 0,
+ kV0,
+ kNoType
};
AliRsnDaughter();
AliRsnDaughter(const AliRsnDaughter ©);
- AliRsnDaughter(AliESDtrack *track, Bool_t useTPCInnerParam = kFALSE);
- AliRsnDaughter(AliAODTrack *track);
- AliRsnDaughter(AliMCParticle *track);
virtual ~AliRsnDaughter();
AliRsnDaughter& operator= (const AliRsnDaughter& copy);
+
+ // utilities
+ void Reset();
+ void Print(Option_t* const option = "") const;
+
+ // flags and labels
+ Int_t GetID() const;
+ Int_t GetLabel() const {return fLabel;}
+ Bool_t HasFlag(ULong_t flag) const;
+ Bool_t IsOK() const {return fOK;}
+ void SetBad() {fOK = kFALSE;}
+ void SetGood() {fOK = kTRUE;}
+ void SetLabel(Int_t label) {fLabel = label;}
// 4-momentum
- virtual Double_t E() const {return TMath::Sqrt(fMass*fMass + P2());}
- virtual Double_t E(Double_t mass) {SetM(mass); return E();}
- virtual Double_t M() const {return fMass;}
- virtual Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();}
- virtual Double_t P() const {return TMath::Sqrt(P2());}
- virtual Double_t Px() const {return fP[0];}
- virtual Double_t Py() const {return fP[1];}
- virtual Double_t Pz() const {return fP[2];}
- virtual Double_t Pt() const {return TMath::Sqrt(Px()*Px() + Py()*Py());}
- virtual Double_t OneOverPt() const {return 1.0 / Pt();}
- virtual Bool_t PxPyPz(Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;}
- virtual Double_t Chi2() const {return fChi2;}
- void SetPx(Double_t value) {fP[0] = value;}
- void SetPy(Double_t value) {fP[1] = value;}
- void SetPz(Double_t value) {fP[2] = value;}
- void SetP(Double_t px, Double_t py, Double_t pz) {SetPx(px); SetPy(py); SetPz(pz);}
- void SetM(Double_t m) {fMass = m;}
- void SetChi2(Double_t chi2) {fChi2 = chi2;}
- void RotateP(Double_t angle);
-
- // DCA vertex
- virtual Double_t Xv() const {return fV[0];}
- virtual Double_t Yv() const {return fV[1];}
- virtual Double_t Zv() const {return fV[2];}
- virtual Double_t Dr() const {return TMath::Sqrt(Xv()*Xv() + Yv()*Yv());}
- virtual Bool_t XvYvZv(Double_t x[3]) const {x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE;}
- void SetVx(Double_t value) {fV[0] = value;}
- void SetVy(Double_t value) {fV[1] = value;}
- void SetVz(Double_t value) {fV[2] = value;}
- void SetV(Double_t vx, Double_t vy, Double_t vz) {SetVx(vx); SetVy(vy); SetVz(vz);}
- void ShiftZero(Double_t x, Double_t y, Double_t z){fV[0]-=x;fV[1]-=y;fV[2]-=z;}
-
- // Orientation
- virtual Double_t Phi() const {return TMath::ATan2(Py(), Px()) * TMath::RadToDeg();} // degrees
- virtual Double_t Theta() const {return TMath::ATan2(Pt(), Pz()) * TMath::RadToDeg();} // degrees
- virtual Double_t Eta() const {return -TMath::Log(TMath::Tan(0.5*Theta()));}
- virtual Double_t Y() const {return TMath::Log((E() + Pz()) / (E() - Pz()));}
-
- // Charge
- virtual Short_t Charge() const {return fCharge;}
- virtual Char_t Kink() const {return fKink;}
- virtual Bool_t IsKinkMother() const {return (fKink < 0);}
- virtual Bool_t IsKinkDaughter() const {return (fKink > 0);}
- void SetCharge(Short_t value) {fCharge = value;}
- void SetKink(Char_t kink) {fKink = kink;}
-
- // PID
- virtual const Double_t* PID() const {return fPIDWeight;}
- const Double_t* PIDProb() const {return fPIDProb;}
- void SetPIDProb(Int_t i, Double_t value);
- void SetPIDWeight(Int_t i, Double_t value);
- static void SetPIDMethod(EPIDMethod method) {fgPIDMethod = method;}
- void AssignRealisticPID();
- AliRsnPID::EType PIDType(Double_t &prob) const;
-
- // check that contains a given ESD flag
- UInt_t GetFlags() {return fFlags;}
- Bool_t CheckFlag(ULong_t flag) {return ((fFlags & flag) == flag);}
-
- // information getters from objects
- Bool_t Adopt(AliESDtrack *track, EPIDType pidType = kEsd, Double_t divValue = 0.0, Bool_t useTPCInnerParam = kFALSE);
- Bool_t Adopt(AliAODTrack *track);
- Bool_t Adopt(AliMCParticle *track);
-
- // position in stack/array
- Int_t Index() const {return fIndex;}
- Int_t Label() const {return fLabel;}
- Int_t GetLabel() const {return -1;}
- void SetIndex(Int_t value) {fIndex = value;}
- void SetLabel(Int_t value) {fLabel = value;}
+ TLorentzVector& P(Bool_t mc = kFALSE) {return (mc ? fPMC : fP);}
+ Bool_t SetMass(Double_t mass);
- // N sigma to vertex
- Float_t NSigmaToVertex() const { return fNSigmaToVertex; }
- void SetNSigmaToVertex(const Float_t& theValue) { fNSigmaToVertex = theValue; }
-
-
- // ITS/TPC clusters
- Int_t NumberOfITSClusters() const {return fITSnum;}
- Int_t NumberOfTPCClusters() const {return fTPCnum;}
- void SetNumberOfITSClusters(Int_t n) {fITSnum = n;}
- void SetNumberOfTPCClusters(Int_t n) {fTPCnum = n;}
-
- // Utilities
- void Print(Option_t *option = "ALL") const;
- void InitMCInfo();
- Bool_t InitMCInfo(TParticle *particle);
- Bool_t InitMCInfo(AliMCParticle *mcParticle);
-
- // MC info
- AliRsnMCInfo* GetMCInfo() const { return fMCInfo; }
-
- // sorting (with respect to Pt)
- virtual Bool_t IsSortable() const {return kTRUE;}
- virtual Int_t Compare(const TObject* obj) const;
-
+ // charge
+ Bool_t IsPos() const {return (fRef->Charge() > 0);}
+ Bool_t IsNeg() const {return (fRef->Charge() < 0);}
+ Bool_t IsNeutral() const {return (!IsPos() && !IsNeg());}
+ Bool_t IsSign(Char_t sign) const {if (sign=='+') return IsPos(); else if (sign=='-') return IsNeg(); else return IsNeutral();}
+ Short_t Charge() const {if (IsPos()) return 1 ; else if (IsNeg()) return -1 ; else return 0 ;}
+ Char_t ChargeChar() const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';}
+
+ // MC info & references
+ AliVParticle* GetRef() const {return fRef;}
+ AliMCParticle* GetRefMCtrack() const {return dynamic_cast<AliMCParticle*>(fRef);}
+ AliESDtrack* GetRefESDtrack() const {return dynamic_cast<AliESDtrack*>(fRef);}
+ AliAODTrack* GetRefAODtrack() const {return dynamic_cast<AliAODTrack*>(fRef);}
+ AliESDv0* GetRefESDv0() const {return dynamic_cast<AliESDv0*>(fRef);}
+ AliAODv0* GetRefAODv0() const {return dynamic_cast<AliAODv0*>(fRef);}
+ AliMCParticle* GetRefMC() const {return fRefMC;}
+ TParticle* GetParticle() const {if (fRefMC) return fRefMC->Particle(); else return 0x0;}
+ Int_t GetMotherPDG() const {return fMotherPDG;}
+ Bool_t IsMC() const {if (GetRefMCtrack()) return kTRUE; return kFALSE;}
+ Bool_t IsAOD() const {if (GetRefAODtrack() || GetRefAODv0()) return kTRUE; return kFALSE;}
+ Bool_t IsESD() const {if (GetRefESDtrack() || GetRefESDv0()) return kTRUE; return kFALSE;}
+ Bool_t IsTrack() const {if (GetRefESDtrack() || GetRefAODtrack() || GetRefMCtrack()) return kTRUE; return kFALSE;}
+ Bool_t IsV0() const {if (GetRefESDv0() || GetRefAODv0()) return kTRUE; return kFALSE;}
+ ERefType RefType() const {if (IsTrack()) return kTrack; if (IsV0()) return kV0; return kNoType;}
+ void SetRef(AliVParticle *ref) {fRef = ref;}
+ void SetRefMC(AliMCParticle *refMC) {fRefMC = refMC;}
+ void SetMotherPDG(Int_t value) {fMotherPDG = value;}
private:
- static void GetESDPID
- (AliESDtrack *track, Double_t *pid, EPIDType pidType = kEsd,
- Double_t divValue = -1.0, Double_t val = -1.0);
-
- Int_t fIndex; // index of source object (ESD/AOD/MC) in its collection
- Int_t fLabel; // label assigned to the track (act. by GEANT3)
-
- Short_t fCharge; // charge sign
- ULong_t fFlags; // status flags
- Char_t fKink; // kink index
-
- Double_t fP[3]; // vector momentum (x, y, z)
- Double_t fV[3]; // DCA vertex (x, y, z)
- Double_t fMass; // mass (assigned externally)
- Double_t fChi2; // chi square of track
- Float_t fNSigmaToVertex; // N sigma to vertex
-
- Int_t fITSnum; // number of ITS clusters
- Int_t fTPCnum; // number of TPC clusters
-
- AliRsnPID::EType fRealisticPID; // PID from Bayesian probs (largest one)
- Double_t fPIDProb[AliRsnPID::kSpecies]; // PID probabilities (Bayesian comp.)
- Double_t fPIDWeight[AliRsnPID::kSpecies]; // PID weights
-
- AliRsnMCInfo *fMCInfo; // reference to particle object (if any)
+ Bool_t fOK; // internal utility flag which is kFALSE when this object should not be used
+ Int_t fLabel; // GEANT label of corresponding MC (not trivial for V0s)
+ Int_t fMotherPDG; // PDG code of mother (makes sense only if fRefMC is defined)
- AliESDtrackCuts fESDTrackCuts; //! tmp object of AliESDtrackCuts for fNSigmaToVertex
-
- static EPIDMethod fgPIDMethod; // flag to define how the PID is computed for this object
+ TLorentzVector fP; // 4-vector filled with track info from default ref (if present)
+ TLorentzVector fPMC; // 4-vector filled with track info from MC ref (if present)
+
+ AliVParticle *fRef; // reference to track in ESD/AOD/MC (all info are taken from this object)
+ AliMCParticle *fRefMC; // reference to corresponding MC particle
- ClassDef(AliRsnDaughter, 4)
+ ClassDef(AliRsnDaughter, 8)
};
#endif