#include "AliLog.h"
#include "AliESDACORDE.h"
#include "AliESDHLTDecision.h"
+#include "AliCentrality.h"
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():
fESDFriendOld(0),
fConnected(kFALSE),
fUseOwnList(kFALSE),
- fEMCALClusters(0),
- fFirstEMCALCluster(-1),
- fPHOSClusters(0),
- fFirstPHOSCluster(-1)
+ fTOFHeader(0),
+ fCentrality(0)
{
}
//______________________________________________________________________________
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);
AddObject(fPHOSCells);
AddObject(fErrorLogs);
AddObject(fESDACORDE);
+ AddObject(fTOFHeader);
GetStdContent();
((TNamed*)mine)->SetName(name);
}
else if(mine->InheritsFrom("TCollection")){
- if(mine->InheritsFrom("TClonesArray"))
- dynamic_cast<TClonesArray*>(mine)->SetClass(dynamic_cast<TClonesArray*>(its)->GetClass());
+ if(mine->InheritsFrom("TClonesArray")) {
+ TClonesArray* tcits = dynamic_cast<TClonesArray*>(its);
+ if (tcits)
+ dynamic_cast<TClonesArray*>(mine)->SetClass(tcits->GetClass());
+ }
dynamic_cast<TCollection*>(mine)->SetName(name);
}
AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName()));
}
}
- 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;
-
}
delete fESDObjects;
fESDObjects = 0;
}
-
+ if (fCentrality) delete fCentrality;
}
((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()));
}
}
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();
// don't reset fconnected fConnected and the list
- fEMCALClusters=0;
- fFirstEMCALCluster=-1;
- fPHOSClusters=0;
- fFirstPHOSCluster=-1;
}
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());
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();
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
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(){
AddObject(new AliESDCaloCells());
AddObject(new TClonesArray("AliRawDataErrorLog",0));
AddObject(new AliESDACORDE());
+ AddObject(new AliTOFHeader());
// check the order of the indices against enum...
GetStdContent();
}
-TObject* AliESDEvent::FindListObject(const char *name){
+TObject* AliESDEvent::FindListObject(const char *name) const {
//
// Find object with name "name" in the list of branches
//
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);
}
}
}
// 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...
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
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; i<nPileVert;i++){
const AliESDVertex* pv=GetPileupVertexSPD(i);
- Double_t z2=pv->GetZ();
- 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 && distZdiam<cutZdiam){
+ Double_t x2=pv->GetX();
+ 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( (distXdiam<cutXdiam) && (distYdiam<cutYdiam) && (distZ>nSigmaZdist*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 && distanceX<nSigmaXY*errxDist && distanceY<nSigmaXY*erryDist)
-
- return kTRUE;
+//______________________________________________________________________________
+void AliESDEvent::EstimateMultiplicity(Int_t &tracklets, Int_t &trITSTPC, Int_t &trITSSApure, Double_t eta, Bool_t useDCAFlag,Bool_t useV0Flag) const
+{
+ //
+ // calculates 3 estimators for the multiplicity in the -eta:eta range
+ // tracklets : using SPD tracklets only
+ // trITSTPC : using TPC/ITS + complementary ITS SA tracks + tracklets from clusters not used by tracks
+ // trITSSApure : using ITS standalone tracks + tracklets from clusters not used by tracks
+ // if useDCAFlag is true: account for the ESDtrack flag marking the tracks with large DCA
+ // if useV0Flag is true: account for the ESDtrack flag marking conversion and K0's V0s
+ tracklets = trITSSApure = trITSTPC = 0;
+ int ntr = fSPDMult ? fSPDMult->GetNumberOfTracklets() : 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;
+}