From 25f906db191c879fe3eb5b4df20947e8e722c50e Mon Sep 17 00:00:00 2001 From: shahoian Date: Mon, 23 Jan 2012 15:46:03 +0000 Subject: [PATCH] Extended functionality of GetTPCClusterDensity + methods to manipulate V0 kinematics (Marian, https://savannah.cern.ch/bugs/?90749) --- STEER/AOD/AliAODTrack.cxx | 31 ++++++++------ STEER/AOD/AliAODTrack.h | 2 +- STEER/ESD/AliESDtrack.cxx | 67 ++++++++++++++++++++++++++++--- STEER/ESD/AliESDtrack.h | 3 +- STEER/ESD/AliESDv0.cxx | 80 +++++++++++++++++++++++++++++++++++-- STEER/ESD/AliESDv0.h | 7 ++-- STEER/STEERBase/AliVTrack.h | 2 +- 7 files changed, 165 insertions(+), 27 deletions(-) diff --git a/STEER/AOD/AliAODTrack.cxx b/STEER/AOD/AliAODTrack.cxx index cb6b060fed8..c0c58590801 100644 --- a/STEER/AOD/AliAODTrack.cxx +++ b/STEER/AOD/AliAODTrack.cxx @@ -575,30 +575,35 @@ Bool_t AliAODTrack::GetPxPyPz(Double_t p[3]) const return kTRUE; } -//______________________________________________________________________________ -Float_t AliAODTrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const + +//_______________________________________________________________________ +Float_t AliAODTrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const { // - // TPC cluster information + // TPC cluster information // type 0: get fraction of found/findable clusters with neighbourhood definition // 1: findable clusters with neighbourhood definition // 2: found clusters - // + // bitType: + // 0 - all cluster used + // 1 - clusters used for the kalman update // definition of findable clusters: // a cluster is defined as findable if there is another cluster // within +- nNeighbours pad rows. The idea is to overcome threshold // effects with a very simple algorithm. // - - if (type==2) return fTPCClusterMap.CountBits(); + Int_t found=0; Int_t findable=0; Int_t last=-nNeighbours; + const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap; - for (Int_t i=row0; irow1) upperBound=row1; + for (Int_t i=row0; i0) + if (findable>0) fraction=(Float_t)found/(Float_t)findable; - else + else fraction=0; return fraction; - } + } return 0; // undefined type - default value } + //______________________________________________________________________________ Double_t AliAODTrack::GetTRDslice(Int_t plane, Int_t slice) const { // diff --git a/STEER/AOD/AliAODTrack.h b/STEER/AOD/AliAODTrack.h index 386d41fd189..3f6026aad12 100644 --- a/STEER/AOD/AliAODTrack.h +++ b/STEER/AOD/AliAODTrack.h @@ -241,7 +241,7 @@ class AliAODTrack : public AliVTrack { const TBits& GetTPCClusterMap() const {return fTPCClusterMap;} const TBits& GetTPCFitMap() const {return fTPCFitMap;} - Float_t GetTPCClusterInfo(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159) const; + Float_t GetTPCClusterInfo(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t /*type*/=0) const; const TBits& GetTPCSharedMap() const {return fTPCSharedMap;} void SetTPCClusterMap(const TBits amap) {fTPCClusterMap = amap;} diff --git a/STEER/ESD/AliESDtrack.cxx b/STEER/ESD/AliESDtrack.cxx index b6d565e735f..aa57fed0528 100644 --- a/STEER/ESD/AliESDtrack.cxx +++ b/STEER/ESD/AliESDtrack.cxx @@ -1766,31 +1766,33 @@ Float_t AliESDtrack::GetTPCCrossedRows() const } //_______________________________________________________________________ -Float_t AliESDtrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const +Float_t AliESDtrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const { // // TPC cluster information // type 0: get fraction of found/findable clusters with neighbourhood definition // 1: findable clusters with neighbourhood definition // 2: found clusters - // + // bitType: + // 0 - all cluster used + // 1 - clusters used for the kalman update // definition of findable clusters: // a cluster is defined as findable if there is another cluster // within +- nNeighbours pad rows. The idea is to overcome threshold // effects with a very simple algorithm. // - if (type==2) return fTPCClusterMap.CountBits(); Int_t found=0; Int_t findable=0; Int_t last=-nNeighbours; + const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap; - Int_t upperBound=fTPCClusterMap.GetNbits(); + Int_t upperBound=clusterMap.GetNbits(); if (upperBound>row1) upperBound=row1; for (Int_t i=row0; i0) + fraction=(Float_t)found/(Float_t)findable; + else + fraction=0; + return fraction; + } + return 0; // undefined type - default value +} + +//_______________________________________________________________________ +Float_t AliESDtrack::GetTPCClusterDensity(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const +{ + // + // TPC cluster density - only rows where signal before and after given row are used + // - slower function + // type 0: get fraction of found/findable clusters with neighbourhood definition + // 1: findable clusters with neighbourhood definition + // 2: found clusters + // bitType: + // 0 - all cluster used + // 1 - clusters used for the kalman update + // definition of findable clusters: + // a cluster is defined as findable if there is another cluster + // within +- nNeighbours pad rows. The idea is to overcome threshold + // effects with a very simple algorithm. + // + Int_t found=0; + Int_t findable=0; + // Int_t last=-nNeighbours; + const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap; + Int_t upperBound=clusterMap.GetNbits(); + if (upperBound>row1) upperBound=row1; + for (Int_t i=row0; i=0 && clusterMap[i-idelta]) isDown=kTRUE; + if (i+idelta4 || p2>4) return -1; - Double_t e12 = kpmass[p1]*kpmass[p1]+fPmom[0]*fPmom[0]+fPmom[1]*fPmom[1]+fPmom[2]*fPmom[2]; - Double_t e22 = kpmass[p2]*kpmass[p2]+fNmom[0]*fNmom[0]+fNmom[1]*fNmom[1]+fNmom[2]*fNmom[2]; + const AliExternalTrackParam *paramP = GetParamP(); + const AliExternalTrackParam *paramN = GetParamN(); + if (paramP->GetParameter()[4]<0){ + paramP=GetParamN(); + paramN=GetParamP(); + } + Double_t pmom[3]={0}, nmom[3]={0}; + paramP->GetPxPyPz(pmom); + paramN->GetPxPyPz(nmom); + Double_t e12 = kpmass[p1]*kpmass[p1]+pmom[0]*pmom[0]+pmom[1]*pmom[1]+pmom[2]*pmom[2]; + Double_t e22 = kpmass[p2]*kpmass[p2]+nmom[0]*nmom[0]+nmom[1]*nmom[1]+nmom[2]*nmom[2]; Double_t cmass = TMath::Sqrt(TMath::Max(kpmass[p1]*kpmass[p1]+kpmass[p2]*kpmass[p2] - +2.*(TMath::Sqrt(e12*e22)-fPmom[0]*fNmom[0]-fPmom[1]*fNmom[1]-fPmom[2]*fNmom[2]),0.)); + +2.*(TMath::Sqrt(e12*e22)-pmom[0]*nmom[0]-pmom[1]*nmom[1]-pmom[2]*nmom[2]),0.)); return cmass; } + + + +Double_t AliESDv0::GetKFInfo(UInt_t p1, UInt_t p2, Int_t type) const{ + // + // type: + // 0 - return mass + // 1 - return err mass + // 2 - return chi2 + // + const Int_t spdg[5]={kPositron,kMuonPlus,kPiPlus, kKPlus, kProton}; + const AliExternalTrackParam *paramP = GetParamP(); + const AliExternalTrackParam *paramN = GetParamN(); + if (paramP->GetSign()<0){ + paramP=GetParamN(); + paramN=GetParamP(); + } + AliKFParticle kfp1( *(paramP), spdg[p1] *TMath::Sign(1,p1) ); + AliKFParticle kfp2( *(paramN), spdg[p2] *TMath::Sign(1,p2) ); + AliKFParticle *V0KF = new AliKFParticle; + *(V0KF)+=kfp1; + *(V0KF)+=kfp2; + if (type==0) return V0KF->GetMass(); + if (type==1) return V0KF->GetErrMass(); + if (type==2) return V0KF->GetChi2(); + return 0; +} + + +Double_t AliESDv0::GetKFInfoScale(UInt_t p1, UInt_t p2, Int_t type, Double_t d1pt, Double_t s1pt) const{ + // + // type + // 0 - return mass + // 1 - return err mass + // 2 - return chi2 + // d1pt - 1/pt shift + // s1pt - scaling of 1/pt + // Important function to benchmark the pt resolution, and to find out systematic distortion + // + const Int_t spdg[5]={kPositron,kMuonPlus,kPiPlus, kKPlus, kProton}; + const AliExternalTrackParam *paramP = GetParamP(); + const AliExternalTrackParam *paramN = GetParamN(); + if (paramP->GetSign()<0){ + paramP=GetParamP(); + paramN=GetParamN(); + } + Double_t *pparam1 = (Double_t*)paramP->GetParameter(); + Double_t *pparam2 = (Double_t*)paramN->GetParameter(); + pparam1[4]+=d1pt; + pparam2[4]+=d1pt; + pparam1[4]*=(1+s1pt); + pparam2[4]*=(1+s1pt); + // + AliKFParticle kfp1( *paramP, spdg[p1] *TMath::Sign(1,p1) ); + AliKFParticle kfp2( *paramN, spdg[p2] *TMath::Sign(1,p2) ); + AliKFParticle *V0KF = new AliKFParticle; + *(V0KF)+=kfp1; + *(V0KF)+=kfp2; + if (type==0) return V0KF->GetMass(); + if (type==1) return V0KF->GetErrMass(); + if (type==2) return V0KF->GetChi2(); + return 0; +} diff --git a/STEER/ESD/AliESDv0.h b/STEER/ESD/AliESDv0.h index d5d5aebfa22..cbab5440a2b 100644 --- a/STEER/ESD/AliESDv0.h +++ b/STEER/ESD/AliESDv0.h @@ -55,7 +55,7 @@ public: virtual Short_t Charge() const { return 0; } virtual Int_t GetLabel() const { return -1; } // temporary virtual const Double_t *PID() const { return 0; } // return PID object ? (to be discussed!) - + // Then extend the AliVParticle functions Double_t E(Int_t pdg) const; Double_t Y(Int_t pdg) const; @@ -139,8 +139,9 @@ public: //virtual Bool_t GetPxPyPz(Double_t */*p*/) const { return kFALSE; } virtual void SetID(Short_t /*id*/) {;} - - + Double_t GetKFInfo(UInt_t p1, UInt_t p2, Int_t type) const; + Double_t GetKFInfoScale(UInt_t p1, UInt_t p2, Int_t type, Double_t d1pt, Double_t s1pt) const; + // protected: AliExternalTrackParam fParamN; // external parameters of negative particle AliExternalTrackParam fParamP; // external parameters of positive particle diff --git a/STEER/STEERBase/AliVTrack.h b/STEER/STEERBase/AliVTrack.h index 2f41666bf03..5a5ca56679a 100644 --- a/STEER/STEERBase/AliVTrack.h +++ b/STEER/STEERBase/AliVTrack.h @@ -52,7 +52,7 @@ public: virtual Int_t GetID() const = 0; virtual UChar_t GetITSClusterMap() const = 0; - virtual Float_t GetTPCClusterInfo(Int_t /*nNeighbours*/, Int_t /*type*/, Int_t /*row0*/=0, Int_t /*row1*/=159) const {return 0.;} + virtual Float_t GetTPCClusterInfo(Int_t /*nNeighbours*/, Int_t /*type*/, Int_t /*row0*/=0, Int_t /*row1*/=159, Int_t /*type*/= 0) const {return 0.;} virtual AliTPCdEdxInfo * GetTPCdEdxInfo() {return 0x0;} virtual UShort_t GetTPCNcls() const { return 0;} virtual UShort_t GetTPCNclsF() const { return 0;} -- 2.43.0