#include "TList.h"
#include "TRefArray.h"
#include <TNamed.h>
+#include <TROOT.h>
+#include <TInterpreter.h>
#include "AliESDEvent.h"
#include "AliESDfriend.h"
#include "AliESDPmdTrack.h"
#include "AliESDTrdTrack.h"
#include "AliESDVertex.h"
+#include "AliVertexerTracks.h"
#include "AliESDcascade.h"
#include "AliESDkink.h"
#include "AliESDtrack.h"
#include "AliRawDataErrorLog.h"
#include "AliLog.h"
#include "AliESDACORDE.h"
+#include "AliESDHLTDecision.h"
+
ClassImp(AliESDEvent)
"AliMultiplicity",
"PHOSTrigger",
"EMCALTrigger",
+ "SPDPileupVertices",
+ "TrkPileupVertices",
"Tracks",
"MuonTracks",
"PmdTracks",
fPHOSTrigger(0),
fEMCALTrigger(0),
fESDACORDE(0),
+ fSPDPileupVertices(0),
+ fTrkPileupVertices(0),
fTracks(0),
fMuonTracks(0),
fPmdTracks(0),
fESDOld(0),
fESDFriendOld(0),
fConnected(kFALSE),
- fUseOwnList(kFALSE),
- fEMCALClusters(0),
- fFirstEMCALCluster(-1),
- fPHOSClusters(0),
- fFirstPHOSCluster(-1)
+ fUseOwnList(kFALSE)
{
}
//______________________________________________________________________________
fPHOSTrigger(new AliESDCaloTrigger(*esd.fPHOSTrigger)),
fEMCALTrigger(new AliESDCaloTrigger(*esd.fEMCALTrigger)),
fESDACORDE(new AliESDACORDE(*esd.fESDACORDE)),
+ fSPDPileupVertices(new TClonesArray(*esd.fSPDPileupVertices)),
+ fTrkPileupVertices(new TClonesArray(*esd.fTrkPileupVertices)),
fTracks(new TClonesArray(*esd.fTracks)),
fMuonTracks(new TClonesArray(*esd.fMuonTracks)),
fPmdTracks(new TClonesArray(*esd.fPmdTracks)),
fEMCALCells(new AliESDCaloCells(*esd.fEMCALCells)),
fPHOSCells(new AliESDCaloCells(*esd.fPHOSCells)),
fErrorLogs(new TClonesArray(*esd.fErrorLogs)),
- fESDOld(new AliESD(*esd.fESDOld)),
- fESDFriendOld(new AliESDfriend(*esd.fESDFriendOld)),
+ fESDOld(esd.fESDOld ? new AliESD(*esd.fESDOld) : 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)
+ fUseOwnList(esd.fUseOwnList)
{
// CKB init in the constructor list and only add here ...
AddObject(fSPDMult);
AddObject(fPHOSTrigger);
AddObject(fEMCALTrigger);
+ AddObject(fSPDPileupVertices);
+ AddObject(fTrkPileupVertices);
AddObject(fTracks);
AddObject(fMuonTracks);
AddObject(fPmdTracks);
// otherwise only TObject::Copy() will be used
+
if((fESDObjects->GetSize()==0)&&(source.fESDObjects->GetSize()>=kESDListN)){
// We cover the case that we do not yet have the
// standard content but the source has it
name.Form("%s", its->GetName());
TObject *mine = fESDObjects->FindObject(name.Data());
if(!mine){
- // not in this: can be added to list (to be implemented)
- AliWarning(Form("%s:%d Could not find %s for copying \n",
- (char*)__FILE__,__LINE__,name.Data()));
- continue;
- }
+ TClass* pClass=TClass::GetClass(its->ClassName());
+ if (!pClass) {
+ AliWarning(Form("Can not find class description for entry %s (%s)\n",
+ its->ClassName(), name.Data()));
+ continue;
+ }
+ mine=(TObject*)pClass->New();
+ if(!mine){
+ // not in this: can be added to list
+ AliWarning(Form("%s:%d Could not find %s for copying \n",
+ (char*)__FILE__,__LINE__,name.Data()));
+ continue;
+ }
+ if(mine->InheritsFrom("TNamed")){
+ ((TNamed*)mine)->SetName(name);
+ }
+ else if(mine->InheritsFrom("TCollection")){
+ if(mine->InheritsFrom("TClonesArray"))
+ dynamic_cast<TClonesArray*>(mine)->SetClass(dynamic_cast<TClonesArray*>(its)->GetClass());
+ dynamic_cast<TCollection*>(mine)->SetName(name);
+ }
+ AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName()));
+ AddObject(mine);
+ }
+
if(!its->InheritsFrom("TCollection")){
// simple objects
its->Copy(*mine);
fConnected = source.fConnected;
fUseOwnList = source.fUseOwnList;
- fEMCALClusters = source.fEMCALClusters;
- fFirstEMCALCluster = source.fFirstEMCALCluster;
- fPHOSClusters = source.fPHOSClusters;
- fFirstPHOSCluster = source.fFirstPHOSCluster;
-
return *this;
void AliESDEvent::Reset()
{
-
+ // Handle the cases
+ // Std content + Non std content
+
// Reset the standard contents
ResetStdContent();
+
+ // reset for the old data without AliESDEvent...
if(fESDOld)fESDOld->Reset();
- // reset for the friends...
if(fESDFriendOld){
fESDFriendOld->~AliESDfriend();
new (fESDFriendOld) AliESDfriend();
}
- // for new data we have to fetch the Pointer from the list
- AliESDfriend *fr = (AliESDfriend*)FindListObject("AliESDfriend");
- if(fr){
- // delete the content
- fr->~AliESDfriend();
- // make a new valid ESDfriend at the same place
- new (fr) AliESDfriend();
+ //
+
+ if(fESDObjects->GetSize()>kESDListN){
+ // we have non std content
+ // this also covers esdfriends
+ for(int i = kESDListN;i < fESDObjects->GetSize();++i){
+ TObject *pObject = fESDObjects->At(i);
+ // TClonesArrays
+ if(pObject->InheritsFrom(TClonesArray::Class())){
+ ((TClonesArray*)pObject)->Delete();
+ }
+ else if(!pObject->InheritsFrom(TCollection::Class())){
+ ResetWithPlacementNew(pObject);
+ }
+ else{
+ AliWarning(Form("No reset for %s (%s)\n",
+ pObject->ClassName()));
+ }
+ }
}
- // call reset for user supplied data?
+}
+
+Bool_t AliESDEvent::ResetWithPlacementNew(TObject *pObject){
+ Long_t dtoronly = TObject::GetDtorOnly();
+ TClass *pClass = TClass::GetClass(pObject->ClassName());
+ TObject::SetDtorOnly(pObject);
+ delete pObject;
+ // Recreate with placement new
+ pClass->New(pObject);
+ // Restore the state.
+ TObject::SetDtorOnly((void*)dtoronly);
+ return kTRUE;
}
void AliESDEvent::ResetStdContent()
}
if(fPHOSTrigger)fPHOSTrigger->Reset();
if(fEMCALTrigger)fEMCALTrigger->Reset();
+ if(fSPDPileupVertices)fSPDPileupVertices->Delete();
+ if(fTrkPileupVertices)fTrkPileupVertices->Delete();
if(fTracks)fTracks->Delete();
if(fMuonTracks)fMuonTracks->Delete();
if(fPmdTracks)fPmdTracks->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());
+ printf("Number of pileup primary vertices reconstructed using the tracks %d\n",
+ 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();
+ printf("HLT trigger decision: %s\n", pHLTDecision?pHLTDecision->GetOption():"not available");
+ if (pHLTDecision) pHLTDecision->Print("compact");
return;
}
Int_t idx=cs->GetIndex();
if (rm==idx) return kFALSE;
if (idx==last) used++;
+
+ AliESDv0 *v0=cs;
+ idx=v0->GetNindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+
+ idx=v0->GetPindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
}
Int_t nkn=GetNumberOfKinks();
if (idx==last) used++;
}
+ // Check if this track is associated with a CaloCluster
+ Int_t ncl=GetNumberOfCaloClusters();
+ for (Int_t n=0; n<ncl; n++) {
+ AliESDCaloCluster *cluster=GetCaloCluster(n);
+ TArrayI *arr=cluster->GetTracksMatched();
+ Int_t s=arr->GetSize();
+ while (s--) {
+ Int_t idx=arr->At(s);
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
+ }
+
+
//Replace the removed track with the last track
TClonesArray &a=*fTracks;
used--;
if (!used) return kTRUE;
}
+ AliESDv0 *v0=cs;
+ if (v0->GetIndex(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; n<nkn; n++) {
}
}
+ // Remap the indices of the tracks accosicated with CaloClusters
+ for (Int_t n=0; n<ncl; n++) {
+ AliESDCaloCluster *cluster=GetCaloCluster(n);
+ TArrayI *arr=cluster->GetTracksMatched();
+ Int_t s=arr->GetSize();
+ while (s--) {
+ Int_t idx=arr->At(s);
+ if (idx==last) {
+ arr->AddAt(rm,s);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
+ }
+
return kTRUE;
}
return rc;
}
+Char_t AliESDEvent::AddPileupVertexSPD(const AliESDVertex *vtx)
+{
+ // Add a pileup primary vertex reconstructed with SPD
+ TClonesArray &ftr = *fSPDPileupVertices;
+ Char_t n=Char_t(ftr.GetEntriesFast());
+ AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx);
+ vertex->SetID(n);
+ return n;
+}
+
+Char_t AliESDEvent::AddPileupVertexTracks(const AliESDVertex *vtx)
+{
+ // Add a pileup primary vertex reconstructed with SPD
+ TClonesArray &ftr = *fTrkPileupVertices;
+ Char_t n=Char_t(ftr.GetEntriesFast());
+ AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx);
+ vertex->SetID(n);
+ return n;
+}
+
Int_t AliESDEvent::AddTrack(const AliESDtrack *t)
{
// Add track
}
}
-void AliESDEvent::SetPrimaryVertex(const AliESDVertex *vertex)
+void AliESDEvent::SetPrimaryVertexTracks(const AliESDVertex *vertex)
{
- // Set the primary vertex
+ // Set the primary vertex reconstructed using he ESD tracks.
// use already allocated space
if(fPrimaryVertex){
*fPrimaryVertex = *vertex;
}
}
+const AliESDVertex * AliESDEvent::GetPrimaryVertex() const
+{
+ //
+ // Get the "best" available reconstructed primary vertex.
+ //
+ if(fPrimaryVertex){
+ if (fPrimaryVertex->GetStatus()) return fPrimaryVertex;
+ }
+ if(fSPDVertex){
+ if (fSPDVertex->GetStatus()) return fSPDVertex;
+ }
+ if(fTPCVertex) return fTPCVertex;
+
+ AliWarning("No primary vertex available. Returning the \"default\"...");
+ return fSPDVertex;
+}
+
+AliESDVertex * AliESDEvent::PrimaryVertexTracksUnconstrained() const
+{
+ //
+ // Removes diamond constraint from fPrimaryVertex (reconstructed with tracks)
+ // Returns a AliESDVertex which has to be deleted by the user
+ //
+ if(!fPrimaryVertex) {
+ AliWarning("No primary vertex from tracks available.");
+ return 0;
+ }
+ if(!fPrimaryVertex->GetStatus()) {
+ AliWarning("No primary vertex from tracks available.");
+ return 0;
+ }
+
+ AliVertexerTracks vertexer(GetMagneticField());
+ Float_t diamondxyz[3]={(Float_t)GetDiamondX(),(Float_t)GetDiamondY(),0.};
+ Float_t diamondcovxy[3]; GetDiamondCovXY(diamondcovxy);
+ Float_t diamondcov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,7.};
+ AliESDVertex *vertex =
+ (AliESDVertex*)vertexer.RemoveConstraintFromVertex(fPrimaryVertex,diamondxyz,diamondcov);
+
+ return vertex;
+}
+
void AliESDEvent::SetMultiplicity(const AliMultiplicity *mul)
{
// Set the SPD Multiplicity
fSPDMult = (AliMultiplicity*)fESDObjects->FindObject(fgkESDListName[kSPDMult]);
fPHOSTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kPHOSTrigger]);
fEMCALTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kEMCALTrigger]);
+ fSPDPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kSPDPileupVertices]);
+ fTrkPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrkPileupVertices]);
fTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTracks]);
fMuonTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonTracks]);
fPmdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kPmdTracks]);
void AliESDEvent::SetStdNames(){
// Set the names of the standard contents
//
- if(fESDObjects->GetEntries()==kESDListN){
- for(int i = 0;i < fESDObjects->GetEntries();i++){
+ if(fESDObjects->GetEntries()>=kESDListN){
+ for(int i = 0;i < fESDObjects->GetEntries() && i<kESDListN;i++){
TObject *fObj = fESDObjects->At(i);
if(fObj->InheritsFrom("TNamed")){
((TNamed*)fObj)->SetName(fgkESDListName[i]);
}
}
else{
- printf("%s:%d SetStdNames() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__);
+ AliWarning("Std Entries missing");
}
}
AddObject(new AliMultiplicity());
AddObject(new AliESDCaloTrigger());
AddObject(new AliESDCaloTrigger());
+ AddObject(new TClonesArray("AliESDVertex",0));
+ AddObject(new TClonesArray("AliESDVertex",0));
AddObject(new TClonesArray("AliESDtrack",0));
AddObject(new TClonesArray("AliESDMuonTrack",0));
AddObject(new TClonesArray("AliESDPmdTrack",0));
GetStdContent();
}
-TObject* AliESDEvent::FindListObject(const char *name){
+TObject* AliESDEvent::FindListObject(const char *name) const {
//
// Find object with name "name" in the list of branches
//
return clusters->GetEntriesFast();
}
-const void AliESDEvent::WriteToTree(TTree* tree) const {
+void AliESDEvent::WriteToTree(TTree* tree) const {
// Book the branches as in TTree::Branch(TCollection*)
// but add a "." at the end of top level branches which are
// not a TClonesArray
while ((obj = next())) {
branchname.Form("%s", obj->GetName());
+ if(branchname.CompareTo("AliESDfriend")==0)branchname = "ESDfriend.";
if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) {
if(!branchname.EndsWith("."))branchname += ".";
}
- tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj),
- kBufsize, kSplitlevel - 1);
+ if (!tree->FindBranch(branchname)) {
+ // 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);
+ }
}
-
}
-void AliESDEvent::ReadFromTree(TTree *tree, Option_t* /*opt*/){
+void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){
//
// Connect the ESDEvent to a tree
//
if(!tree){
- Printf("%s %d AliESDEvent::ReadFromTree() Zero Pointer to Tree \n",(char*)__FILE__,__LINE__);
+ AliWarning("AliESDEvent::ReadFromTree() Zero Pointer to Tree \n");
return;
}
// load the TTree
char ** addressF = 0;
if(esdFB)addressF = (char **)(esdFB->GetAddress());
if (!address) {
- printf("%s %d AliESDEvent::ReadFromTree() Reading old Tree \n",(char*)__FILE__,__LINE__);
+ AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
tree->SetBranchAddress("ESD", &fESDOld);
if(esdFB){
tree->SetBranchAddress("ESDfriend.",&fESDFriendOld);
}
} else {
- printf("%s %d AliESDEvent::ReadFromTree() Reading old Tree \n",(char*)__FILE__,__LINE__);
- printf("%s %d Branch already connected. Using existing branch address. \n",(char*)__FILE__,__LINE__);
+ AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
+ AliInfo("Branch already connected. Using existing branch address.");
fESDOld = (AliESD*) (*address);
// addressF can still be 0, since branch needs to switched on
if(addressF)fESDFriendOld = (AliESDfriend*) (*addressF);
if(fESDFriendOld)AddObject(fESDFriendOld);
// we are not owner of the list objects
// must not delete it
- fESDObjects->SetOwner(kFALSE);
+ fESDObjects->SetOwner(kTRUE);
fESDObjects->SetName("ESDObjectsConnectedToTree");
tree->GetUserInfo()->Add(fESDObjects);
fConnected = true;
esdEvent = (AliESDEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliESDEvent");
if(esdEvent){
// Check if already connected to tree
+ esdEvent->Reset();
TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree"));
- if (connectedList) {
+
+
+ if (connectedList && (strcmp(opt, "reconnect"))) {
// If connected use the connected list if objects
fESDObjects->Delete();
fESDObjects = connectedList;
// Connect to tree
// prevent a memory leak when reading back the TList
-
+ // if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete();
+
if(!fUseOwnList){
- delete fESDObjects;
- fESDObjects = 0;
// create a new TList from the UserInfo TList...
// copy constructor does not work...
fESDObjects = (TList*)(esdEvent->GetList()->Clone());
- fESDObjects->SetOwner(kFALSE);
+ fESDObjects->SetOwner(kTRUE);
}
else if ( fESDObjects->GetEntries()==0){
// at least create the std content if we want to read to our list
// TODO just add new entries
if(fESDObjects->GetEntries()<kESDListN){
- printf("%s %d AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
- (char*)__FILE__,__LINE__,fESDObjects->GetEntries(),kESDListN);
+ AliWarning(Form("AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
+ fESDObjects->GetEntries(),kESDListN));
}
// set the branch addresses
TIter next(fESDObjects);
tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el));
}
else{
- printf("%s %d AliESDEvent::ReadFromTree() No Branch found with Name %s or %s. \n",
- (char*)__FILE__,__LINE__,bname.Data(),bname.Data());
+ AliWarning(Form("AliESDEvent::ReadFromTree() No Branch found with Name %s or %s.",bname.Data(),bname.Data()));
}
}
GetStdContent();
// when reading back we are not owner of the list
// must not delete it
- fESDObjects->SetOwner(kFALSE);
+ fESDObjects->SetOwner(kTRUE);
fESDObjects->SetName("ESDObjectsConnectedToTree");
// we are not owner of the list objects
// must not delete it
tree->GetUserInfo()->Add(fESDObjects);
+ tree->GetUserInfo()->SetOwner(kFALSE);
fConnected = true;
- }// no esdEvent
+ }// no esdEvent -->
else {
// we can't get the list from the user data, create standard content
// and set it by hand (no ESDfriend at the moment
GetStdContent();
// when reading back we are not owner of the list
// must not delete it
- fESDObjects->SetOwner(kFALSE);
+ fESDObjects->SetOwner(kTRUE);
}
}
0,
fESDOld->GetZDCN2Energy(),
fESDOld->GetZDCP2Energy(),
- fESDOld->GetZDCParticipants());
+ fESDOld->GetZDCParticipants(),
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0);
// FMD
if(fESDOld->GetVertex())SetPrimaryVertexSPD(fESDOld->GetVertex());
- if(fESDOld->GetPrimaryVertex())SetPrimaryVertex(fESDOld->GetPrimaryVertex());
+ if(fESDOld->GetPrimaryVertex())SetPrimaryVertexTracks(fESDOld->GetPrimaryVertex());
if(fESDOld->GetMultiplicity())SetMultiplicity(fESDOld->GetMultiplicity());
}// if fesdold
}
+Bool_t AliESDEvent::IsEventSelected(const char *trigExpr) const
+{
+ // Check if the event satisfies the trigger
+ // selection expression trigExpr.
+ // trigExpr can be any logical expression
+ // of the trigger classes defined in AliESDRun
+ // In case of wrong syntax return kTRUE.
+
+ TString expr(trigExpr);
+ if (expr.IsNull()) return kTRUE;
+
+ ULong64_t mask = GetTriggerMask();
+ for(Int_t itrig = 0; itrig < AliESDRun::kNTriggerClasses; itrig++) {
+ if (mask & (1ull << itrig)) {
+ expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"1");
+ }
+ else {
+ expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"0");
+ }
+ }
+
+ Int_t error;
+ if ((gROOT->ProcessLineFast(expr.Data(),&error) == 0) &&
+ (error == TInterpreter::kNoError)) {
+ return kFALSE;
+ }
+
+ return kTRUE;
+
+}
+
+TObject* AliESDEvent::GetHLTTriggerDecision() const
+{
+ // get the HLT trigger decission object
+
+ // cast away const'nes because the FindListObject method
+ // is not const
+ AliESDEvent* pNonConst=const_cast<AliESDEvent*>(this);
+ return pNonConst->FindListObject("HLTGlobalTrigger");
+}
+
+TString AliESDEvent::GetHLTTriggerDescription() const
+{
+ // get the HLT trigger decission description
+ TString description;
+ TObject* pDecision=GetHLTTriggerDecision();
+ if (pDecision) {
+ description=pDecision->GetTitle();
+ }
+
+ return description;
+}
+
+Bool_t AliESDEvent::IsHLTTriggerFired(const char* name) const
+{
+ // get the HLT trigger decission description
+ TObject* pDecision=GetHLTTriggerDecision();
+ if (!pDecision) return kFALSE;
+
+ Option_t* option=pDecision->GetOption();
+ if (option==NULL || *option!='1') return kFALSE;
+
+ if (name) {
+ TString description=GetHLTTriggerDescription();
+ Int_t index=description.Index(name);
+ if (index<0) return kFALSE;
+ index+=strlen(name);
+ if (index>=description.Length()) return kFALSE;
+ if (description[index]!=0 && description[index]!=' ') return kFALSE;
+ }
+ return kTRUE;
+}
+
+Bool_t AliESDEvent::IsPileupFromSPD(Int_t ncont, Double_t distz, Double_t nSigmaDeltaZ, Double_t nSigmaXY, Int_t option) 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);
+ }
+
+
+ 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 && distanceZ>distz)
+
+ return kTRUE;
+ }
+
+
+
+ return kFALSE;
+ }
+
+