X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=STEER%2FAliESDEvent.cxx;h=a3082187bbb061d73e5e1af7f1e362ea7167754f;hb=cd995490fc657af53fda843eac38103f1929f980;hp=e0c2cf6d4a5bdb7bed70c23ca5749ff990167e38;hpb=8b12d2889e273ece6ba0fec419bc2c49de77a1a2;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliESDEvent.cxx b/STEER/AliESDEvent.cxx index e0c2cf6d4a5..a3082187bbb 100644 --- a/STEER/AliESDEvent.cxx +++ b/STEER/AliESDEvent.cxx @@ -66,6 +66,7 @@ #include "AliLog.h" #include "AliESDACORDE.h" #include "AliESDHLTDecision.h" +#include "AliCentrality.h" ClassImp(AliESDEvent) @@ -74,31 +75,32 @@ ClassImp(AliESDEvent) // here we define the names, some classes are no TNamed, therefore the classnames // are the Names const char* AliESDEvent::fgkESDListName[kESDListN] = {"AliESDRun", - "AliESDHeader", - "AliESDZDC", - "AliESDFMD", - "AliESDVZERO", - "AliESDTZERO", - "TPCVertex", - "SPDVertex", - "PrimaryVertex", - "AliMultiplicity", - "PHOSTrigger", - "EMCALTrigger", - "SPDPileupVertices", - "TrkPileupVertices", - "Tracks", - "MuonTracks", - "PmdTracks", - "TrdTracks", - "V0s", - "Cascades", - "Kinks", - "CaloClusters", - "EMCALCells", - "PHOSCells", - "AliRawDataErrorLogs", - "AliESDACORDE"}; + "AliESDHeader", + "AliESDZDC", + "AliESDFMD", + "AliESDVZERO", + "AliESDTZERO", + "TPCVertex", + "SPDVertex", + "PrimaryVertex", + "AliMultiplicity", + "PHOSTrigger", + "EMCALTrigger", + "SPDPileupVertices", + "TrkPileupVertices", + "Tracks", + "MuonTracks", + "PmdTracks", + "TrdTracks", + "V0s", + "Cascades", + "Kinks", + "CaloClusters", + "EMCALCells", + "PHOSCells", + "AliRawDataErrorLogs", + "AliESDACORDE", + "AliTOFHeader"}; //______________________________________________________________________________ AliESDEvent::AliESDEvent(): @@ -133,10 +135,8 @@ AliESDEvent::AliESDEvent(): fESDFriendOld(0), fConnected(kFALSE), fUseOwnList(kFALSE), - fEMCALClusters(0), - fFirstEMCALCluster(-1), - fPHOSClusters(0), - fFirstPHOSCluster(-1) + fTOFHeader(0), + fCentrality(0) { } //______________________________________________________________________________ @@ -173,11 +173,8 @@ AliESDEvent::AliESDEvent(const AliESDEvent& esd): fESDFriendOld(esd.fESDFriendOld ? new AliESDfriend(*esd.fESDFriendOld) : 0), fConnected(esd.fConnected), fUseOwnList(esd.fUseOwnList), - fEMCALClusters(esd.fEMCALClusters), - fFirstEMCALCluster(esd.fFirstEMCALCluster), - fPHOSClusters(esd.fPHOSClusters), - fFirstPHOSCluster(esd.fFirstPHOSCluster) - + fTOFHeader(new AliTOFHeader(*esd.fTOFHeader)), + fCentrality(new AliCentrality(*esd.fCentrality)) { // CKB init in the constructor list and only add here ... AddObject(fESDRun); @@ -206,6 +203,7 @@ AliESDEvent::AliESDEvent(const AliESDEvent& esd): AddObject(fPHOSCells); AddObject(fErrorLogs); AddObject(fESDACORDE); + AddObject(fTOFHeader); GetStdContent(); @@ -257,8 +255,11 @@ AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) { ((TNamed*)mine)->SetName(name); } else if(mine->InheritsFrom("TCollection")){ - if(mine->InheritsFrom("TClonesArray")) - dynamic_cast(mine)->SetClass(dynamic_cast(its)->GetClass()); + if(mine->InheritsFrom("TClonesArray")) { + TClonesArray* tcits = dynamic_cast(its); + if (tcits) + dynamic_cast(mine)->SetClass(tcits->GetClass()); + } dynamic_cast(mine)->SetName(name); } AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName())); @@ -295,16 +296,12 @@ AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) { } } - fConnected = source.fConnected; - fUseOwnList = source.fUseOwnList; - fEMCALClusters = source.fEMCALClusters; - fFirstEMCALCluster = source.fFirstEMCALCluster; - fPHOSClusters = source.fPHOSClusters; - fFirstPHOSCluster = source.fFirstPHOSCluster; + fCentrality = source.fCentrality; + fConnected = source.fConnected; + fUseOwnList = source.fUseOwnList; return *this; - } @@ -323,7 +320,7 @@ AliESDEvent::~AliESDEvent() delete fESDObjects; fESDObjects = 0; } - + if (fCentrality) delete fCentrality; } @@ -368,10 +365,18 @@ void AliESDEvent::Reset() ((TClonesArray*)pObject)->Delete(); } else if(!pObject->InheritsFrom(TCollection::Class())){ - ResetWithPlacementNew(pObject); + TClass *pClass = TClass::GetClass(pObject->ClassName()); + if (pClass && pClass->GetListOfMethods()->FindObject("Clear")) { + AliDebug(1, Form("Clear for object %s class %s", pObject->GetName(), pObject->ClassName())); + pObject->Clear(); + } + else { + AliDebug(1, Form("ResetWithPlacementNew for object %s class %s", pObject->GetName(), pObject->ClassName())); + ResetWithPlacementNew(pObject); + } } else{ - AliWarning(Form("No reset for %s (%s)\n", + AliWarning(Form("No reset for %s \n", pObject->ClassName())); } } @@ -430,8 +435,13 @@ void AliESDEvent::ResetStdContent() fSPDMult->~AliMultiplicity(); new (fSPDMult) AliMultiplicity(); } - if(fPHOSTrigger)fPHOSTrigger->Reset(); - if(fEMCALTrigger)fEMCALTrigger->Reset(); + if(fTOFHeader){ + fTOFHeader->~AliTOFHeader(); + new (fTOFHeader) AliTOFHeader(); + //fTOFHeader->SetName(fgkESDListName[kTOFHeader]); + } + if(fPHOSTrigger)fPHOSTrigger->DeAllocate(); + if(fEMCALTrigger)fEMCALTrigger->DeAllocate(); if(fSPDPileupVertices)fSPDPileupVertices->Delete(); if(fTrkPileupVertices)fTrkPileupVertices->Delete(); if(fTracks)fTracks->Delete(); @@ -448,10 +458,6 @@ void AliESDEvent::ResetStdContent() // don't reset fconnected fConnected and the list - fEMCALClusters=0; - fFirstEMCALCluster=-1; - fPHOSClusters=0; - fFirstPHOSCluster=-1; } @@ -480,18 +486,20 @@ void AliESDEvent::Print(Option_t *) const GetRunNumber(), GetTriggerMask(), GetMagneticField() ); - printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n", + if (fPrimaryVertex) + printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n", fPrimaryVertex->GetXv(), fPrimaryVertex->GetXRes(), fPrimaryVertex->GetYv(), fPrimaryVertex->GetYRes(), fPrimaryVertex->GetZv(), fPrimaryVertex->GetZRes()); - printf("Mean vertex in RUN: X=%.4f Y=%.4f cm\n", - GetDiamondX(),GetDiamondY()); + printf("Mean vertex in RUN: X=%.4f Y=%.4f Z=%.4f cm\n", + GetDiamondX(),GetDiamondY(),GetDiamondZ()); + if(fSPDMult) printf("SPD Multiplicity. Number of tracklets %d \n", fSPDMult->GetNumberOfTracklets()); printf("Number of pileup primary vertices reconstructed with SPD %d\n", - GetNumberOfPileupVerticesSPD()); + GetNumberOfPileupVerticesSPD()); printf("Number of pileup primary vertices reconstructed using the tracks %d\n", - GetNumberOfPileupVerticesTracks()); + GetNumberOfPileupVerticesTracks()); printf("Number of tracks: \n"); printf(" charged %d\n", GetNumberOfTracks()); printf(" muon %d\n", GetNumberOfMuonTracks()); @@ -505,8 +513,6 @@ void AliESDEvent::Print(Option_t *) const if(fEMCALCells)printf(" EMCALCells %d\n", fEMCALCells->GetNumberOfCells()); else printf(" EMCALCells not in the Event\n"); printf(" CaloClusters %d\n", GetNumberOfCaloClusters()); - printf(" phos %d\n", GetNumberOfPHOSClusters()); - printf(" emcal %d\n", GetNumberOfEMCALClusters()); printf(" FMD %s\n", (fESDFMD ? "yes" : "no")); printf(" VZERO %s\n", (fESDVZERO ? "yes" : "no")); TObject* pHLTDecision=GetHLTTriggerDecision(); @@ -954,6 +960,13 @@ void AliESDEvent::AddRawDataErrorLog(const AliRawDataErrorLog *log) const { new(errlogs[errlogs.GetEntriesFast()]) AliRawDataErrorLog(*log); } +void AliESDEvent::SetZDCData(AliESDZDC * obj) +{ + // use already allocated space + if(fESDZDC) + *fESDZDC = *obj; +} + void AliESDEvent::SetPrimaryVertexTPC(const AliESDVertex *vertex) { // Set the TPC vertex @@ -1120,7 +1133,7 @@ void AliESDEvent::GetStdContent() fPHOSCells = (AliESDCaloCells*)fESDObjects->FindObject(fgkESDListName[kPHOSCells]); fErrorLogs = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kErrorLogs]); fESDACORDE = (AliESDACORDE*)fESDObjects->FindObject(fgkESDListName[kESDACORDE]); - + fTOFHeader = (AliTOFHeader*)fESDObjects->FindObject(fgkESDListName[kTOFHeader]); } void AliESDEvent::SetStdNames(){ @@ -1179,6 +1192,7 @@ void AliESDEvent::CreateStdContent() AddObject(new AliESDCaloCells()); AddObject(new TClonesArray("AliRawDataErrorLog",0)); AddObject(new AliESDACORDE()); + AddObject(new AliTOFHeader()); // check the order of the indices against enum... @@ -1188,7 +1202,7 @@ void AliESDEvent::CreateStdContent() GetStdContent(); } -TObject* AliESDEvent::FindListObject(const char *name){ +TObject* AliESDEvent::FindListObject(const char *name) const { // // Find object with name "name" in the list of branches // @@ -1255,8 +1269,10 @@ void AliESDEvent::WriteToTree(TTree* tree) const { if(!branchname.EndsWith("."))branchname += "."; } if (!tree->FindBranch(branchname)) { - tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj), - kBufsize, kSplitlevel - 1); + // For the custom streamer to be called splitlevel + // has to be negative, only needed for HLT + Int_t splitLevel = (TString(obj->ClassName()) == "AliHLTGlobalTriggerDecision") ? -1 : kSplitlevel - 1; + tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj),kBufsize, splitLevel); } } } @@ -1364,7 +1380,7 @@ void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){ // Connect to tree // prevent a memory leak when reading back the TList - if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete(); + // if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete(); if(!fUseOwnList){ // create a new TList from the UserInfo TList... @@ -1393,7 +1409,8 @@ void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){ if(bname.CompareTo("AliESDfriend")==0) { // AliESDfriend does not have a name ... - tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el)); + TBranch *br = tree->GetBranch("ESDfriend."); + if (br) tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el)); } else{ // check if branch exists under this Name @@ -1618,64 +1635,118 @@ Bool_t AliESDEvent::IsHLTTriggerFired(const char* name) const return kTRUE; } -Bool_t AliESDEvent::IsPileupFromSPD(Int_t ncont, Double_t nSigmaDeltaZ, Double_t nSigmaXY, Int_t option) const { +//______________________________________________________________________________ +Bool_t AliESDEvent::IsPileupFromSPD(Int_t minContributors, + Double_t minZdist, + Double_t nSigmaZdist, + Double_t nSigmaDiamXY, + Double_t nSigmaDiamZ) const{ // // This function checks if there was a pile up // reconstructed with SPD // - Double_t diamx= GetDiamondX(); - Double_t diamsigma2x= GetSigma2DiamondX(); - Double_t diamy= GetDiamondY(); - Double_t diamsigma2y= GetSigma2DiamondY(); - - Double_t sigmax= TMath::Sqrt(diamsigma2x); - Double_t sigmay= TMath::Sqrt(diamsigma2y); - - Double_t z1=fSPDVertex->GetZ(); Int_t nc1=fSPDVertex->GetNContributors(); if(nc1<1) return kFALSE; Int_t nPileVert=GetNumberOfPileupVerticesSPD(); if(nPileVert==0) return kFALSE; + for(Int_t i=0; iGetZ(); - Double_t x2=pv->GetX(); - Double_t y2=pv->GetY(); Int_t nc2=pv->GetNContributors(); - Double_t distanceZ=TMath::Abs(z2-z1); - Double_t distanceX=TMath::Abs(x2-diamx); - Double_t distanceY=TMath::Abs(y2-diamy); - Double_t errzDist=0.; - Double_t errxDist=0.; - Double_t erryDist=0.; - if(option==0){ - Double_t ez1=fSPDVertex->GetZRes(); - Double_t ez2=pv->GetZRes(); - errzDist=TMath::Sqrt(ez1*ez1+ez2*ez2); - }else{ - Double_t resol1=-75.6+834.6/TMath::Sqrt((Double_t)nc1); - resol1/=10000.; - Double_t resol2=-75.6+834.6/TMath::Sqrt((Double_t)nc2); - resol2/=10000.; - errzDist=TMath::Sqrt(resol1*resol1+resol2*resol2); + if(nc2>=minContributors){ + Double_t z1=fSPDVertex->GetZ(); + Double_t z2=pv->GetZ(); + Double_t distZ=TMath::Abs(z2-z1); + Double_t distZdiam=TMath::Abs(z2-GetDiamondZ()); + Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ()); + if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information + if(distZ>minZdist && distZdiamGetX(); + Double_t y2=pv->GetY(); + Double_t distXdiam=TMath::Abs(x2-GetDiamondX()); + Double_t distYdiam=TMath::Abs(y2-GetDiamondY()); + Double_t cov1[6],cov2[6]; + fSPDVertex->GetCovarianceMatrix(cov1); + pv->GetCovarianceMatrix(cov2); + Double_t errxDist=TMath::Sqrt(cov2[0]+GetSigma2DiamondX()); + Double_t erryDist=TMath::Sqrt(cov2[2]+GetSigma2DiamondY()); + Double_t errzDist=TMath::Sqrt(cov1[5]+cov2[5]); + Double_t cutXdiam=nSigmaDiamXY*errxDist; + if(GetSigma2DiamondX()<0.0001)cutXdiam=99999.; //protection for missing diamond information + Double_t cutYdiam=nSigmaDiamXY*erryDist; + if(GetSigma2DiamondY()<0.0001)cutYdiam=99999.; //protection for missing diamond information + if( (distXdiamnSigmaZdist*errzDist) ){ + return kTRUE; + } + } } + } + return kFALSE; +} - - Double_t ex2 = pv->GetXRes(); - Double_t ey2= pv->GetYRes(); - errxDist=TMath::Sqrt(ex2*ex2+sigmax*sigmax); - erryDist=TMath::Sqrt(ey2*ey2+sigmay*sigmay); - - if(nc2>=ncont && distanceZ>nSigmaDeltaZ*errzDist && distanceXGetNumberOfTracklets() : 0; + // + // count tracklets + for (int itr=ntr;itr--;) { + if (TMath::Abs(fSPDMult->GetEta(itr))>eta) continue; + tracklets++; + if (fSPDMult->FreeClustersTracklet(itr,0)) trITSTPC++; // not used in ITS/TPC or ITS_SA track + if (fSPDMult->FreeClustersTracklet(itr,1)) trITSSApure++; // not used in ITS_SA_Pure track } - - - - return kFALSE; + // + // count real tracks + ntr = GetNumberOfTracks(); + for (int itr=ntr;itr--;) { + AliESDtrack *t = GetTrack(itr); + if (TMath::Abs(t->Eta())>eta) continue; + if (!t->IsOn(AliESDtrack::kITSin)) continue; + if (useDCAFlag && t->IsOn(AliESDtrack::kMultSec)) continue; + if (useV0Flag && t->IsOn(AliESDtrack::kMultInV0)) continue; + if (t->IsOn(AliESDtrack::kITSpureSA)) trITSSApure++; + else trITSTPC++; } + // +} +Bool_t AliESDEvent::IsPileupFromSPDInMultBins() const { + Int_t nTracklets=GetMultiplicity()->GetNumberOfTracklets(); + if(nTracklets<20) return IsPileupFromSPD(3,0.8); + else if(nTracklets<50) return IsPileupFromSPD(4,0.8); + else return IsPileupFromSPD(5,0.8); +} +void AliESDEvent::SetTOFHeader(const AliTOFHeader *header) +{ + // + // Set the TOF event_time + // + + if (fTOFHeader) { + *fTOFHeader=*header; + //fTOFHeader->SetName(fgkESDListName[kTOFHeader]); + } + else { + // for analysis of reconstructed events + // when this information is not avaliable + fTOFHeader = new AliTOFHeader(*header); + //AddObject(fTOFHeader); + } +} +AliCentrality* AliESDEvent::GetCentrality() +{ + if (!fCentrality) fCentrality = new AliCentrality(); + return fCentrality; +}