// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
-#include <Riostream.h>
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
-#include "AliESDpid.h"
-#include "AliTOFT0maker.h"
-#include "AliTOFcalib.h"
-#include "AliCDBManager.h"
-#include "AliITSPIDResponse.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnDaughter.h"
#include "AliRsnCutPIDITS.h"
ClassImp(AliRsnCutPIDITS)
AliRsnCutPIDITS::AliRsnCutPIDITS
(const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectOutside) :
AliRsnCut(name, AliRsnCut::kDaughter, min, max),
+ fInitialized(kFALSE),
fRejectOutside(rejectOutside),
fMomMin(0.0),
fMomMax(1E+20),
AliRsnCutPIDITS::AliRsnCutPIDITS
(const AliRsnCutPIDITS& copy) :
AliRsnCut(copy),
+ fInitialized(kFALSE),
fRejectOutside(copy.fRejectOutside),
fMomMin(copy.fMomMin),
fMomMax(copy.fMomMax),
AliRsnCut::operator=(copy);
+ fInitialized = kFALSE;
fRejectOutside = copy.fRejectOutside;
fMomMin = copy.fMomMin;
fMomMax = copy.fMomMax;
// Cut checker.
//
+ // initialize if needed
+ if (!fInitialized) Initialize();
+
// coherence check
if (!TargetOK(object)) return kFALSE;
AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax));
AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));
}
+
+//_________________________________________________________________________________________________
+void AliRsnCutPIDITS::Initialize()
+{
+//
+// Initialize ESD pid object from global one
+//
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
+ if (handler)
+ {
+ AliESDpid *pid = handler->GetESDpid();
+ fESDpid = (*pid);
+ }
+
+ fInitialized = kTRUE;
+}
private:
+ void Initialize();
+
+ Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object
Bool_t fRejectOutside; // choose if tracks outside momentum range are rejected or not
Double_t fMomMin; // min p in range where this cut is checked
Double_t fMomMax; // max p in range where this cut is checked
// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
-#include "AliRsnEvent.h"
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
+
#include "AliRsnCutPIDTOF.h"
ClassImp(AliRsnCutPIDTOF)
AliRsnCutPIDTOF::AliRsnCutPIDTOF
(const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectUnmatched) :
AliRsnCut(name, AliRsnCut::kDaughter, min, max),
+ fInitialized(kFALSE),
fRejectUnmatched(rejectUnmatched),
fRefType(AliPID::kUnknown),
fRefMass(0.0),
//_________________________________________________________________________________________________
AliRsnCutPIDTOF::AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy) :
AliRsnCut(copy),
+ fInitialized(kFALSE),
fRejectUnmatched(copy.fRejectUnmatched),
fRefType(AliPID::kUnknown),
fRefMass(0.0),
// which sets the mass accordingly and coherently.
//
+ fInitialized = kFALSE;
fRejectUnmatched = copy.fRejectUnmatched;
- fESDpid = copy.fESDpid;
- fAODpid = copy.fAODpid;
+ fESDpid = copy.fESDpid;
+ fAODpid = copy.fAODpid;
SetRefType(copy.fRefType);
// Cut checker.
//
+ // initialize if needed
+ if (!fInitialized) Initialize();
+
// coherence check
if (!TargetOK(object)) return kFALSE;
AliInfo(Form("TOF PID cut range (sigmas): %.3f %.3f", fMinD, fMaxD));
AliInfo(Form("Unmatched tracks are : %s", (fRejectUnmatched ? "rejected" : "accepted")));
}
+
+//_________________________________________________________________________________________________
+void AliRsnCutPIDTOF::Initialize()
+{
+//
+// Initialize ESD pid object from global one
+//
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
+ if (handler)
+ {
+ AliESDpid *pid = handler->GetESDpid();
+ fESDpid = (*pid);
+ }
+
+ fInitialized = kTRUE;
+}
virtual Bool_t IsSelected(TObject *object);
virtual void Print(const Option_t *option = "") const;
- protected:
-
+ private:
+
+ void Initialize();
+
+ Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object
Bool_t fRejectUnmatched; // decide if non TOF matched tracks pass the cut or not
EPARTYPE fRefType; // particle type for which PID is checked
Double_t fRefMass; // reference mass used for computations
// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
-#include <Riostream.h>
-
-#include "AliESDpid.h"
-#include "AliTOFT0maker.h"
-#include "AliTOFcalib.h"
-#include "AliCDBManager.h"
-#include "AliITSPIDResponse.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnDaughter.h"
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
#include "AliRsnCutPIDTPC.h"
ClassImp(AliRsnCutPIDTPC)
AliRsnCutPIDTPC::AliRsnCutPIDTPC
(const char *name, AliPID::EParticleType type, Double_t min, Double_t max, Bool_t rejectOutside) :
AliRsnCut(name, AliRsnCut::kDaughter, min, max),
+ fInitialized(kFALSE),
fRejectOutside(rejectOutside),
fMomMin(0.0),
fMomMax(1E+20),
AliRsnCutPIDTPC::AliRsnCutPIDTPC
(const AliRsnCutPIDTPC& copy) :
AliRsnCut(copy),
+ fInitialized(kFALSE),
fRejectOutside(copy.fRejectOutside),
fMomMin(copy.fMomMin),
fMomMax(copy.fMomMax),
AliRsnCut::operator=(copy);
+ fInitialized = kFALSE;
fRejectOutside = copy.fRejectOutside;
- fMomMin = copy.fMomMin;
- fMomMax = copy.fMomMax;
- fRefType = copy.fRefType;
- fESDpid = copy.fESDpid;
- fAODpid = copy.fAODpid;
+ fMomMin = copy.fMomMin;
+ fMomMax = copy.fMomMax;
+ fRefType = copy.fRefType;
+ fESDpid = copy.fESDpid;
+ fAODpid = copy.fAODpid;
return (*this);
}
// Cut checker.
//
+ // initialize if needed
+ if (!fInitialized) Initialize();
+
// coherence check
if (!TargetOK(object)) return kFALSE;
AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax));
AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));
}
+
+//_________________________________________________________________________________________________
+void AliRsnCutPIDTPC::Initialize()
+{
+//
+// Initialize ESD pid object from global one
+//
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
+ if (handler)
+ {
+ AliESDpid *pid = handler->GetESDpid();
+ fESDpid = (*pid);
+ }
+
+ fInitialized = kTRUE;
+}
private:
+ void Initialize();
+
+ Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object
Bool_t fRejectOutside; // choose if tracks outside momentum range are rejected or not
Double_t fMomMin; // min p in range where this cut is checked
Double_t fMomMax; // max p in range where this cut is checked