From 3dd9f9e3af5cf2db9af248e762f5ea4112c477ae Mon Sep 17 00:00:00 2001 From: markus Date: Tue, 16 Oct 2007 09:25:33 +0000 Subject: [PATCH] Make full use of newly introduced functionality: - different cluster types added - V0s added - updated filling procedures - clean-up and testing --- STEER/AODLinkDef.h | 4 + STEER/AliAODEvent.cxx | 99 +++++++++++------ STEER/AliAODEvent.h | 79 ++++++++++---- STEER/AliReconstruction.cxx | 204 ++++++++++++++++++++++-------------- STEER/CreateAODfromESD.C | 200 +++++++++++++++++++++-------------- STEER/libAOD.pkg | 5 +- 6 files changed, 383 insertions(+), 208 deletions(-) diff --git a/STEER/AODLinkDef.h b/STEER/AODLinkDef.h index 229200b54e6..cf18426d516 100644 --- a/STEER/AODLinkDef.h +++ b/STEER/AODLinkDef.h @@ -19,6 +19,9 @@ #pragma link C++ class AliAODTrack+; #pragma link C++ class AliAODVertex+; #pragma link C++ class AliAODCluster+; +#pragma link C++ class AliAODCaloCluster+; +#pragma link C++ class AliAODPmdCluster+; +#pragma link C++ class AliAODFmdCluster+; #pragma link C++ class AliAODJet+; #pragma link C++ class AliAODPhoton+; #pragma link C++ class AliAODRedCov<3>+; @@ -30,6 +33,7 @@ #pragma link C++ class AliAODInputHandler+; #pragma link C++ class AliAODTracklets+; #pragma link C++ class AliAODTagCreator+; +#pragma link C++ class AliAODCaloCells+; #endif diff --git a/STEER/AliAODEvent.cxx b/STEER/AliAODEvent.cxx index ddaede88b03..cd03bf9fa47 100644 --- a/STEER/AliAODEvent.cxx +++ b/STEER/AliAODEvent.cxx @@ -32,9 +32,14 @@ ClassImp(AliAODEvent) const char* AliAODEvent::fAODListName[kAODListN] = {"header", "tracks", "vertices", - "clusters", + "v0s", + "tracklets", "jets", - "tracklets"}; + "caloCells", + "caloClusters", + "fmdClusters", + "pmdClusters" +}; //______________________________________________________________________________ AliAODEvent::AliAODEvent() : AliVEvent(), @@ -42,9 +47,13 @@ AliAODEvent::AliAODEvent() : fHeader(0), fTracks(0), fVertices(0), - fClusters(0), + fV0s(0), + fTracklets(0), fJets(0), - fTracklets(0) + fCaloCells(0), + fCaloClusters(0), + fFmdClusters(0), + fPmdClusters(0) { // default constructor } @@ -83,10 +92,14 @@ void AliAODEvent::CreateStdContent() AddObject(new AliAODHeader()); AddObject(new TClonesArray("AliAODTrack", 0)); AddObject(new TClonesArray("AliAODVertex", 0)); - AddObject(new TClonesArray("AliAODCluster", 0)); - AddObject(new TClonesArray("AliAODJet", 0)); + AddObject(new TClonesArray("AliAODv0", 0)); AddObject(new AliAODTracklets()); - + AddObject(new TClonesArray("AliAODJet", 0)); + AddObject(new AliAODCaloCells()); + AddObject(new TClonesArray("AliAODCaloCluster", 0)); + AddObject(new TClonesArray("AliAODFmdCluster", 0)); + AddObject(new TClonesArray("AliAODPmdCluster", 0)); + // set names SetStdNames(); @@ -122,27 +135,29 @@ void AliAODEvent::GetStdContent() { // set pointers for standard content - fHeader = (AliAODHeader*)fAODObjects->FindObject("header"); - fTracks = (TClonesArray*)fAODObjects->FindObject("tracks"); - fVertices = (TClonesArray*)fAODObjects->FindObject("vertices"); - fClusters = (TClonesArray*)fAODObjects->FindObject("clusters"); - fJets = (TClonesArray*)fAODObjects->FindObject("jets"); - fTracklets = (AliAODTracklets*)fAODObjects->FindObject("tracklets"); - - /* old implementation - fHeader = (AliAODHeader*)fAODObjects->At(0); - fTracks = (TClonesArray*)fAODObjects->At(1); - fVertices = (TClonesArray*)fAODObjects->At(2); - fClusters = (TClonesArray*)fAODObjects->At(3); - fJets = (TClonesArray*)fAODObjects->At(4); - fTracklets = (AliAODTracklets*)fAODObjects->At(5); - */ + fHeader = (AliAODHeader*)fAODObjects->FindObject("header"); + fTracks = (TClonesArray*)fAODObjects->FindObject("tracks"); + fVertices = (TClonesArray*)fAODObjects->FindObject("vertices"); + fV0s = (TClonesArray*)fAODObjects->FindObject("v0s"); + fTracklets = (AliAODTracklets*)fAODObjects->FindObject("tracklets"); + fJets = (TClonesArray*)fAODObjects->FindObject("jets"); + fCaloCells = (AliAODCaloCells*)fAODObjects->FindObject("caloCells"); + fCaloClusters = (TClonesArray*)fAODObjects->FindObject("caloClusters"); + fFmdClusters = (TClonesArray*)fAODObjects->FindObject("fmdClusters"); + fPmdClusters = (TClonesArray*)fAODObjects->FindObject("pmdClusters"); } //______________________________________________________________________________ -void AliAODEvent::ResetStd(Int_t trkArrSize, Int_t vtxArrSize) +void AliAODEvent::ResetStd(Int_t trkArrSize, + Int_t vtxArrSize, + Int_t v0ArrSize, + Int_t jetSize, + Int_t caloClusSize, + Int_t fmdClusSize, + Int_t pmdClusSize) { - // deletes content of standard arrays and resets size + // deletes content of standard arrays and resets size + fTracks->Delete(); if (trkArrSize > fTracks->GetSize()) fTracks->Expand(trkArrSize); @@ -150,16 +165,40 @@ void AliAODEvent::ResetStd(Int_t trkArrSize, Int_t vtxArrSize) fVertices->Delete(); if (vtxArrSize > fVertices->GetSize()) fVertices->Expand(vtxArrSize); + + fV0s->Delete(); + if (v0ArrSize > fV0s->GetSize()) + fV0s->Expand(v0ArrSize); + + fJets->Delete(); + if (jetSize > fJets->GetSize()) + fJets->Expand(jetSize); + + fCaloClusters->Delete(); + if (caloClusSize > fCaloClusters->GetSize()) + fCaloClusters->Expand(caloClusSize); + + fFmdClusters->Delete(); + if (fmdClusSize > fFmdClusters->GetSize()) + fFmdClusters->Expand(fmdClusSize); + + fPmdClusters->Delete(); + if (pmdClusSize > fPmdClusters->GetSize()) + fPmdClusters->Expand(pmdClusSize); } void AliAODEvent::ClearStd() { // clears the standard arrays - fTracks ->Clear(); - fVertices ->Clear(); - fClusters ->Clear(); - fJets ->Clear(); - fTracklets->DeleteContainer(); + fTracks ->Clear(); + fVertices ->Clear(); + fV0s ->Clear(); + fTracklets ->DeleteContainer(); + fJets ->Clear(); + fCaloCells ->DeleteContainer(); + fCaloClusters ->Clear(); + fFmdClusters ->Clear(); + fPmdClusters ->Clear(); } //______________________________________________________________________________ @@ -176,7 +215,7 @@ Int_t AliAODEvent::GetMuonTracks(TRefArray *muonTracks) const } } - return muonTracks->GetSize(); + return muonTracks->GetEntriesFast(); } diff --git a/STEER/AliAODEvent.h b/STEER/AliAODEvent.h index 15d4eec1726..6e935a5630f 100644 --- a/STEER/AliAODEvent.h +++ b/STEER/AliAODEvent.h @@ -21,9 +21,13 @@ #include "AliAODHeader.h" #include "AliAODTrack.h" #include "AliAODVertex.h" -#include "AliAODCluster.h" -#include "AliAODJet.h" +#include "AliAODv0.h" #include "AliAODTracklets.h" +#include "AliAODJet.h" +#include "AliAODCaloCells.h" +#include "AliAODCaloCluster.h" +#include "AliAODPmdCluster.h" +#include "AliAODFmdCluster.h" class TTree; @@ -33,9 +37,13 @@ class AliAODEvent : public AliVEvent { enum AODListIndex_t {kAODHeader, kAODTracks, kAODVertices, - kAODClusters, - kAODJets, + kAODv0, kAODTracklets, + kAODJets, + kAODCaloCells, + kAODCaloClusters, + kAODFmdClusters, + kAODPmdClusters, kAODListN }; @@ -99,15 +107,37 @@ class AliAODEvent : public AliVEvent { AliAODVertex *GetVertex(Int_t nVertex) const { return (AliAODVertex*)fVertices->UncheckedAt(nVertex); } Int_t AddVertex(const AliAODVertex* vtx) {new((*fVertices)[fVertices->GetEntriesFast()]) AliAODVertex(*vtx); return fVertices->GetEntriesFast()-1;} - virtual AliAODVertex *GetPrimaryVertex() const { return GetVertex(0); } + // primary vertex + virtual AliAODVertex *GetPrimaryVertex() const { return GetVertex(0); } - // -- Cluster - TClonesArray *GetClusters() const { return fClusters; } - Int_t GetNClusters() const { return fClusters->GetEntriesFast(); } - AliAODCluster *GetCluster(Int_t nCluster) const { return (AliAODCluster*)fClusters->UncheckedAt(nCluster); } - Int_t AddCluster(const AliAODCluster* vtx) - {new((*fClusters)[fClusters->GetEntriesFast()]) AliAODCluster(*vtx); return fClusters->GetEntriesFast()-1;} + // V0 + TClonesArray *GetV0s() const { return fV0s; } + Int_t GetNV0s() const { return fV0s->GetEntriesFast(); } + AliAODv0 *GetV0(Int_t nV0) const { return (AliAODv0*)fV0s->UncheckedAt(nV0); } + Int_t AddV0(const AliAODv0* v0) + {new((*fV0s)[fV0s->GetEntriesFast()]) AliAODv0(*v0); return fV0s->GetEntriesFast()-1;} + + // -- EMCAL and PHOS Cluster + TClonesArray *GetCaloClusters() const { return fCaloClusters; } + Int_t GetNCaloClusters() const { return fCaloClusters->GetEntriesFast(); } + AliAODCaloCluster *GetCaloCluster(Int_t nCluster) const { return (AliAODCaloCluster*)fCaloClusters->UncheckedAt(nCluster); } + Int_t AddCaloCluster(const AliAODCaloCluster* clus) + {new((*fCaloClusters)[fCaloClusters->GetEntriesFast()]) AliAODCaloCluster(*clus); return fCaloClusters->GetEntriesFast()-1;} + + // -- FMD Cluster + TClonesArray *GetFmdClusters() const { return fFmdClusters; } + Int_t GetNFmdClusters() const { return fFmdClusters->GetEntriesFast(); } + AliAODFmdCluster *GetFmdCluster(Int_t nCluster) const { return (AliAODFmdCluster*)fFmdClusters->UncheckedAt(nCluster); } + Int_t AddFmdCluster(const AliAODFmdCluster* clus) + {new((*fFmdClusters)[fFmdClusters->GetEntriesFast()]) AliAODFmdCluster(*clus); return fFmdClusters->GetEntriesFast()-1;} + + // -- PMD Cluster + TClonesArray *GetPmdClusters() const { return fPmdClusters; } + Int_t GetNPmdClusters() const { return fPmdClusters->GetEntriesFast(); } + AliAODPmdCluster *GetPmdCluster(Int_t nCluster) const { return (AliAODPmdCluster*)fPmdClusters->UncheckedAt(nCluster); } + Int_t AddPmdCluster(const AliAODPmdCluster* clus) + {new((*fPmdClusters)[fPmdClusters->GetEntriesFast()]) AliAODPmdCluster(*clus); return fPmdClusters->GetEntriesFast()-1;} // -- Jet TClonesArray *GetJets() const { return fJets; } @@ -119,11 +149,20 @@ class AliAODEvent : public AliVEvent { // -- Tracklets AliAODTracklets *GetTracklets() const { return fTracklets; } + // -- Calorimeter Cells + AliAODCaloCells *GetCaloCells() const { return fCaloCells; } + // -- Services void CreateStdContent(); void SetStdNames(); void GetStdContent(); - void ResetStd(Int_t trkArrSize = 0, Int_t vtxArrSize = 0); + void ResetStd(Int_t trkArrSize = 0, + Int_t vtxArrSize = 0, + Int_t v0ArrSize = 0, + Int_t jetSize = 0, + Int_t caloClusSize = 0, + Int_t fmdClusSize = 0, + Int_t pmdClusSize = 0); void ClearStd(); void ReadFromTree(TTree *tree); const void WriteToTree(TTree* tree) const {tree->Branch(fAODObjects);} @@ -135,12 +174,16 @@ class AliAODEvent : public AliVEvent { TList *fAODObjects; // list of AODObjects // standard content - AliAODHeader *fHeader; //! event information - TClonesArray *fTracks; //! charged tracks - TClonesArray *fVertices; //! vertices - TClonesArray *fClusters; //! neutral particles - TClonesArray *fJets; //! jets - AliAODTracklets *fTracklets; //! SPD tracklets + AliAODHeader *fHeader; //! event information + TClonesArray *fTracks; //! charged tracks + TClonesArray *fVertices; //! vertices + TClonesArray *fV0s; //! V0s + AliAODTracklets *fTracklets; //! SPD tracklets + TClonesArray *fJets; //! jets + AliAODCaloCells *fCaloCells; //! EMCAL and PHOS calorimenter cells + TClonesArray *fCaloClusters; //! calorimeter clusters + TClonesArray *fFmdClusters; //! FMDclusters + TClonesArray *fPmdClusters; //! PMDclusters static const char* fAODListName[kAODListN]; //! diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index b91e0e1c494..eca90602b26 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -121,6 +121,8 @@ #include #include #include +#include +#include #include "AliReconstruction.h" #include "AliCodeTimer.h" @@ -151,6 +153,7 @@ #include "AliPID.h" #include "AliESDpid.h" #include "AliESDtrack.h" +#include "AliESDPmdTrack.h" #include "AliESDTagCreator.h" #include "AliAODTagCreator.h" @@ -168,7 +171,13 @@ #include "AliAODHeader.h" #include "AliAODTrack.h" #include "AliAODVertex.h" -#include "AliAODCluster.h" +#include "AliAODv0.h" +#include "AliAODJet.h" +#include "AliAODCaloCells.h" +#include "AliAODCaloCluster.h" +#include "AliAODPmdCluster.h" +#include "AliAODFmdCluster.h" +#include "AliAODTracklets.h" #include "AliQADataMaker.h" @@ -1891,12 +1900,15 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) Float_t posF[3]; Double_t pos[3]; Double_t p[3]; + Double_t p_pos[3]; + Double_t p_neg[3]; Double_t covVtx[6]; Double_t covTr[21]; Double_t pid[10]; // loop over events and fill them for (Int_t iEvent = 0; iEvent < nEvents; ++iEvent) { + //cout << "event: " << iEvent << endl; t->GetEntry(iEvent); // Multiplicity information needed by the header (to be revised!) @@ -1931,10 +1943,13 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) Int_t nV0s = esd->GetNumberOfV0s(); Int_t nCascades = esd->GetNumberOfCascades(); Int_t nKinks = esd->GetNumberOfKinks(); - Int_t nVertices = nV0s + nCascades + nKinks; - - aod->ResetStd(nTracks, nVertices); - AliAODTrack *aodTrack; + Int_t nVertices = nV0s + nCascades + nKinks + 1 /* = prim. vtx*/; + Int_t nJets = 0; + Int_t nCaloClus = esd->GetNumberOfCaloClusters(); + Int_t nFmdClus = 0; + Int_t nPmdClus = esd->GetNumberOfPmdTracks(); + + aod->ResetStd(nTracks, nVertices, nV0s+nCascades, nJets, nCaloClus, nFmdClus, nPmdClus); // Array to take into account the tracks already added to the AOD Bool_t * usedTrack = NULL; @@ -1954,7 +1969,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) usedKink = new Bool_t[nKinks]; for (Int_t iKink=0; iKinkGetVertices()); Int_t jVertices=0; @@ -1962,7 +1977,11 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) // Access to the AOD container of tracks TClonesArray &tracks = *(aod->GetTracks()); Int_t jTracks=0; - + + // Access to the AOD container of V0s + TClonesArray &V0s = *(aod->GetV0s()); + Int_t jV0s=0; + // Add primary vertex. The primary tracks will be defined // after the loops on the composite objects (V0, cascades, kinks) const AliESDVertex *vtx = esd->GetPrimaryVertex(); @@ -1973,13 +1992,16 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) AliAODVertex * primary = new(vertices[jVertices++]) AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, -1, AliAODVertex::kPrimary); + + AliAODTrack *aodTrack = 0x0; + // Create vertices starting from the most complex objects - + // Cascades for (Int_t nCascade = 0; nCascade < nCascades; ++nCascade) { AliESDcascade *cascade = esd->GetCascade(nCascade); - cascade->GetXYZcascade(pos[0], pos[1], pos[2]); // Bo: bug correction + cascade->GetXYZ(pos[0], pos[1], pos[2]); cascade->GetPosCovXi(covVtx); // Add the cascade vertex @@ -1990,7 +2012,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) nCascade, AliAODVertex::kCascade); - primary->AddDaughter(vcascade); + primary->AddDaughter(vcascade); // the cascade 'particle' (represented by a vertex) is added as a daughter to the primary vertex // Add the V0 from the cascade. The ESD class have to be optimized... // Now we have to search for the corresponding V0 in the list of V0s @@ -1999,6 +2021,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) Int_t posFromV0 = cascade->GetPindex(); Int_t negFromV0 = cascade->GetNindex(); + AliESDv0 * v0 = 0x0; Int_t indV0 = -1; @@ -2016,7 +2039,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) AliAODVertex * vV0FromCascade = 0x0; - if (indV0>-1 && !usedV0[indV0] ) { + if (indV0>-1 && !usedV0[indV0]) { // the V0 exists in the array of V0s and is not used @@ -2048,6 +2071,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) indV0, AliAODVertex::kV0); vcascade->AddDaughter(vV0FromCascade); + } // Add the positive tracks from the V0 @@ -2057,7 +2081,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) usedTrack[posFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(posFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_pos); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -2065,7 +2089,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) vV0FromCascade->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_pos, kTRUE, pos, kFALSE, @@ -2092,7 +2116,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) usedTrack[negFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(negFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_neg); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -2100,7 +2124,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) vV0FromCascade->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_neg, kTRUE, pos, kFALSE, @@ -2120,6 +2144,11 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) << " track " << negFromV0 << " has already been used!" << endl; } + // add it to the V0 array as well + Double_t d0[2] = { -999., -99.}; + // counting is probably wrong + new(V0s[jV0s++]) AliAODv0(vV0FromCascade, -999., -99., p_pos, p_neg, d0); // to be refined + // Add the bachelor track from the cascade Int_t bachelor = cascade->GetBindex(); @@ -2156,19 +2185,19 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) cerr << "Error: event " << iEvent << " cascade " << nCascade << " track " << bachelor << " has already been used!" << endl; } - + // Add the primary track of the cascade (if any) - + } // end of the loop on cascades - + // V0s for (Int_t nV0 = 0; nV0 < nV0s; ++nV0) { if (usedV0[nV0]) continue; // skip if aready added to the AOD - AliESDv0 *v0 = esd->GetV0(nV0); - + AliESDv0 *v0 = esd->GetV0(nV0); + v0->GetXYZ(pos[0], pos[1], pos[2]); v0->GetPosCov(covVtx); @@ -2191,7 +2220,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) usedTrack[posFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(posFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_pos); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -2199,7 +2228,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) vV0->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_pos, kTRUE, pos, kFALSE, @@ -2226,7 +2255,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) usedTrack[negFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(negFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_neg); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -2234,7 +2263,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) vV0->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_neg, kTRUE, pos, kFALSE, @@ -2254,6 +2283,9 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) << " track " << negFromV0 << " has already been used!" << endl; } + // add it to the V0 array as well + Double_t d0[2] = { 999., 99.}; + new(V0s[jV0s++]) AliAODv0(vV0, 999., 99., p_pos, p_neg, d0); // to be refined } // end of the loop on V0s // Kinks: it is a big mess the access to the information in the kinks @@ -2262,7 +2294,6 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) for (Int_t iTrack=0; iTrackGetTrack(iTrack); Int_t ikink = esdTrack->GetKinkIndex(0); @@ -2386,18 +2417,12 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) cerr << "Error: event " << iEvent << " kink " << TMath::Abs(ikink)-1 << " track " << idaughter << " has already been used!" << endl; } - - } } - - } - + } } - // Tracks (primary and orphan) - for (Int_t nTrack = 0; nTrack < nTracks; ++nTrack) { @@ -2413,7 +2438,7 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) esdTrack->GetImpactParameters(impactXY,impactZ); - if (impactXY<3) { + if (impactXY<3.) { // track inside the beam pipe primary->AddDaughter(aodTrack = @@ -2436,25 +2461,11 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) } else { // outside the beam pipe: orphan track - aodTrack = - new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), - esdTrack->GetLabel(), - p, - kTRUE, - pos, - kFALSE, - covTr, - (Short_t)esdTrack->Charge(), - esdTrack->GetITSClusterMap(), - pid, - NULL, - kFALSE, // check if this is right - kFALSE, // check if this is right - AliAODTrack::kOrphan); - aodTrack->ConvertAliPIDtoAODPID(); + // Don't write them anymore! + continue; } } // end of loop on tracks - + // muon tracks Int_t nMuTracks = esd->GetNumberOfMuonTracks(); for (Int_t nMuTrack = 0; nMuTrack < nMuTracks; ++nMuTrack) { @@ -2495,56 +2506,91 @@ void AliReconstruction::ESDFile2AODFile(TFile* esdFile, TFile* aodFile) else aodTrack->SetChi2MatchTrigger(0.); } - + + // Access to the AOD container of PMD clusters + TClonesArray &pmdClusters = *(aod->GetPmdClusters()); + Int_t jPmdClusters=0; + + for (Int_t iPmd = 0; iPmd < nPmdClus; ++iPmd) { + // file pmd clusters, to be revised! + AliESDPmdTrack *pmdTrack = esd->GetPmdTrack(iPmd); + Int_t nLabel = 0; + Int_t *label = 0x0; + Double_t pos[3] = { pmdTrack->GetClusterX(), pmdTrack->GetClusterY(), pmdTrack->GetClusterZ() }; + Double_t pid[9] = { 0., 0., 0., 0., 0., 0., 0., 0., 0. }; // to be revised! + // type not set! + // assoc cluster not set + new(pmdClusters[jPmdClusters++]) AliAODPmdCluster(iPmd, nLabel, label, pmdTrack->GetClusterADC(), pos, pid); + } + // Access to the AOD container of clusters - TClonesArray &clusters = *(aod->GetClusters()); + TClonesArray &caloClusters = *(aod->GetCaloClusters()); Int_t jClusters=0; // Calo Clusters - Int_t nClusters = esd->GetNumberOfCaloClusters(); - - for (Int_t iClust=0; iClustGetCaloCluster(iClust); Int_t id = cluster->GetID(); - Int_t label = -1; + Int_t nLabel = 0; + Int_t *label = 0x0; Float_t energy = cluster->E(); cluster->GetPosition(posF); - AliAODVertex *prodVertex = primary; - AliAODTrack *primTrack = NULL; Char_t ttype=AliAODCluster::kUndef; - if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster){ - ttype = AliAODCluster::kPHOSNeutral; - } - else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1){ + if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster) { + ttype=AliAODCluster::kPHOSNeutral; + } + else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) { ttype = AliAODCluster::kEMCALClusterv1; - } - else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALPseudoCluster){ - ttype = AliAODCluster::kEMCALPseudoCluster; - } - - new(clusters[jClusters++]) AliAODCluster(id, - label, - energy, - pos, - NULL, // no covariance matrix provided - NULL, // no pid for clusters provided - prodVertex, - primTrack, - ttype); + } + else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALPseudoCluster) { + // Collect raw tower info + for (Int_t iDig = 0; iDig < cluster->GetNumberOfDigits(); iDig++) { + EMCCellNumber[nEMCCells] = cluster->GetDigitIndex()->At(iDig); + EMCCellAmplitude[nEMCCells] = fEMCAmpScale*cluster->GetDigitAmplitude()->At(iDig); + nEMCCells++; + } + // don't write cluster data (it's just a pseudo cluster, holding the tower information) + continue; + } + + AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) AliAODCaloCluster(id, + nLabel, + label, + energy, + pos, + NULL, + ttype); + + caloCluster->SetCaloCluster(); // to be refined! } // end of loop on calo clusters - // tracklets + // fill EMC cell info + AliAODCaloCells &EMCCells = *(aod->GetCaloCells()); + EMCCells.CreateContainer(nEMCCells); + EMCCells.SetType(AliAODCaloCells::kEMCAL); + for (Int_t iCell = 0; iCell < nEMCCells; iCell++) { + EMCCells.SetCell(iCell,EMCCellNumber[iCell],EMCCellAmplitude[iCell]); + } + EMCCells.Sort(); + + // tracklets + AliAODTracklets &SPDTracklets = *(aod->GetTracklets()); const AliMultiplicity *mult = esd->GetMultiplicity(); if (mult) { if (mult->GetNumberOfTracklets()>0) { - aod->GetTracklets()->CreateContainer(mult->GetNumberOfTracklets()); + SPDTracklets.CreateContainer(mult->GetNumberOfTracklets()); for (Int_t n=0; nGetNumberOfTracklets(); n++) { - aod->GetTracklets()->SetTracklet(n, mult->GetTheta(n), mult->GetPhi(n), mult->GetDeltaPhi(n), mult->GetLabel(n)); + SPDTracklets.SetTracklet(n, mult->GetTheta(n), mult->GetPhi(n), mult->GetDeltaPhi(n), mult->GetLabel(n)); } } } else { diff --git a/STEER/CreateAODfromESD.C b/STEER/CreateAODfromESD.C index 43b38cb647a..ff99430fc7b 100644 --- a/STEER/CreateAODfromESD.C +++ b/STEER/CreateAODfromESD.C @@ -4,12 +4,15 @@ #include #include #include +#include +#include #include "AliAODEvent.h" #include "AliAODHeader.h" #include "AliAODVertex.h" #include "AliAODTrack.h" -#include "AliAODCluster.h" +#include "AliAODCaloCluster.h" +#include "AliAODPmdCluster.h" #include "AliAODTracklets.h" #include "AliESDEvent.h" @@ -17,8 +20,11 @@ #include "AliESDMuonTrack.h" #include "AliESDVertex.h" #include "AliESDv0.h" +#include "AliESDkink.h" #include "AliESDcascade.h" #include "AliESDCaloCluster.h" +#include "AliESDPmdTrack.h" +#include "AliMultiplicity.h" #endif @@ -51,12 +57,15 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", Float_t posF[3]; Double_t pos[3]; Double_t p[3]; + Double_t p_pos[3]; + Double_t p_neg[3]; Double_t covVtx[6]; Double_t covTr[21]; Double_t pid[10]; // loop over events and fill them for (Int_t iEvent = 0; iEvent < nEvents; ++iEvent) { + //cout << "event: " << iEvent << endl; t->GetEntry(iEvent); // Multiplicity information needed by the header (to be revised!) @@ -91,10 +100,13 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", Int_t nV0s = esd->GetNumberOfV0s(); Int_t nCascades = esd->GetNumberOfCascades(); Int_t nKinks = esd->GetNumberOfKinks(); - Int_t nVertices = nV0s + nCascades + nKinks; - - aod->ResetStd(nTracks, nVertices); - AliAODTrack *aodTrack; + Int_t nVertices = nV0s + nCascades + nKinks + 1 /* = prim. vtx*/; + Int_t nJets = 0; + Int_t nCaloClus = esd->GetNumberOfCaloClusters(); + Int_t nFmdClus = 0; + Int_t nPmdClus = esd->GetNumberOfPmdTracks(); + + aod->ResetStd(nTracks, nVertices, nV0s+nCascades, nJets, nCaloClus, nFmdClus, nPmdClus); // Array to take into account the tracks already added to the AOD Bool_t * usedTrack = NULL; @@ -114,7 +126,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", usedKink = new Bool_t[nKinks]; for (Int_t iKink=0; iKinkGetVertices()); Int_t jVertices=0; @@ -122,7 +134,11 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", // Access to the AOD container of tracks TClonesArray &tracks = *(aod->GetTracks()); Int_t jTracks=0; - + + // Access to the AOD container of V0s + TClonesArray &V0s = *(aod->GetV0s()); + Int_t jV0s=0; + // Add primary vertex. The primary tracks will be defined // after the loops on the composite objects (V0, cascades, kinks) const AliESDVertex *vtx = esd->GetPrimaryVertex(); @@ -133,8 +149,11 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", AliAODVertex * primary = new(vertices[jVertices++]) AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, -1, AliAODVertex::kPrimary); + + AliAODTrack *aodTrack = 0x0; + // Create vertices starting from the most complex objects - + // Cascades for (Int_t nCascade = 0; nCascade < nCascades; ++nCascade) { AliESDcascade *cascade = esd->GetCascade(nCascade); @@ -150,7 +169,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", nCascade, AliAODVertex::kCascade); - primary->AddDaughter(vcascade); + primary->AddDaughter(vcascade); // the cascade 'particle' (represented by a vertex) is added as a daughter to the primary vertex // Add the V0 from the cascade. The ESD class have to be optimized... // Now we have to search for the corresponding V0 in the list of V0s @@ -177,7 +196,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", AliAODVertex * vV0FromCascade = 0x0; - if (indV0>-1 && !usedV0[indV0] ) { + if (indV0>-1 && !usedV0[indV0]) { // the V0 exists in the array of V0s and is not used @@ -209,6 +228,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", indV0, AliAODVertex::kV0); vcascade->AddDaughter(vV0FromCascade); + } // Add the positive tracks from the V0 @@ -218,7 +238,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", usedTrack[posFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(posFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_pos); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -226,7 +246,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", vV0FromCascade->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_pos, kTRUE, pos, kFALSE, @@ -253,7 +273,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", usedTrack[negFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(negFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_neg); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -261,7 +281,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", vV0FromCascade->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_neg, kTRUE, pos, kFALSE, @@ -281,6 +301,11 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", << " track " << negFromV0 << " has already been used!" << endl; } + // add it to the V0 array as well + Double_t d0[2] = { -999., -99.}; + // counting is probably wrong + new(V0s[jV0s++]) AliAODv0(vV0FromCascade, -999., -99., p_pos, p_neg, d0); // to be refined + // Add the bachelor track from the cascade Int_t bachelor = cascade->GetBindex(); @@ -317,19 +342,19 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", cerr << "Error: event " << iEvent << " cascade " << nCascade << " track " << bachelor << " has already been used!" << endl; } - + // Add the primary track of the cascade (if any) - + } // end of the loop on cascades - + // V0s for (Int_t nV0 = 0; nV0 < nV0s; ++nV0) { if (usedV0[nV0]) continue; // skip if aready added to the AOD - AliESDv0 *v0 = esd->GetV0(nV0); - + AliESDv0 *v0 = esd->GetV0(nV0); + v0->GetXYZ(pos[0], pos[1], pos[2]); v0->GetPosCov(covVtx); @@ -352,7 +377,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", usedTrack[posFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(posFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_pos); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -360,7 +385,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", vV0->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_pos, kTRUE, pos, kFALSE, @@ -387,7 +412,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", usedTrack[negFromV0] = kTRUE; AliESDtrack *esdTrack = esd->GetTrack(negFromV0); - esdTrack->GetPxPyPz(p); + esdTrack->GetPxPyPz(p_neg); esdTrack->GetXYZ(pos); esdTrack->GetCovarianceXYZPxPyPz(covTr); esdTrack->GetESDpid(pid); @@ -395,7 +420,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", vV0->AddDaughter(aodTrack = new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), esdTrack->GetLabel(), - p, + p_neg, kTRUE, pos, kFALSE, @@ -415,6 +440,9 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", << " track " << negFromV0 << " has already been used!" << endl; } + // add it to the V0 array as well + Double_t d0[2] = { 999., 99.}; + new(V0s[jV0s++]) AliAODv0(vV0, 999., 99., p_pos, p_neg, d0); // to be refined } // end of the loop on V0s // Kinks: it is a big mess the access to the information in the kinks @@ -547,20 +575,13 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", cerr << "Error: event " << iEvent << " kink " << TMath::Abs(ikink)-1 << " track " << idaughter << " has already been used!" << endl; } - - } } - - } - + } } - // Tracks (primary and orphan) - - for (Int_t nTrack = 0; nTrack < nTracks; ++nTrack) { - + for (Int_t nTrack = 0; nTrack < nTracks; ++nTrack) { if (usedTrack[nTrack]) continue; @@ -574,7 +595,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", esdTrack->GetImpactParameters(impactXY,impactZ); - if (impactXY<3) { + if (impactXY<3.) { // track inside the beam pipe primary->AddDaughter(aodTrack = @@ -597,25 +618,11 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", } else { // outside the beam pipe: orphan track - aodTrack = - new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(), - esdTrack->GetLabel(), - p, - kTRUE, - pos, - kFALSE, - covTr, - (Short_t)esdTrack->Charge(), - esdTrack->GetITSClusterMap(), - pid, - NULL, - kFALSE, // check if this is right - kFALSE, // check if this is right - AliAODTrack::kOrphan); - aodTrack->ConvertAliPIDtoAODPID(); + // Don't write them anymore! + continue; } } // end of loop on tracks - + // muon tracks Int_t nMuTracks = esd->GetNumberOfMuonTracks(); for (Int_t nMuTrack = 0; nMuTrack < nMuTracks; ++nMuTrack) { @@ -656,56 +663,91 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root", else aodTrack->SetChi2MatchTrigger(0.); } - + + // Access to the AOD container of PMD clusters + TClonesArray &pmdClusters = *(aod->GetPmdClusters()); + Int_t jPmdClusters=0; + + for (Int_t iPmd = 0; iPmd < nPmdClus; ++iPmd) { + // file pmd clusters, to be revised! + AliESDPmdTrack *pmdTrack = esd->GetPmdTrack(iPmd); + Int_t nLabel = 0; + Int_t *label = 0x0; + Double_t pos[3] = { pmdTrack->GetClusterX(), pmdTrack->GetClusterY(), pmdTrack->GetClusterZ() }; + Double_t pid[9] = { 0., 0., 0., 0., 0., 0., 0., 0., 0. }; // to be revised! + // type not set! + // assoc cluster not set + new(pmdClusters[jPmdClusters++]) AliAODPmdCluster(iPmd, nLabel, label, pmdTrack->GetClusterADC(), pos, pid); + } + // Access to the AOD container of clusters - TClonesArray &clusters = *(aod->GetClusters()); + TClonesArray &caloClusters = *(aod->GetCaloClusters()); Int_t jClusters=0; // Calo Clusters - Int_t nClusters = esd->GetNumberOfCaloClusters(); - - for (Int_t iClust=0; iClustGetCaloCluster(iClust); Int_t id = cluster->GetID(); - Int_t label = -1; + Int_t nLabel = 0; + Int_t *label = 0x0; Float_t energy = cluster->E(); cluster->GetPosition(posF); - AliAODVertex *prodVertex = primary; - AliAODTrack *primTrack = NULL; Char_t ttype=AliAODCluster::kUndef; - if (cluster->IsPHOS()) ttype=AliAODCluster::kPHOSNeutral; - else if (cluster->IsEMCAL()) { - - if (cluster->GetClusterType() == AliESDCaloCluster::kPseudoCluster) - ttype = AliAODCluster::kEMCALPseudoCluster; - else - ttype = AliAODCluster::kEMCALClusterv1; - + if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster) { + ttype=AliAODCluster::kPHOSNeutral; + } + else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) { + ttype = AliAODCluster::kEMCALClusterv1; } - - new(clusters[jClusters++]) AliAODCluster(id, - label, - energy, - pos, - NULL, // no covariance matrix provided - NULL, // no pid for clusters provided - prodVertex, - primTrack, - ttype); + else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALPseudoCluster) { + // Collect raw tower info + for (Int_t iDig = 0; iDig < cluster->GetNumberOfDigits(); iDig++) { + EMCCellNumber[nEMCCells] = cluster->GetDigitIndex()->At(iDig); + EMCCellAmplitude[nEMCCells] = fEMCAmpScale*cluster->GetDigitAmplitude()->At(iDig); + nEMCCells++; + } + // don't write cluster data (it's just a pseudo cluster, holding the tower information) + continue; + } + + AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) AliAODCaloCluster(id, + nLabel, + label, + energy, + pos, + NULL, + ttype); + + caloCluster->SetCaloCluster(); // to be refined! } // end of loop on calo clusters - // tracklets + // fill EMC cell info + AliAODCaloCells &EMCCells = *(aod->GetCaloCells()); + EMCCells.CreateContainer(nEMCCells); + EMCCells.SetType(AliAODCaloCells::kEMCAL); + for (Int_t iCell = 0; iCell < nEMCCells; iCell++) { + EMCCells.SetCell(iCell,EMCCellNumber[iCell],EMCCellAmplitude[iCell]); + } + EMCCells.Sort(); + + // tracklets + AliAODTracklets &SPDTracklets = *(aod->GetTracklets()); const AliMultiplicity *mult = esd->GetMultiplicity(); if (mult) { if (mult->GetNumberOfTracklets()>0) { - aod->GetTracklets()->CreateContainer(mult->GetNumberOfTracklets()); + SPDTracklets.CreateContainer(mult->GetNumberOfTracklets()); for (Int_t n=0; nGetNumberOfTracklets(); n++) { - aod->GetTracklets()->SetTracklet(n, mult->GetTheta(n), mult->GetPhi(n), mult->GetDeltaPhi(n), mult->GetLabel(n)); + SPDTracklets.SetTracklet(n, mult->GetTheta(n), mult->GetPhi(n), mult->GetDeltaPhi(n), mult->GetLabel(n)); } } } else { diff --git a/STEER/libAOD.pkg b/STEER/libAOD.pkg index 505d3d6ef38..55ceec54970 100644 --- a/STEER/libAOD.pkg +++ b/STEER/libAOD.pkg @@ -1,8 +1,9 @@ SRCS = AliAODEvent.cxx AliAODHeader.cxx \ - AliAODTrack.cxx AliAODVertex.cxx AliAODCluster.cxx \ + AliAODTrack.cxx AliAODVertex.cxx \ + AliAODCluster.cxx AliAODCaloCluster.cxx AliAODPmdCluster.cxx AliAODFmdCluster.cxx \ AliAODJet.cxx AliAODPhoton.cxx AliAODRedCov.cxx AliAODRecoDecay.cxx \ AliAODHandler.cxx AliAODTracklets.cxx AliAODTagCreator.cxx \ - AliAODv0.cxx AliAODInputHandler.cxx + AliAODv0.cxx AliAODCaloCells.cxx AliAODInputHandler.cxx HDRS:= $(SRCS:.cxx=.h) -- 2.39.3