]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODRecoDecay.h
Updates (Chiara)
[u/mrichter/AliRoot.git] / STEER / AliAODRecoDecay.h
index cc6c5bbeb150d90c74186f46316f1ffa349a091e..8525e7ad35a151a81861fd364d5f719ed023a17e 100644 (file)
 
 #include <TMath.h>
 #include <TRef.h>
+#include <TClonesArray.h>
 #include "AliAODVertex.h"
-#include "AliVParticle.h"
+#include "AliAODTrack.h"
+#include "AliVTrack.h"
 
-class AliAODRecoDecay : public AliVParticle {
+class AliVVertex;
+
+class AliAODRecoDecay : public AliVTrack {
 
  public:
 
@@ -45,6 +49,13 @@ class AliAODRecoDecay : public AliVParticle {
   Short_t  GetCharge() const {return fCharge;}
   void     SetCharge(Short_t charge=0) {fCharge=charge;}
 
+  // Match to MC signal:
+  // check if this candidate is matched to a MC signal
+  // If no, return -1
+  // If yes, return label (>=0) of the AliAODMCParticle
+  // if ndgCk>0, checks also daughters PDGs
+  Int_t    MatchToMC(Int_t pdgabs,TClonesArray *mcArray,Int_t ndgCk=0, const Int_t *pdgDg=0) const;
+
   // PID
   void      SetPID(Int_t nprongs,Double_t *pid);
   Double_t *GetPID() const { return fPID; }
@@ -62,12 +73,22 @@ class AliAODRecoDecay : public AliVParticle {
   Int_t GetEventNumber() const { return fEventNumber; }
   Int_t GetRunNumber() const { return fRunNumber; }
 
+  // methods of AliVTrack
+  virtual Int_t    GetID() const { return -1; }
+  virtual UChar_t  GetITSClusterMap() const;
+  virtual ULong_t  GetStatus() const;
+  virtual Bool_t   GetXYZ(Double_t *p) const { return XvYvZv(p); }
+  virtual Bool_t   GetCovarianceXYZPxPyPz(Double_t cv[21]) const;
+  virtual Bool_t   PropagateToDCA(const AliVVertex* vtx,Double_t b,Double_t maxd,Double_t dz[2],Double_t covar[3]);
+
   // kinematics & topology
   Double_t Px() const; 
   Double_t Py() const;
   Double_t Pz() const;
-  Double_t P() const {return TMath::Sqrt(Px()*Px()+Py()*Py()+Pz()*Pz());}
-  Double_t Pt() const {return TMath::Sqrt(Px()*Px()+Py()*Py());}
+  Double_t P2() const {return Px()*Px()+Py()*Py()+Pz()*Pz();}
+  Double_t Pt2() const {return Px()*Px()+Py()*Py();}
+  Double_t P() const {return TMath::Sqrt(P2());}
+  Double_t Pt() const {return TMath::Sqrt(Pt2());}
   Double_t OneOverPt() const {return (Pt() ? 1./Pt() : 0.);}
   Bool_t   PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
   Double_t Phi() const {return TMath::Pi()+TMath::ATan2(-Py(),-Px());}
@@ -77,15 +98,23 @@ class AliAODRecoDecay : public AliVParticle {
   Double_t Yv() const { return GetSecVtxY(); }
   Double_t Zv() const { return GetSecVtxZ(); }
   virtual Bool_t   XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
-  Double_t E(UInt_t pdg) const;
-  Double_t Y(UInt_t pdg) const {return 0.5*TMath::Log((E(pdg)+Pz())/(E(pdg)-Pz()+1.e-13));}
-  Double_t DecayLength(Double_t point[3]) const;
+  Double_t E2(UInt_t pdg) const;
+  Double_t E(UInt_t pdg) const {return TMath::Sqrt(E2(pdg));}
+  Double_t Y(UInt_t pdg) const {Double_t e=E(pdg); return 0.5*TMath::Log((e+Pz())/(e-Pz()+1.e-13));}
+  Double_t DecayLength2(Double_t point[3]) const;
+  Double_t DecayLength(Double_t point[3]) const {return TMath::Sqrt(DecayLength2(point));}
+  Double_t DecayLength2(AliAODVertex *vtx1) const
+  {return GetSecondaryVtx()->Distance2ToVertex(vtx1);}
   Double_t DecayLength(AliAODVertex *vtx1) const
-  {return GetSecondaryVtx()->DistanceToVertex(vtx1);}
+    {return TMath::Sqrt(DecayLength2(vtx1));}
+  Double_t DecayLengthError2(AliAODVertex *vtx1) const
+    {return GetSecondaryVtx()->Error2DistanceToVertex(vtx1);}
   Double_t DecayLengthError(AliAODVertex *vtx1) const
-    {return GetSecondaryVtx()->ErrorDistanceToVertex(vtx1);}
+    {return TMath::Sqrt(DecayLengthError2(vtx1));}
+  Double_t NormalizedDecayLength2(AliAODVertex *vtx1) const 
+    {return DecayLength2(vtx1)/DecayLengthError2(vtx1);}
   Double_t NormalizedDecayLength(AliAODVertex *vtx1) const 
-    {return DecayLength(vtx1)/DecayLengthError(vtx1);}
+  {return TMath::Sqrt(NormalizedDecayLength2(vtx1));}
   Double_t DecayLengthXY(Double_t point[3]) const;
   Double_t DecayLengthXY(AliAODVertex *vtx1) const
     {return GetSecondaryVtx()->DistanceXYToVertex(vtx1);}
@@ -100,29 +129,37 @@ class AliAODRecoDecay : public AliVParticle {
   Double_t CosPointingAngleXY(Double_t point[3]) const;
   Double_t CosPointingAngleXY(AliAODVertex *vtx1) const;
   Double_t CosThetaStar(Int_t ip,UInt_t pdgvtx,UInt_t pdgprong0,UInt_t pdgprong1) const;
-  Double_t InvMass(Int_t npdg,UInt_t *pdg) const;
+  Double_t InvMass2(Int_t npdg,UInt_t *pdg) const;
+  Double_t InvMass(Int_t npdg,UInt_t *pdg) const {return TMath::Sqrt(InvMass2(npdg,pdg));}
   Double_t ImpParXY(Double_t point[3]) const;
   Double_t ImpParXY(AliAODVertex *vtx1) const;
+  Bool_t   PassInvMassCut(Int_t pdgMom,Int_t npdgDg,UInt_t *pdgDg,Double_t cut) const;
 
   // prongs
-  //Int_t   GetNProngs() const {return GetSecondaryVtx()->GetNDaughters();}
-  Int_t   GetNProngs() const {return fNProngs;}
+  Int_t    GetNProngs() const {return fNProngs;}
+  Int_t    GetNDaughters() const {return GetSecondaryVtx()->GetNDaughters();}
+  TObject *GetDaughter(Int_t i) const {return (GetNDaughters()>i ? GetSecondaryVtx()->GetDaughter(i) : 0x0);}
 
-  Short_t ChargeProng(Int_t ip) const;
+  Short_t  ChargeProng(Int_t ip) const;
   Double_t Getd0Prong(Int_t ip) const {return fd0[ip];}
   Double_t Prodd0d0(Int_t ip1=0,Int_t ip2=0) const {return fd0[ip1]*fd0[ip2];} 
+  void     SetPxPyPzProngs(Int_t nprongs,Double_t *px,Double_t *py,Double_t *pz);
+  void     Setd0Prongs(Int_t nprongs,Double_t *d0);
   Double_t PxProng(Int_t ip) const {return fPx[ip];}
   Double_t PyProng(Int_t ip) const {return fPy[ip];}
   Double_t PzProng(Int_t ip) const {return fPz[ip];}
-  Double_t PtProng(Int_t ip) const; 
-  Double_t PProng(Int_t ip) const;
+  Double_t PtProng(Int_t ip) const {return TMath::Sqrt(Pt2Prong(ip));}
+  Double_t Pt2Prong(Int_t ip) const; 
+  Double_t PProng(Int_t ip) const {return TMath::Sqrt(P2Prong(ip));}
+  Double_t P2Prong(Int_t ip) const; 
   Double_t PhiProng(Int_t ip) const 
     {return TMath::ATan2(PyProng(ip),PxProng(ip));}
     Double_t ThetaProng(Int_t ip) const 
       {return 0.5*TMath::Pi()-TMath::ATan(PzProng(ip)/(PtProng(ip)+1.e-13));}
   Double_t EtaProng(Int_t ip) const 
     {return -TMath::Log(TMath::Tan(0.5*ThetaProng(ip)));}
-  Double_t EProng(Int_t ip,UInt_t pdg) const;
+  Double_t E2Prong(Int_t ip,UInt_t pdg) const;
+  Double_t EProng(Int_t ip,UInt_t pdg) const {return TMath::Sqrt(E2Prong(ip,pdg));}
   Double_t YProng(Int_t ip,UInt_t pdg) const 
     {return 0.5*TMath::Log((EProng(ip,pdg)+PzProng(ip))/(EProng(ip,pdg)-PzProng(ip)+1.e-13));}
   Double_t Alpha() const;             // for Armenteros-Podolanski plot (V0's)
@@ -152,8 +189,13 @@ class AliAODRecoDecay : public AliVParticle {
   Double_t M() const 
     {printf("Dummy function"); return (Double_t)-999.;}
   Int_t GetLabel() const {return -1;}
+  Int_t PdgCode()  const {return  0;}
+  
  protected:
 
+  Int_t    MatchToMC(Int_t pdgabs,TClonesArray *mcArray,Int_t dgLabels[10],Int_t ndg,Int_t ndgCk=0,const Int_t *pdgDg=0) const;
+  Int_t    MatchToMC(Int_t pdgabs,TClonesArray *mcArray,Int_t dgLabels[10]) const { return MatchToMC(pdgabs,mcArray,dgLabels,GetNDaughters()); }
+
   TRef     fSecondaryVtx;  // decay vertex
   AliAODVertex *fOwnSecondaryVtx;  // temporary solution (to work outside AliAODEvent)
   Short_t  fCharge;  // charge, use this convention for prongs charges:
@@ -188,7 +230,7 @@ class AliAODRecoDecay : public AliVParticle {
 
   //
 
-  ClassDef(AliAODRecoDecay,3)  // base class for AOD reconstructed decays
+  ClassDef(AliAODRecoDecay,4)  // base class for AOD reconstructed decays
 };
 
 
@@ -269,14 +311,14 @@ inline Double_t AliAODRecoDecay::ImpParXY(AliAODVertex *vtx1) const
   return ImpParXY(v);
 }
 
-inline Double_t AliAODRecoDecay::PtProng(Int_t ip) const 
+inline Double_t AliAODRecoDecay::Pt2Prong(Int_t ip) const 
 {
-  return TMath::Sqrt(PxProng(ip)*PxProng(ip)+PyProng(ip)*PyProng(ip));
+  return PxProng(ip)*PxProng(ip)+PyProng(ip)*PyProng(ip);
 }
 
-inline Double_t AliAODRecoDecay::PProng(Int_t ip) const 
+inline Double_t AliAODRecoDecay::P2Prong(Int_t ip) const 
 {
-  return TMath::Sqrt(PtProng(ip)*PtProng(ip)+PzProng(ip)*PzProng(ip));
+  return Pt2Prong(ip)+PzProng(ip)*PzProng(ip);
 }
 
 inline Double_t AliAODRecoDecay::QlProngFlightLine(Int_t ip,AliAODVertex *vtx1) const
@@ -293,6 +335,42 @@ inline Double_t AliAODRecoDecay::QtProngFlightLine(Int_t ip,AliAODVertex *vtx1)
   return QtProngFlightLine(ip,v);
 }
 
+inline void AliAODRecoDecay::Setd0Prongs(Int_t nprongs,Double_t *d0) 
+{
+  if(nprongs!=GetNProngs()) { 
+    printf("Wrong number of momenta, must be nProngs");
+    return;
+  }
+  if(!fd0) {
+    fd0 = new Double32_t[nprongs];
+  }
+  for(Int_t i=0;i<nprongs;i++) {
+    fd0[i] = d0[i]; 
+  }
+
+  return;
+}
+
+inline void AliAODRecoDecay::SetPxPyPzProngs(Int_t nprongs,Double_t *px,Double_t *py,Double_t *pz) 
+{
+  if(nprongs!=GetNProngs()) { 
+    printf("Wrong number of momenta, must be nProngs");
+    return;
+  }
+  if(!fPx) {
+    fPx = new Double32_t[nprongs];
+    fPy = new Double32_t[nprongs];
+    fPz = new Double32_t[nprongs];
+  }
+  for(Int_t i=0;i<nprongs;i++) {
+    fPx[i] = px[i]; 
+    fPy[i] = py[i]; 
+    fPz[i] = pz[i]; 
+  }
+
+  return;
+}
+
 inline void AliAODRecoDecay::SetDCAs(Int_t nDCA,Double_t *dca) 
 {
   if(nDCA!=(GetNProngs()*(GetNProngs()-1)/2)) { 
@@ -321,7 +399,7 @@ inline void AliAODRecoDecay::SetPID(Int_t nprongs,Double_t *pid)
     return;
   }
   if(fPID) delete [] fPID;
-  fNPID = nprongs;
+  fNPID = nprongs*5;
   fPID = new Double32_t[nprongs*5];
   for(Int_t i=0;i<nprongs;i++) 
     for(Int_t j=0;j<5;j++)
@@ -339,3 +417,5 @@ inline void AliAODRecoDecay::GetPIDProng(Int_t ip,Double_t *pid) const
 
 
 #endif
+
+