X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliESD.cxx;h=a4a37f4de3fa1d444a96d8e0f4765ac931b39cfe;hb=22d7ad3e9feed9134beae1391f5550bb52c44b6c;hp=6b12b4876a9ca96ea51bb6fb0c680428159a921d;hpb=80799a5f47f7fc139d0fb9e7138b507f98ba2223;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliESD.cxx b/STEER/AliESD.cxx index 6b12b4876a9..a4a37f4de3f 100644 --- a/STEER/AliESD.cxx +++ b/STEER/AliESD.cxx @@ -50,7 +50,9 @@ AliESD::AliESD(): fSPDVertex(), fPrimaryVertex(), fSPDMult(), + fT0clock(0), fT0timeStart(0), + fT0trig(0), fTracks("AliESDtrack",15000), fHLTConfMapTracks("AliESDHLTtrack",25000), fHLTHoughTracks("AliESDHLTtrack",15000), @@ -71,10 +73,15 @@ AliESD::AliESD(): fPHOSTriggerAmplitudes(0x0), fESDFMD(0x0), fESDVZERO(0x0), + fESDACORDE(0x0), fErrorLogs("AliRawDataErrorLog",5) - { - for (Int_t i=0; i<24; i++) { + // + // Standar constructor + // + + for (Int_t i=0; i<3; i++) fT0TOF[i] = 0; + for (Int_t i=0; i<24; i++) { fT0time[i] = 0; fT0amplitude[i] = 0; } @@ -106,7 +113,9 @@ AliESD::AliESD(const AliESD& esd): fSPDVertex(esd.fSPDVertex), fPrimaryVertex(esd.fPrimaryVertex), fSPDMult(esd.fSPDMult), + fT0clock(esd.fT0clock), fT0timeStart(esd.fT0timeStart), + fT0trig(esd.fT0trig), fTracks(*((TClonesArray*)esd.fTracks.Clone())), fHLTConfMapTracks(*((TClonesArray*)esd.fHLTConfMapTracks.Clone())), fHLTHoughTracks(*((TClonesArray*)esd.fHLTHoughTracks.Clone())), @@ -127,8 +136,13 @@ AliESD::AliESD(const AliESD& esd): fPHOSTriggerAmplitudes(esd.fPHOSTriggerAmplitudes), fESDFMD(esd.fESDFMD), fESDVZERO(esd.fESDVZERO), + fESDACORDE(esd.fESDACORDE), fErrorLogs(*((TClonesArray*)esd.fErrorLogs.Clone())) { + // + // copy constructor + // + for (Int_t i=0; i<3; i++)fT0TOF[i] = esd.fT0TOF[i]; for (Int_t i=0; i<24; i++) { fT0time[i] = esd.fT0time[i]; fT0amplitude[i] = esd.fT0amplitude[i]; @@ -155,14 +169,12 @@ AliESD::~AliESD() fCaloClusters.Delete(); delete fESDFMD; delete fESDVZERO; -// fEMCALTriggerPosition->Delete(); -// fEMCALTriggerAmplitudes->Delete(); -// fPHOSTriggerPosition->Delete(); -// fPHOSTriggerAmplitudes->Delete(); -// delete fEMCALTriggerPosition; -// delete fEMCALTriggerAmplitudes; -// delete fPHOSTriggerPosition; -// delete fPHOSTriggerAmplitudes; + delete fEMCALTriggerPosition; + delete fEMCALTriggerAmplitudes; + delete fPHOSTriggerPosition; + delete fPHOSTriggerAmplitudes; + delete fESDACORDE; + fErrorLogs.Delete(); } @@ -170,6 +182,10 @@ AliESD::~AliESD() //______________________________________________________________________________ void AliESD::Reset() { + // + // Reset the contents and delete the entries in TClonesArrays + // + fEventNumberInFile=0; fBunchCrossNumber=0; fOrbitNumber=0; @@ -188,50 +204,331 @@ void AliESD::Reset() fZDCEMEnergy=0; fZDCParticipants=0; fT0zVertex=0; + + for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.; + for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=0.; + + for (Int_t i=0; i<24; i++) { + fT0time[i] = 0; + fT0amplitude[i] = 0; + } fT0timeStart = 0; + fT0clock = 0; + for (Int_t i=0; i<3; i++) fT0TOF[i] = 0; +// + fSPDMult.~AliMultiplicity(); + new (&fSPDMult) AliMultiplicity(); + fSPDVertex.~AliESDVertex(); new (&fSPDVertex) AliESDVertex(); + fPrimaryVertex.~AliESDVertex(); new (&fPrimaryVertex) AliESDVertex(); - new (&fSPDMult) AliMultiplicity(); - fTracks.Clear(); - fHLTConfMapTracks.Clear(); - fHLTHoughTracks.Clear(); - fMuonTracks.Clear(); - fPmdTracks.Clear(); - fTrdTracks.Clear(); - fV0s.Clear(); - fCascades.Clear(); - fCaloClusters.Clear(); +// + fTracks.Delete(); + fHLTConfMapTracks.Delete(); + fHLTHoughTracks.Delete(); + fMuonTracks.Delete(); + fPmdTracks.Delete(); + fTrdTracks.Delete(); + fV0s.Delete(); + fCascades.Delete(); + fKinks.Delete(); + fCaloClusters.Delete(); +// fEMCALClusters=0; fFirstEMCALCluster=-1; fPHOSClusters=0; fFirstPHOSCluster=-1; +// + if (fEMCALTriggerPosition) fEMCALTriggerPosition ->Reset(); + if (fEMCALTriggerAmplitudes) fEMCALTriggerAmplitudes->Reset(); + if (fPHOSTriggerPosition) fPHOSTriggerPosition ->Reset(); + if (fPHOSTriggerAmplitudes) fPHOSTriggerAmplitudes ->Reset(); +// if (fESDFMD) fESDFMD->Clear(); -// fEMCALTriggerPosition->Clear(); -// fEMCALTriggerAmplitudes->Clear(); -// fPHOSTriggerPosition->Clear(); -// fPHOSTriggerAmplitudes->Clear(); - fErrorLogs.Clear(); +// + if (fESDVZERO){ + fESDVZERO->~AliESDVZERO(); + new (fESDVZERO) AliESDVZERO(); + } +// + if (fESDACORDE){ + fESDACORDE->~AliESDACORDE(); + new (fESDACORDE) AliESDACORDE(); + } +// + fErrorLogs.Delete(); +} + + +Bool_t AliESD::RemoveKink(Int_t rm) { + // --------------------------------------------------------- + // Remove a kink candidate and references to it from ESD, + // if this candidate does not come from a reconstructed decay + // Not yet implemented... + // --------------------------------------------------------- + Int_t last=GetNumberOfKinks()-1; + if ((rm<0)||(rm>last)) return kFALSE; + + return kTRUE; } -Bool_t AliESD::RemoveTrack(Int_t /*i*/) { +Bool_t AliESD::RemoveV0(Int_t rm) { // --------------------------------------------------------- - // Remove track + // Remove a V0 candidate and references to it from ESD, + // if this candidate does not come from a reconstructed decay // --------------------------------------------------------- + Int_t last=GetNumberOfV0s()-1; + if ((rm<0)||(rm>last)) return kFALSE; + + AliESDv0 *v0=GetV0(rm); + Int_t idxP=v0->GetPindex(), idxN=v0->GetNindex(); + + v0=GetV0(last); + Int_t lastIdxP=v0->GetPindex(), lastIdxN=v0->GetNindex(); + + Int_t used=0; + + // Check if this V0 comes from a reconstructed decay + Int_t ncs=GetNumberOfCascades(); + for (Int_t n=0; nGetPindex(); + Int_t csIdxN=cs->GetNindex(); + if (idxP==csIdxP) + if (idxN==csIdxN) return kFALSE; + + if (csIdxP==lastIdxP) + if (csIdxN==lastIdxN) used++; + } + + //Replace the removed V0 with the last V0 + TClonesArray &a=fV0s; + delete a.RemoveAt(rm); + + if (rm==last) return kTRUE; + + //v0 is pointing to the last V0 candidate... + new (a[rm]) AliESDv0(*v0); + delete a.RemoveAt(last); + + if (!used) return kTRUE; + + + // Remap the indices of the daughters of reconstructed decays + for (Int_t n=0; nGetPindex(); + Int_t csIdxN=cs->GetNindex(); + + if (csIdxP==lastIdxP) + if (csIdxN==lastIdxN) { + cs->AliESDv0::SetIndex(1,idxP); + cs->AliESDv0::SetIndex(0,idxN); + used--; + if (!used) return kTRUE; + } + } + + return kTRUE; +} + +Bool_t AliESD::RemoveTrack(Int_t rm) { + // --------------------------------------------------------- + // Remove a track and references to it from ESD, + // if this track does not come from a reconstructed decay + // --------------------------------------------------------- + Int_t last=GetNumberOfTracks()-1; + if ((rm<0)||(rm>last)) return kFALSE; + + Int_t used=0; + + // Check if this track comes from the reconstructed primary vertex + if (fPrimaryVertex.GetStatus()) { + UShort_t *primIdx=fPrimaryVertex.GetIndices(); + Int_t n=fPrimaryVertex.GetNIndices(); + while (n--) { + Int_t idx=Int_t(primIdx[n]); + if (rm==idx) return kFALSE; + if (idx==last) used++; + } + } + // Check if this track comes from a reconstructed decay - // if (yes) return kFALSE + Int_t nv0=GetNumberOfV0s(); + for (Int_t n=0; nGetNindex(); + if (rm==idx) return kFALSE; + if (idx==last) used++; - // Remove the track - // delete fTracks->RemoveAt(i); + idx=v0->GetPindex(); + if (rm==idx) return kFALSE; + if (idx==last) used++; + } + + Int_t ncs=GetNumberOfCascades(); + for (Int_t n=0; nGetIndex(); + if (rm==idx) return kFALSE; + if (idx==last) used++; + } - // Compress the array with tracks - // fTracks->Compress(); + Int_t nkn=GetNumberOfKinks(); + for (Int_t n=0; nGetIndex(0); + if (rm==idx) return kFALSE; + if (idx==last) used++; + + idx=kn->GetIndex(1); + if (rm==idx) return kFALSE; + if (idx==last) used++; + } + + + //Replace the removed track with the last track + TClonesArray &a=fTracks; + delete a.RemoveAt(rm); + + if (rm==last) return kTRUE; + + AliESDtrack *t=GetTrack(last); + t->SetID(rm); + new (a[rm]) AliESDtrack(*t); + delete a.RemoveAt(last); + + + if (!used) return kTRUE; + + + // Remap the indices of the tracks used for the primary vertex reconstruction + if (fPrimaryVertex.GetStatus()) { + UShort_t *primIdx=fPrimaryVertex.GetIndices(); + Int_t n=fPrimaryVertex.GetNIndices(); + while (n--) { + Int_t idx=Int_t(primIdx[n]); + if (idx==last) { + primIdx[n]=Short_t(rm); + used--; + if (!used) return kTRUE; + } + } + } + + // Remap the indices of the daughters of reconstructed decays + for (Int_t n=0; nGetIndex(0)==last) { + v0->SetIndex(0,rm); + used--; + if (!used) return kTRUE; + } + if (v0->GetIndex(1)==last) { + v0->SetIndex(1,rm); + used--; + if (!used) return kTRUE; + } + } + + for (Int_t n=0; nGetIndex()==last) { + cs->SetIndex(rm); + used--; + if (!used) return kTRUE; + } + } + + for (Int_t n=0; nGetIndex(0)==last) { + kn->SetIndex(rm,0); + used--; + if (!used) return kTRUE; + } + if (kn->GetIndex(1)==last) { + kn->SetIndex(rm,1); + used--; + if (!used) return kTRUE; + } + } return kTRUE; } + +Bool_t AliESD::Clean(Float_t *cleanPars) { + // + // Remove the data which are not needed for the physics analysis. + // + // 1) Cleaning the V0 candidates + // --------------------------- + // If the cosine of the V0 pointing angle "csp" and + // the DCA between the daughter tracks "dca" does not satisfy + // the conditions + // + // csp > cleanPars[1] + dca/cleanPars[0]*(1.- cleanPars[1]) + // + // an attempt to remove this V0 candidate from ESD is made. + // + // The V0 candidate gets removed if it does not belong to any + // recosntructed cascade decay + // + // 12.11.2007, optimal values: cleanPars[0]=0.5, cleanPars[1]=0.999 + // + // 2) Cleaning the tracks + // ---------------------- + // If track's transverse parameter is larger than cleanPars[2] + // OR + // track's longitudinal parameter is larger than cleanPars[3] + // an attempt to remove this track from ESD is made. + // + // The track gets removed if it does not come + // from a reconstructed decay + // + Bool_t rc=kFALSE; + + Float_t dcaMax=cleanPars[0]; + Float_t cspMin=cleanPars[1]; + + Int_t nV0s=GetNumberOfV0s(); + for (Int_t i=nV0s-1; i>=0; i--) { + AliESDv0 *v0=GetV0(i); + + Float_t dca=v0->GetDcaV0Daughters(); + Float_t csp=v0->GetV0CosineOfPointingAngle(); + Float_t cspcut=cspMin + dca/dcaMax*(1.-cspMin); + if (csp > cspcut) continue; + + if (RemoveV0(i)) rc=kTRUE; + } + + + Float_t dmax=cleanPars[2], zmax=cleanPars[3]; + + const AliESDVertex *vertex=GetVertex(); + Bool_t vtxOK=vertex->GetStatus(); + + Int_t nTracks=GetNumberOfTracks(); + for (Int_t i=nTracks-1; i>=0; i--) { + AliESDtrack *track=GetTrack(i); + Float_t xy,z; track->GetImpactParameters(xy,z); + if ((TMath::Abs(xy) > dmax) || (vtxOK && (TMath::Abs(z) > zmax))) { + if (RemoveTrack(i)) rc=kTRUE; + } + } + + return rc; +} + Int_t AliESD::AddV0(const AliESDv0 *v) { // // Add V0 @@ -313,3 +610,17 @@ void AliESD::GetESDfriend(AliESDfriend *ev) const { } } + +void AliESD::SetDiamond(const AliESDVertex *vertex) +{ + // + // Set the interaction diamond + // + fDiamondXY[0]=vertex->GetXv(); + fDiamondXY[1]=vertex->GetYv(); + Double_t cov[6]; + vertex->GetCovMatrix(cov); + fDiamondCovXY[0]=cov[0]; + fDiamondCovXY[1]=cov[1]; + fDiamondCovXY[2]=cov[2]; + }