+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
#include <TCanvas.h>
#include <TClass.h>
#include <TCollection.h>
#include <TString.h>
#include <TList.h>
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
#include "AliESDtrack.h"
#include "AliESDEvent.h"
#include "AliLog.h"
-#include "AliESDpid.h"
+#include "AliPIDResponse.h"
#include "AliESDpidCuts.h"
//_____________________________________________________________________
AliESDpidCuts::AliESDpidCuts(const Char_t *name, const Char_t *title):
AliAnalysisCuts(name, title)
- , fESDpid(NULL)
+ , fPIDresponse(NULL)
, fTPCsigmaCutRequired(0)
, fTOFsigmaCutRequired(0)
, fCutTPCclusterRatio(0.)
// Default constructor
//
- fESDpid = new AliESDpid;
- memset(fCutTPCnSigma, 0, sizeof(Float_t) * 2);
- memset(fCutTOFnSigma, 0, sizeof(Float_t) * 2);
+ memset(fCutTPCnSigma, 0, sizeof(Float_t)* AliPID::kSPECIES * 2);
+ memset(fCutTOFnSigma, 0, sizeof(Float_t)* AliPID::kSPECIES * 2);
memset(fHclusterRatio, 0, sizeof(TH1F *) * 2);
memset(fHnSigmaTPC, 0, sizeof(TH1F *) * AliPID::kSPECIES * 2);
//_____________________________________________________________________
AliESDpidCuts::AliESDpidCuts(const AliESDpidCuts &ref):
AliAnalysisCuts(ref)
- , fESDpid(NULL)
+ , fPIDresponse(NULL)
, fTPCsigmaCutRequired(ref.fTPCsigmaCutRequired)
, fTOFsigmaCutRequired(ref.fTOFsigmaCutRequired)
, fCutTPCclusterRatio(ref.fCutTPCclusterRatio)
//
// Copy constructor
//
- fESDpid = new AliESDpid(*ref.fESDpid);
+ fPIDresponse = ref.fPIDresponse;
memcpy(fCutTPCnSigma, ref.fCutTPCnSigma, sizeof(Float_t) * AliPID::kSPECIES * 2);
memcpy(fCutTOFnSigma, ref.fCutTOFnSigma, sizeof(Float_t) * AliPID::kSPECIES * 2);
//
// Destructor
//
- delete fESDpid;
- delete fHcutStatistics;
delete fHcutCorrelation;
for(Int_t imode = 0; imode < 2; imode++){
delete fHclusterRatio[imode];
}
}
+//_____________________________________________________________________
+void AliESDpidCuts::Init(){
+ //
+ // Init function, get PID response from the Analysis Manager
+ //
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if(mgr){
+ AliInputEventHandler *handler = dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
+ if(handler){
+ fPIDresponse = handler->GetPIDResponse();
+ }
+ }
+}
+
//_____________________________________________________________________
Bool_t AliESDpidCuts::IsSelected(TObject *obj){
//
AliError("Provided object is not AliESDtrack!");
return kFALSE;
}
- AliESDEvent* evt = trk->GetESDEvent();
+ const AliESDEvent* evt = trk->GetESDEvent();
if(!evt){
AliError("No AliESDEvent!");
return kFALSE;
//
AliESDpidCuts &target = dynamic_cast<AliESDpidCuts &>(c);
- target.fESDpid = new AliESDpid(*fESDpid);
+ target.fPIDresponse = fPIDresponse;
target.fCutTPCclusterRatio = fCutTPCclusterRatio;
target.fMinMomentumTOF = fMinMomentumTOF;
}
memcpy(target.fCutTPCnSigma, fCutTPCnSigma, sizeof(Float_t) * AliPID::kSPECIES * 2);
- memcpy(target.fCutTOFnSigma, fCutTOFnSigma, sizeof(Float_t) * AliPID::kSPECIES);
+ memcpy(target.fCutTOFnSigma, fCutTOFnSigma, sizeof(Float_t) * AliPID::kSPECIES * 2);
AliESDpidCuts::Copy(c);
}
//
// Merge Cut objects
//
- if(coll) return 0;
- if(coll->IsEmpty()) return 1;
+ if(!coll) return 0;
+ if(coll->IsEmpty()) return 1;
if(!HasHistograms()) return 0;
TIterator *iter = coll->MakeIterator();
}
Char_t hname[256], htitle[256];
for(Int_t imode = 0; imode < 2; imode++){
- sprintf(hname, "fHclusterRatio%s", imode ? "After" : "Before");
- sprintf(htitle, "TPC cluster Ratio %s cuts;Ratio;Entries", imode ? "after" : "before");
+ snprintf(hname, 256, "fHclusterRatio%s", imode ? "After" : "Before");
+ snprintf(htitle, 256, "TPC cluster Ratio %s cuts;Ratio;Entries", imode ? "after" : "before");
fHclusterRatio[imode] = new TH1F(hname, htitle, 20, 0., 1.);
for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){
- sprintf(hname, "fHnSigma%sTPC%s", AliPID::ParticleName(ispec), imode ? "after" : "before");
- sprintf(htitle, "TPC sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before");
+ snprintf(hname, 256, "fHnSigma%sTPC%s", AliPID::ParticleName(ispec), imode ? "after" : "before");
+ snprintf(htitle, 256, "TPC sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before");
fHnSigmaTPC[ispec][imode] = new TH1F(hname, htitle, 200, -10., 10.);
- sprintf(hname, "fHnSigma%sTOF%s", AliPID::ParticleName(ispec), imode ? "after" : "before");
- sprintf(htitle, "TOF sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before");
+ snprintf(hname, 256, "fHnSigma%sTOF%s", AliPID::ParticleName(ispec), imode ? "after" : "before");
+ snprintf(htitle, 256, "TOF sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before");
fHnSigmaTOF[ispec][imode] = new TH1F(hname, htitle, 200, -10., 10.);
}
}
//
// Check whether the tracks survived the cuts
//
+ if(!fPIDresponse){
+ Init();
+ if (!fPIDresponse)
+ AliError("PID Response not available");
+ return 0;
+ }
enum{
kCutClusterRatioTPC,
kCutNsigmaTPC,
kCutNsigmaTOF
};
Long64_t cutRequired=0, cutFullfiled = 0;
- if(fTOFsigmaCutRequired && event == 0)
+ if(fTOFsigmaCutRequired && event == 0) {
AliError("No event pointer. Need event pointer for T0 for TOF cut");
+ return (0);
+ }
Double_t clusterRatio = track->GetTPCNclsF() ? static_cast<Float_t>(track->GetTPCNcls())/static_cast<Float_t>(track->GetTPCNclsF()) : 1.;
if(fCutTPCclusterRatio > 0.){
SETBIT(cutRequired, kCutClusterRatioTPC);
// check TPC nSigma cut
Float_t nsigmaTPC[AliPID::kSPECIES], nsigma; // need all sigmas for QA plotting
for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){
- nsigmaTPC[ispec] = nsigma = fESDpid->NumberOfSigmasTPC(track,(AliPID::EParticleType)ispec);
+ nsigmaTPC[ispec] = nsigma = fPIDresponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)ispec);
if(!(fTPCsigmaCutRequired & 1 << ispec)) continue;
SETBIT(cutRequired, kCutNsigmaTPC); // We found at least one species where the n-Sigma Cut is required
if(nsigma >= fCutTPCnSigma[2*ispec] && nsigma <= fCutTPCnSigma[2*ispec+1]) SETBIT(cutFullfiled, kCutNsigmaTPC); // Fullfiled for at least one species
track->GetIntegratedTimes(times);
for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){
- if(hasTOFpid) nsigmaTOF[ispec] = nsigma = fESDpid->NumberOfSigmasTOF(track,(AliPID::EParticleType)ispec, event->GetT0());
+ if(hasTOFpid && event) nsigmaTOF[ispec] = nsigma = fPIDresponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)ispec);
if(!(fTOFsigmaCutRequired && 1 << ispec)) continue;
SETBIT(cutRequired, kCutNsigmaTOF);
if(track->GetOuterParam()->P() >= fMinMomentumTOF){