/************************************************************************** * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ ///////////////////////////////////////////////////////////// // // Base class for AOD reconstructed decay // // Author: A.Dainese, andrea.dainese@lnl.infn.it ///////////////////////////////////////////////////////////// #include #include #include "AliVParticle.h" #include "AliAODRecoDecay.h" ClassImp(AliAODRecoDecay) //-------------------------------------------------------------------------- AliAODRecoDecay::AliAODRecoDecay() : AliVParticle(), fSecondaryVtx(0x0), fCharge(0), fNProngs(0), fNDCA(0), fNPID(0), fPx(0x0), fPy(0x0), fPz(0x0), fd0(0x0), fDCA(0x0), fPID(0x0), fEventNumber(-1),fRunNumber(-1) { // // Default Constructor // } //-------------------------------------------------------------------------- AliAODRecoDecay::AliAODRecoDecay(AliAODVertex *vtx2,Int_t nprongs, Short_t charge, Double_t *px,Double_t *py,Double_t *pz, Double_t *d0) : AliVParticle(), fSecondaryVtx(vtx2), fCharge(charge), fNProngs(nprongs), fNDCA(0), fNPID(0), fPx(0x0), fPy(0x0), fPz(0x0), fd0(0x0), fDCA(0x0), fPID(0x0), fEventNumber(-1),fRunNumber(-1) { // // Constructor with AliAODVertex for decay vertex // fPx = new Double_t[GetNProngs()]; fPy = new Double_t[GetNProngs()]; fPz = new Double_t[GetNProngs()]; fd0 = new Double_t[GetNProngs()]; for(Int_t i=0; i0) { fd0 = new Double_t[GetNProngs()]; memcpy(fd0,source.fd0,GetNProngs()*sizeof(Double_t)); if(source.fPx) { fPx = new Double_t[GetNProngs()]; fPy = new Double_t[GetNProngs()]; fPz = new Double_t[GetNProngs()]; memcpy(fPx,source.fPx,GetNProngs()*sizeof(Double_t)); memcpy(fPy,source.fPy,GetNProngs()*sizeof(Double_t)); memcpy(fPz,source.fPz,GetNProngs()*sizeof(Double_t)); } if(source.fPID) { fPID = new Double_t[5*GetNProngs()]; memcpy(fPID,source.fPID,GetNProngs()*sizeof(Double_t)); } if(source.fDCA) { fDCA = new Double_t[GetNProngs()*(GetNProngs()-1)/2]; memcpy(fDCA,source.fDCA,(GetNProngs()*(GetNProngs()-1)/2)*sizeof(Double_t)); } } } //-------------------------------------------------------------------------- AliAODRecoDecay &AliAODRecoDecay::operator=(const AliAODRecoDecay &source) { // // assignment operator // if(&source == this) return *this; fSecondaryVtx = source.fSecondaryVtx; fCharge = source.fCharge; fNProngs = source.fNProngs; fNDCA = source.fNDCA; fNPID = source.fNPID; fEventNumber = source.fEventNumber; fRunNumber = source.fRunNumber; if(source.GetNProngs()>0) { fd0 = new Double_t[GetNProngs()]; memcpy(fd0,source.fd0,GetNProngs()*sizeof(Double_t)); if(source.fPx) { fPx = new Double_t[GetNProngs()]; fPy = new Double_t[GetNProngs()]; fPz = new Double_t[GetNProngs()]; memcpy(fPx,source.fPx,GetNProngs()*sizeof(Double_t)); memcpy(fPy,source.fPy,GetNProngs()*sizeof(Double_t)); memcpy(fPz,source.fPz,GetNProngs()*sizeof(Double_t)); } if(source.fPID) { fPID = new Double_t[5*GetNProngs()]; memcpy(fPID,source.fPID,GetNProngs()*sizeof(Double_t)); } if(source.fDCA) { fDCA = new Double_t[GetNProngs()*(GetNProngs()-1)/2]; memcpy(fDCA,source.fDCA,(GetNProngs()*(GetNProngs()-1)/2)*sizeof(Double32_t)); } } return *this; } //-------------------------------------------------------------------------- AliAODRecoDecay::~AliAODRecoDecay() { // // Default Destructor // if(fPx) delete [] fPx; if(fPy) delete [] fPy; if(fPz) delete [] fPz; if(fd0) delete [] fd0; if(fPID) delete [] fPID; if(fDCA) delete [] fDCA; } //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::Alpha() const { // // Armenteros-Podolanski alpha for 2-prong decays // if(GetNProngs()!=2) { printf("Can be called only for 2-prong decays"); return (Double_t)-99999.; } return 1.-2./(1.+QlProng(0)/QlProng(1)); } //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::DecayLength(Double_t point[3]) const { // // Decay length assuming it is produced at "point" [cm] // return TMath::Sqrt((point[0]-GetSecVtxX()) *(point[0]-GetSecVtxX()) +(point[1]-GetSecVtxY()) *(point[1]-GetSecVtxY()) +(point[2]-GetSecVtxZ()) *(point[2]-GetSecVtxZ())); } //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::DecayLengthXY(Double_t point[3]) const { // // Decay length in XY assuming it is produced at "point" [cm] // return TMath::Sqrt((point[0]-GetSecVtxX()) *(point[0]-GetSecVtxX()) +(point[1]-GetSecVtxY()) *(point[1]-GetSecVtxY())); } //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::CosPointingAngle(Double_t point[3]) const { // // Cosine of pointing angle in space assuming it is produced at "point" // TVector3 mom(Px(),Py(),Pz()); TVector3 fline(GetSecVtxX()-point[0], GetSecVtxY()-point[1], GetSecVtxZ()-point[2]); Double_t pta = mom.Angle(fline); return TMath::Cos(pta); } //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::CosPointingAngleXY(Double_t point[3]) const { // // Cosine of pointing angle in transverse plane assuming it is produced // at "point" // TVector3 momXY(Px(),Py(),0.); TVector3 flineXY(GetSecVtxX()-point[0], GetSecVtxY()-point[1], 0.); Double_t ptaXY = momXY.Angle(flineXY); return TMath::Cos(ptaXY); } //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::CosThetaStar(Int_t ip,UInt_t pdgvtx,UInt_t pdgprong0,UInt_t pdgprong1) const { // // Only for 2-prong decays: // Cosine of decay angle (theta*) in the rest frame of the mother particle // for prong ip (0 or 1) with mass hypotheses pdgvtx for mother particle, // pdgprong0 for prong 0 and pdgprong1 for prong1 // if(GetNProngs()!=2) { printf("Can be called only for 2-prong decays"); return (Double_t)-99999.; } Double_t massvtx = TDatabasePDG::Instance()->GetParticle(pdgvtx)->Mass(); Double_t massp[2]; massp[0] = TDatabasePDG::Instance()->GetParticle(pdgprong0)->Mass(); massp[1] = TDatabasePDG::Instance()->GetParticle(pdgprong1)->Mass(); Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)-4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx); Double_t beta = P()/E(pdgvtx); Double_t gamma = E(pdgvtx)/massvtx; Double_t cts = (QlProng(ip)/gamma-beta*TMath::Sqrt(pStar*pStar+massp[ip]*massp[ip]))/pStar; return cts; } //--------------------------------------------------------------------------- Double_t AliAODRecoDecay::Ct(UInt_t pdg,Double_t point[3]) const { // // Decay time * c assuming it is produced at "point" [cm] // Double_t mass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass(); return DecayLength(point)*mass/P(); } //--------------------------------------------------------------------------- Double_t AliAODRecoDecay::E(UInt_t pdg) const { // // Energy // Double_t mass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass(); return TMath::Sqrt(mass*mass+P()*P()); } //--------------------------------------------------------------------------- Double_t AliAODRecoDecay::EProng(Int_t ip,UInt_t pdg) const { // // Energy of ip-th prong // Double_t mass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass(); return TMath::Sqrt(mass*mass+PProng(ip)*PProng(ip)); } //--------------------------------------------------------------------------- /*Int_t AliAODRecoDecay::GetIndexProng(Int_t ip) const { // // Index of prong ip // if(!GetNProngs()) return 999999; UShort_t *indices = GetSecondaryVtx()->GetIndices(); return indices[ip]; }*/ //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::ImpParXY(Double_t point[3]) const { // // Impact parameter in the bending plane of the particle // w.r.t. to "point" // Double_t k = -(GetSecVtxX()-point[0])*Px()-(GetSecVtxY()-point[1])*Py(); k /= Pt()*Pt(); Double_t dx = GetSecVtxX()-point[0]+k*Px(); Double_t dy = GetSecVtxY()-point[1]+k*Py(); Double_t absImpPar = TMath::Sqrt(dx*dx+dy*dy); TVector3 mom(Px(),Py(),Pz()); TVector3 fline(GetSecVtxX()-point[0], GetSecVtxY()-point[1], GetSecVtxZ()-point[2]); TVector3 cross = mom.Cross(fline); return (cross.Z()>0. ? absImpPar : -absImpPar); } //---------------------------------------------------------------------------- Double_t AliAODRecoDecay::InvMass(Int_t npdg,UInt_t *pdg) const { // // Invariant mass for prongs mass hypotheses in pdg array // if(GetNProngs()!=npdg) { printf("npdg != GetNProngs()"); return (Double_t)-99999.; } Double_t energysum = 0.; for(Int_t i=0; i