]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODRecoDecay.h
Bug fix in buffer expansion size calculation, report 79334
[u/mrichter/AliRoot.git] / STEER / AliAODRecoDecay.h
index 917a16fbb6abfdfc5289b7ea770ada3ae74edbf7..8525e7ad35a151a81861fd364d5f719ed023a17e 100644 (file)
@@ -54,7 +54,7 @@ class AliAODRecoDecay : public AliVTrack {
   // 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,Int_t *pdgDg=0) const;
+  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);
@@ -85,8 +85,10 @@ class AliAODRecoDecay : public AliVTrack {
   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());}
@@ -96,15 +98,23 @@ class AliAODRecoDecay : public AliVTrack {
   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);}
@@ -119,9 +129,11 @@ class AliAODRecoDecay : public AliVTrack {
   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 fNProngs;}
@@ -132,18 +144,22 @@ class AliAODRecoDecay : public AliVTrack {
   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)
@@ -177,7 +193,7 @@ class AliAODRecoDecay : public AliVTrack {
   
  protected:
 
-  Int_t    MatchToMC(Int_t pdgabs,TClonesArray *mcArray,Int_t dgLabels[10],Int_t ndg,Int_t ndgCk=0,Int_t *pdgDg=0) const;
+  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
@@ -295,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
@@ -319,6 +335,22 @@ 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()) { 
@@ -386,3 +418,4 @@ inline void AliAODRecoDecay::GetPIDProng(Int_t ip,Double_t *pid) const
 
 #endif
 
+