#ifndef ALICONVERSIONCUTS_H
#define ALICONVERSIONCUTS_H
#include "AliAODpidUtil.h"
#include "AliConversionPhotonBase.h"
#include "AliAODConversionMother.h"
#include "AliAODTrack.h"
#include "AliESDtrack.h"
#include "AliVTrack.h"
#include "AliAODTrack.h"
#include "AliStack.h"
#include "AliAnalysisCuts.h"
#include "TH1F.h"
#include "TF1.h"
#include "AliAnalysisUtils.h"
#include "AliAnalysisManager.h"
class AliESDEvent;
class AliAODEvent;
class AliConversionPhotonBase;
class AliKFVertex;
class TH1F;
class TH2F;
class TF1;
class AliPIDResponse;
class AliAnalysisCuts;
class iostream;
class TList;
class AliAnalysisManager;
class AliAODMCParticle;
using namespace std;
class AliConversionCuts : public AliAnalysisCuts {
public:
enum cutIds {
kisHeavyIon,
kCentralityMin,
kCentralityMax,
kSelectSpecialTriggerAlias,
kSelectSubTriggerClass,
kremovePileUp,
kExtraSignals,
kv0FinderType,
ketaCut,
kRCut,
ksinglePtCut,
kclsTPCCut,
kededxSigmaCut,
kpidedxSigmaCut,
kpiMomdedxSigmaCut,
kpiMaxMomdedxSigmaCut,
kLowPRejectionSigmaCut,
kTOFelectronPID,
kQtMaxCut,
kchi2GammaCut,
kPsiPair,
kdoPhotonAsymmetryCut,
kCosPAngle,
kElecShare,
kToCloseV0s,
kDcaRPrimVtx,
kDcaZPrimVtx,
kInPlaneOutOfPlane,
kNCuts
};
enum photonCuts {
kPhotonIn=0,
kOnFly,
kNoTracks,
kTrackCuts,
kdEdxCuts,
kConvPointFail,
kPhotonCuts,
kEventPlane,
kPhotonOut
};
Bool_t SetCutIds(TString cutString);
Int_t fCuts[kNCuts];
Bool_t SetCut(cutIds cutID, Int_t cut);
Bool_t UpdateCutString();
static const char * fgkCutNames[kNCuts];
Double_t GetCosineOfPointingAngle(const AliConversionPhotonBase * photon, AliVEvent * event) const;
Bool_t InitializeCutsFromCutString(const TString analysisCutSelection);
void SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kAny) {
fOfflineTriggerMask = offlineTriggerMask;
fTriggerSelectedManually = kTRUE;
}
void SelectSpecialTrigger(UInt_t offlineTriggerMask = AliVEvent::kAny, TString TriggerClassName = "AliVEvent::kAny" ) {
fOfflineTriggerMask = offlineTriggerMask;
fSpecialTriggerName = TriggerClassName;
cout << fSpecialTriggerName.Data() << endl;
}
void FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0);
void SetAcceptedHeader(TList *HeaderList){fHeaderList = HeaderList;}
void SetPreSelectionCutFlag(Bool_t preSelFlag){fPreSelCut = preSelFlag;}
TString *GetFoundHeader(){return fGeneratorNames;}
Int_t GetEventQuality(){return fEventQuality;}
Bool_t GetIsFromPileup(){return fRemovePileUp;}
AliConversionCuts(const char *name="V0Cuts", const char * title="V0 Cuts");
AliConversionCuts(const AliConversionCuts&);
AliConversionCuts& operator=(const AliConversionCuts&);
virtual ~AliConversionCuts();
static AliConversionCuts * GetStandardCuts2010PbPb();
static AliConversionCuts * GetStandardCuts2010pp();
virtual Bool_t IsSelected(TObject* ){return kTRUE;}
virtual Bool_t IsSelected(TList* ) {return kTRUE;}
TString GetCutNumber();
void GetCentralityRange(Double_t range[2]){range[0]=10*fCentralityMin;range[1]=10*fCentralityMax;};
Bool_t EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent);
Int_t IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon);
Bool_t PhotonIsSelected(AliConversionPhotonBase * photon, AliVEvent * event);
Bool_t PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma=kTRUE);
Bool_t PhotonIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma=kTRUE);
Bool_t ElectronIsSelectedMC(TParticle *particle,AliStack *fMCStack);
Bool_t TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack);
Bool_t MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal=kTRUE);
Bool_t MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack, Bool_t bMCDaughtersInAcceptance=kFALSE);
void InitAODpidUtil(Int_t type);
Bool_t InitPIDResponse();
void SetPIDResponse(AliPIDResponse * pidResponse) {fPIDResponse = pidResponse;}
AliPIDResponse * GetPIDResponse() { return fPIDResponse;}
void PrintCuts();
void PrintCutsWithValues();
void InitCutHistograms(TString name="",Bool_t preCut = kTRUE);
void SetFillCutHistograms(TString name="",Bool_t preCut = kTRUE){if(!fHistograms){InitCutHistograms(name,preCut);};}
TList *GetCutHistograms(){return fHistograms;}
void FillPhotonCutIndex(Int_t photoncut){if(hCutIndex)hCutIndex->Fill(photoncut);}
void FillV0EtaBeforedEdxCuts(Float_t v0Eta){if(hEtaDistV0s)hEtaDistV0s->Fill(v0Eta);}
void FillV0EtaAfterdEdxCuts(Float_t v0Eta){if(hEtaDistV0sAfterdEdxCuts)hEtaDistV0sAfterdEdxCuts->Fill(v0Eta);}
void SetEtaShift(Double_t etaShift) {
fEtaShift = etaShift;
}
void SetEtaShift(TString pPbOrPbp) {
Double_t etaShift = 0.0;
if(!pPbOrPbp.CompareTo("pPb")) etaShift = -0.465;
else if(!pPbOrPbp.CompareTo("Pbp")) etaShift = 0.465;
fEtaShift = etaShift;
}
Double_t GetEtaShift() {return fEtaShift;}
Bool_t GetDoEtaShift(){return fDoEtaShift;}
void DoEtaShift(Bool_t doEtaShift){fDoEtaShift = doEtaShift;}
void GetCorrectEtaShiftFromPeriod(TString periodName);
static AliVTrack * GetTrack(AliVEvent * event, Int_t label);
static AliESDtrack *GetESDTrack(AliESDEvent * event, Int_t label);
Bool_t SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex);
Bool_t SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex);
Bool_t AcceptanceCuts(AliConversionPhotonBase *photon);
Bool_t AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg);
Bool_t dEdxCuts(AliVTrack * track);
Bool_t ArmenterosQtCut(AliConversionPhotonBase *photon);
Bool_t AsymmetryCut(AliConversionPhotonBase *photon,AliVEvent *event);
Bool_t PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event);
Bool_t SelectV0Finder(Bool_t onfly){
if(onfly == fUseOnFlyV0Finder) return kTRUE;
else return kFALSE;
}
Bool_t PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event);
Bool_t CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event);
Bool_t PsiPairCut(const AliConversionPhotonBase * photon) const;
Bool_t CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const;
Bool_t RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s);
Bool_t RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0);
Int_t IsParticleFromBGEvent(Int_t index, AliStack *MCStack, AliVEvent *InputEvent = 0x0);
void GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent);
void SetUseReweightingWithHistogramFromFile( Bool_t pi0reweight=kTRUE, Bool_t etareweight=kFALSE, Bool_t k0sreweight=kFALSE, TString path="$ALICE_ROOT/PWGGA/GammaConv/MCSpectraInput.root",
TString histoNamePi0 = "", TString histoNameEta = "", TString histoNameK0s = "",
TString fitNamePi0 = "", TString fitNameEta = "", TString fitNameK0s ="" ) {
AliInfo(Form("enabled reweighting for: pi0 : %i, eta: %i, K0s: %i",pi0reweight, etareweight, k0sreweight));
fDoReweightHistoMCPi0 = pi0reweight;
fDoReweightHistoMCEta = etareweight;
fDoReweightHistoMCK0s = k0sreweight;
fPathTrFReweighting=path;
fNameHistoReweightingPi0 =histoNamePi0;
fNameHistoReweightingEta =histoNameEta;
fNameHistoReweightingK0s =histoNameK0s;
fNameFitDataPi0 =fitNamePi0;
fNameFitDataEta =fitNameEta;
fNameFitDataK0s =fitNameK0s;
}
void LoadReweightingHistosMCFromFile ();
UChar_t DeterminePhotonQualityAOD(AliAODConversionPhoton*, AliVEvent*);
Bool_t IsCentralitySelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent = NULL);
Double_t GetCentrality(AliVEvent *event);
Int_t GetNumberOfContributorsVtx(AliVEvent *event);
Bool_t VertexZCut(AliVEvent *fInputEvent);
Bool_t IsTriggerSelected(AliVEvent *fInputEvent);
Bool_t HasV0AND(){return fHasV0AND;}
Bool_t IsSDDFired(){return fIsSDDFired;}
Int_t IsSpecialTrigger(){return fSpecialTrigger;}
TString GetSpecialTriggerName(){return fSpecialTriggerName;}
Bool_t InPlaneOutOfPlaneCut(Double_t photonPhi, Double_t eventPlaneAngle = -100, Bool_t fill = kTRUE);
Int_t GetInPlaneOutOfPlaneCut(){return fInPlaneOutOfPlane;}
Bool_t SetRCut(Int_t RCut);
Bool_t SetV0Finder(Int_t v0FinderType);
Bool_t SetChi2GammaCut(Int_t chi2GammaCut);
Bool_t SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut);
Bool_t SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut);
Bool_t SetSinglePtCut(Int_t singlePtCut);
Bool_t SetTPCClusterCut(Int_t clsTPCCut);
Bool_t SetEtaCut(Int_t etaCut);
Bool_t SetMinMomPiondEdxCut(Int_t piMinMomdedxSigmaCut);
Bool_t SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut);
Bool_t SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut);
Bool_t SetQtMaxCut(Int_t QtMaxCut);
Bool_t SetTOFElectronPIDCut(Int_t TOFelectronPID);
Bool_t SetTRDElectronCut(Int_t TRDElectronCut);
Bool_t SetCentralityMin(Int_t useCentrality);
Bool_t SetIsHeavyIon(Int_t isHeavyIon);
Bool_t SetCentralityMax(Int_t centralityBin);
Bool_t SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut);
Bool_t SetRemovePileUp(Int_t removePileUp);
Bool_t SetMultiplicityMethod(Int_t multiplicityMethod);
Bool_t SetSelectSpecialTrigger(Int_t selectSpecialTrigger);
Bool_t SetSelectSubTriggerClass (Int_t selectSpecialSubTriggerClass);
Bool_t SetCosPAngleCut(Int_t cosCut);
Bool_t SetPsiPairCut(Int_t psiCut);
Bool_t SetSharedElectronCut(Int_t sharedElec);
Bool_t SetToCloseV0sCut(Int_t toClose);
Bool_t SetRejectExtraSignalsCut(Int_t extraSignal);
Bool_t SetDCARPhotonPrimVtxCut(Int_t DCARPhotonPrimVtx);
Bool_t SetDCAZPhotonPrimVtxCut(Int_t DCAZPhotonPrimVtx);
Bool_t SetInPlaneOutOfPlane(Int_t inOutPlane);
void SetAddedSignalPDGCode(Int_t addedSignalPDGcode) {fAddedSignalPDGCode = addedSignalPDGcode;}
Int_t IsHeavyIon(){return fIsHeavyIon;}
Int_t GetFirstTPCRow(Double_t radius);
Float_t GetWeightForMeson(TString period, Int_t index, AliStack *MCStack, AliVEvent *InputEvent = 0x0);
Bool_t UseElecSharingCut(){return fDoSharedElecCut;}
Bool_t UseToCloseV0sCut(){return fDoToCloseV0sCut;}
Int_t GetMultiplicityMethod(){return fMultiplicityMethod;}
Double_t GetEtaCut(){return fEtaCut;}
Int_t GetSignalRejection(){return fRejectExtraSignals;}
Int_t GetNAcceptedHeaders(){return fnHeaders; }
TString * GetAcceptedHeaderNames(){return fGeneratorNames;}
Int_t * GetAcceptedHeaderStart(){return fNotRejectedStart;}
Int_t * GetAcceptedHeaderEnd(){return fNotRejectedEnd;}
TList* GetAcceptedHeader(){return fHeaderList;}
protected:
TList *fHistograms;
TList *fHeaderList;
AliPIDResponse *fPIDResponse;
Int_t fEventQuality;
Double_t fMaxR;
Double_t fMinR;
Double_t fEtaCut;
Double_t fEtaCutMin;
Double_t fPtCut;
Double_t fSinglePtCut;
Double_t fMaxZ;
Double_t fMinClsTPC;
Double_t fMinClsTPCToF;
Double_t fLineCutZRSlope;
Double_t fLineCutZValue;
Double_t fLineCutZRSlopeMin;
Double_t fLineCutZValueMin;
Double_t fChi2CutConversion;
Double_t fPIDProbabilityCutNegativeParticle;
Double_t fPIDProbabilityCutPositiveParticle;
Bool_t fDodEdxSigmaCut;
Bool_t fDoTOFsigmaCut;
Double_t fPIDTRDEfficiency;
Bool_t fDoTRDPID;
Double_t fPIDnSigmaAboveElectronLine;
Double_t fPIDnSigmaBelowElectronLine;
Double_t fTofPIDnSigmaAboveElectronLine;
Double_t fTofPIDnSigmaBelowElectronLine;
Double_t fPIDnSigmaAbovePionLine;
Double_t fPIDnSigmaAbovePionLineHighPt;
Double_t fPIDMinPnSigmaAbovePionLine;
Double_t fPIDMaxPnSigmaAbovePionLine;
Double_t fDoKaonRejectionLowP;
Double_t fDoProtonRejectionLowP;
Double_t fDoPionRejectionLowP;
Double_t fPIDnSigmaAtLowPAroundKaonLine;
Double_t fPIDnSigmaAtLowPAroundProtonLine;
Double_t fPIDnSigmaAtLowPAroundPionLine;
Double_t fPIDMinPKaonRejectionLowP;
Double_t fPIDMinPProtonRejectionLowP;
Double_t fPIDMinPPionRejectionLowP;
Bool_t fDoQtGammaSelection;
Bool_t fDo2DQt;
Double_t fQtMax;
Double_t fXVertexCut;
Double_t fYVertexCut;
Double_t fZVertexCut;
Double_t fNSigmaMass;
Bool_t fUseEtaMinCut;
Bool_t fUseOnFlyV0Finder;
Bool_t fDoPhotonAsymmetryCut;
Double_t fMinPPhotonAsymmetryCut;
Double_t fMinPhotonAsymmetry;
Int_t fIsHeavyIon;
Int_t fDetectorCentrality;
Int_t fModCentralityClass;
Double_t fMaxVertexZ;
Int_t fCentralityMin;
Int_t fCentralityMax;
Bool_t fUseCorrectedTPCClsInfo;
Bool_t fUseTOFpid;
Int_t fMultiplicityMethod;
Int_t fSpecialTrigger;
Int_t fSpecialSubTrigger;
Bool_t fRemovePileUp;
Float_t fOpeningAngle;
Float_t fPsiPairCut;
Bool_t fDo2DPsiPairChi2;
Float_t fCosPAngleCut;
Bool_t fDoToCloseV0sCut;
Int_t fRejectExtraSignals;
Double_t fminV0Dist;
Bool_t fDoSharedElecCut;
Bool_t fDoPhotonQualitySelectionCut;
Int_t fPhotonQualityCut;
UInt_t fOfflineTriggerMask;
Bool_t fHasV0AND;
Bool_t fIsSDDFired;
TRandom3 fRandom;
Int_t fElectronArraySize;
Int_t *fElectronLabelArray;
Double_t fDCAZPrimVtxCut;
Double_t fDCARPrimVtxCut;
Int_t fInPlaneOutOfPlane;
Float_t fConversionPointXArray;
Float_t fConversionPointYArray;
Float_t fConversionPointZArray;
Int_t fnHeaders;
Int_t *fNotRejectedStart;
Int_t *fNotRejectedEnd;
TString *fGeneratorNames;
TObjString *fCutString;
AliAnalysisUtils *fUtils;
Double_t fEtaShift;
Bool_t fDoEtaShift;
Bool_t fDoReweightHistoMCPi0;
Bool_t fDoReweightHistoMCEta;
Bool_t fDoReweightHistoMCK0s;
TString fPathTrFReweighting;
TString fNameHistoReweightingPi0;
TString fNameHistoReweightingEta;
TString fNameHistoReweightingK0s;
TString fNameFitDataPi0;
TString fNameFitDataEta;
TString fNameFitDataK0s;
TH1F* hEtaDistV0s;
TH1F* hEtaDistV0sAfterdEdxCuts;
TH1F *hdEdxCuts;
TH2F *hTPCdEdxbefore;
TH2F *hTPCdEdxafter;
TH2F *hTPCdEdxSigbefore;
TH2F *hTPCdEdxSigafter;
TH2F *hTOFbefore;
TH2F *hTOFSigbefore;
TH2F *hTOFSigafter;
TH2F *hPsiPairDeltaPhiafter;
TH1F *hTrackCuts;
TH1F *hPhotonCuts;
TH1F *hInvMassbefore;
TH2F *hArmenterosbefore;
TH1F *hInvMassafter;
TH2F *hArmenterosafter;
TH1F *hAcceptanceCuts;
TH1F *hCutIndex;
TH1F *hV0EventCuts;
TH1F *hCentrality;
TH2F *hCentralityVsNumberOfPrimaryTracks;
TH1F *hVertexZ;
TH1F *hEventPlanePhi;
TH1F *hTriggerClass;
TH1F *hTriggerClassSelected;
TH1D *hReweightMCHistPi0;
TH1D *hReweightMCHistEta;
TH1D *hReweightMCHistK0s;
TF1 *fFitDataPi0;
TF1 *fFitDataEta;
TF1 *fFitDataK0s;
Int_t fAddedSignalPDGCode;
Bool_t fPreSelCut;
Bool_t fTriggerSelectedManually;
TString fSpecialTriggerName;
TString fSpecialSubTriggerName;
Int_t fNSpecialSubTriggerOptions;
private:
ClassDef(AliConversionCuts,9)
};
inline void AliConversionCuts::InitAODpidUtil(Int_t type) {
if (!fPIDResponse) fPIDResponse = new AliAODpidUtil();
Double_t alephParameters[5];
alephParameters[0] = 2.15898e+00/50.;
alephParameters[1] = 1.75295e+01;
alephParameters[2] = 3.40030e-09;
alephParameters[3] = 1.96178e+00;
alephParameters[4] = 3.91720e+00;
fPIDResponse->GetTOFResponse().SetTimeResolution(80.);
if (type==1){
alephParameters[0] = 0.0283086/0.97;
alephParameters[1] = 2.63394e+01;
alephParameters[2] = 5.04114e-11;
alephParameters[3] = 2.12543e+00;
alephParameters[4] = 4.88663e+00;
fPIDResponse->GetTOFResponse().SetTimeResolution(130.);
fPIDResponse->GetTPCResponse().SetMip(50.);
}
fPIDResponse->GetTPCResponse().SetBetheBlochParameters(
alephParameters[0],alephParameters[1],alephParameters[2],
alephParameters[3],alephParameters[4]);
fPIDResponse->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
}
#endif