+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 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)
+
+ return kTRUE;
+ }
+
+
+
+ return kFALSE;
+ }
+
+