AliPhysics  master (3d17d9d)
AliAnalysisTaskSEHFSystPID.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKSEHFSYSTPID_H
2 #define ALIANALYSISTASKSEHFSYSTPID_H
3 
4 /* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. */
5 
7 // \class AliAnalysisTaskSEHFSystPID //
8 // \brief analysis task for the study of PID systematic uncertainties of HF particles //
9 // \author: A. M. Barbano, anastasia.maria.barbano@cern.ch //
10 // \author: F. Grosa, fabrizio.grosa@cern.ch //
12 
13 #include <vector>
14 #include <TH1.h>
15 #include <TH2.h>
16 #include <TList.h>
17 #include <TString.h>
18 
19 #include "AliAnalysisTaskSE.h"
20 #include "AliAODv0KineCuts.h"
21 #include "AliAODTrack.h"
22 #include "AliAODEvent.h"
23 #include "AliESDtrackCuts.h"
24 #include "AliPIDResponse.h"
25 #include "AliAODPidHF.h"
26 #include "AliEventCuts.h"
27 
28 using namespace std;
29 
31 
32 public:
33 
34  enum tagflags {
35  kIsPionFromK0s = BIT(0),
36  kIsPionFromL = BIT(1),
37  kIsProtonFromL = BIT(2),
38  kIsElectronFromGamma = BIT(3),
39  kIsKaonFromKinks = BIT(4),
40  kIsKaonFromTOF = BIT(5),
41  kIsKaonFromTPC = BIT(6),
42  kIsKaonFromHMPID = BIT(7),
43  kIsDeuteronFromTPCTOF = BIT(8),
44  kIsTritonFromTPCTOF = BIT(9),
45  kIsHe3FromTPCTOF = BIT(10),
46  kPositiveTrack = BIT(14),
47  kNegativeTrack = BIT(15),
48  };
49 
50  enum trackinfo {
51  kHasSPDAny = BIT(0),
52  kHasSPDFirst = BIT(1),
53  kHasITSrefit = BIT(2),
54  kHasTPCrefit = BIT(3),
55  kPassGeomCut = BIT(4),
56  kHasNoITS = BIT(5),
57  kHasNoTPC = BIT(6),
58  kHasNoTOF = BIT(7)
59  };
60 
61  enum centest {
67  kCentCL1
68  };
69 
71  AliAnalysisTaskSEHFSystPID(const char *name, int system=0);
72  virtual ~AliAnalysisTaskSEHFSystPID();
73 
74  virtual void UserCreateOutputObjects();
75  virtual void UserExec(Option_t *option);
76 
77  void SetReadMC(bool flag = true) {fIsMC = flag;}
78  void SetCentralityLimits(int mincent, int maxcent) {fCentMin = mincent; fCentMax = maxcent;}
79  void SetCentralityEstimator(int centest=kCentV0M) {fCentEstimator=centest;}
80  void SetESDtrackCuts(AliESDtrackCuts * trackCuts) {fESDtrackCuts = trackCuts;}
81  void SetTriggerInfo(TString trigClass, unsigned long long mask=0) {fTriggerClass = trigClass; fTriggerMask = mask;}
82  void SetNsigmaForKaonTagging(float nsigmamax = 0.02) {fNsigmaMaxForKaonTag=nsigmamax;}
83  void SetNsigmaForNucleiTagging(float nsigmamax = 3) {fNsigmaMaxForNucleiTag=nsigmamax;}
84  void SetKinksSelections(float qtmin=0.15, float Rmin=120, float Rmax=210) {fQtMinKinks=qtmin; fRMinKinks=Rmin; fRMaxKinks=Rmax;}
85  void SetfFillTreeWithPIDInfo(bool fillPID=true) {fFillTreeWithPIDInfo=fillPID;}
86  void SetfFillTreeWithNsigmaPIDOnly(bool fillonlyNsigma=true) {fFillTreeWithNsigmaPIDOnly=fillonlyNsigma;}
87  void SetfFillTreeWithRawPIDOnly(bool fillonlyRawPID=true) {fFillTreeWithRawPIDOnly=fillonlyRawPID;}
88  void SetfFillTreeWithTrackQualityInfo(bool fillTrack=true) {fFillTreeWithTrackQualityInfo=fillTrack;}
89  void EnableDownSampling(double fractokeep=0.1, double ptmax=1.5, int opt=0) {fEnabledDownSampling=true; fFracToKeepDownSampling=fractokeep; fPtMaxDownSampling=ptmax; fDownSamplingOpt=opt;}
90  void SetAODMismatchProtection(int opt=1) {fAODProtection=opt;}
91  void SetDownSamplingOption(int opt=0) {fDownSamplingOpt=opt;}
92 
93  void EnableNsigmaDataDrivenCorrection(int syst) {fEnableNsigmaTPCDataCorr=true; fSystNsigmaTPCDataCorr=syst;}
94 
95  void EnableSelectionWithAliEventCuts(bool useAliEventCuts=true, int opt=2) {fUseAliEventCuts=useAliEventCuts; fApplyPbPbOutOfBunchPileupCuts=opt;}
96  void SetUseTimeRangeCutForPbPb2018(bool opt) {fUseTimeRangeCutForPbPb2018=opt;}
97 
98  void SetConversionFactordEdx(float factor) {fConversionFactordEdx=factor;}
99 
100  void ConfigureCutGeoNcrNcl(double dz, double len, double onept, double fncr, double fncl) {
101  fDeadZoneWidth=dz;
102  fCutGeoNcrNclLength=len;
103  fCutGeoNcrNclGeom1Pt=onept;
104  fCutGeoNcrNclFractionNcr=fncr;
105  fCutGeoNcrNclFractionNcl=fncl;
106  }
107 
108  void EnableParticleSpecies(bool pi=true, bool kao=true, bool pr=true, bool el=false, bool deu=false, bool tr=false, bool He3=false);
109  void EnableDetectors(bool ITS=false, bool TPC=true, bool TOF=true, bool HMPID=false);
110 
111 private:
112 
113  bool IsVertexAccepted();
114  bool IsCentralitySelected();
115  void GetTaggedV0s(vector<short> &idPionFromK0s, vector<short> &idPionFromL, vector<short> &idProtonFromL, vector<short> &idElectronFromGamma);
116  int GetPDGcodeFromMC(AliAODTrack* track, TClonesArray* arrayMC);
117  AliAODTrack* IsKinkDaughter(AliAODTrack* track);
118  void GetTaggedKaonsFromKinks(vector<short> &idKaonFromKinks);
119  float MaxOpeningAngleKnu(float p);
120  float GetTOFmomentum(AliAODTrack* track);
121  short ConvertFloatToShort(float num);
122  unsigned short ConvertFloatToUnsignedShort(float num);
123  void GetNsigmaTPCMeanSigmaData(float &mean, float &sigma, AliPID::EParticleType species, float pTPC, float eta);
124  void SetNsigmaTPCDataCorr(int run);
125  int IsEventSelectedWithAliEventCuts();
126  bool IsSelectedByGeometricalCut(AliAODTrack* track);
127  bool FillNsigma(int iDet, AliAODTrack* track);
128 
129  enum {kPion,kKaon,kProton,kElectron,kDeuteron,kTriton,kHe3};
130  enum {kITS,kTPC,kTOF,kHMPID};
131 
132  const float kCSPEED = 2.99792457999999984e-02; // cm / ps
133  static const int kNMaxDet = 4;
134  static const int kNMaxHypo = 7;
135 
137 
138  TH1F *fHistNEvents;
139  TH2F *fHistArmenteroPlot[5];
145  TH2F *fHistNsigmaVsPt[kNMaxDet][kNMaxHypo];
147 
148  bool fEnabledSpecies[kNMaxHypo];
149  bool fEnabledDet[kNMaxDet];
150 
151  short fPIDNsigma[kNMaxDet][kNMaxHypo];
152  unsigned short fP;
153  unsigned short fPTPC;
154  unsigned short fPTOF;
155  unsigned short fPHMPID;
156  unsigned short fdEdxTPC;
157  unsigned short fdEdxITS;
158  unsigned short fToF;
159  unsigned short fPt;
160  unsigned char fTPCNcls;
161  unsigned char fTPCNclsPID;
162  unsigned short fTrackLength;
163  unsigned short fStartTimeRes;
164  unsigned char fTPCNcrossed;
165  unsigned char fTPCFindable;
166  unsigned char fITSclsMap;
167  unsigned short fHMPIDsignal;
168  unsigned short fHMPIDoccupancy;
169  unsigned char fTrackInfoMap;
170  short fEta;
171  unsigned short fPhi;
172  int fPDGcode;
173  unsigned short fTag;
176  float fQtMinKinks;
177  float fRMinKinks;
178  float fRMaxKinks;
184 
185  float fCentMin;
186  float fCentMax;
189  unsigned long long fTriggerMask;
190  bool fIsMC;
191  int fSystem;
192 
194 
195  AliESDtrackCuts * fESDtrackCuts;
197  AliPIDResponse *fPIDresp;
198  AliAODv0KineCuts *fV0cuts;
199 
208 
210 
214  vector<vector<float> > fMeanNsigmaTPCPionData;
215  vector<vector<float> > fMeanNsigmaTPCKaonData;
216  vector<vector<float> > fMeanNsigmaTPCProtonData;
217  vector<vector<float> > fSigmaNsigmaTPCPionData;
218  vector<vector<float> > fSigmaNsigmaTPCKaonData;
219  vector<vector<float> > fSigmaNsigmaTPCProtonData;
220  float fPlimitsNsigmaTPCDataCorr[AliAODPidHF::kMaxPBins+1];
222  float fEtalimitsNsigmaTPCDataCorr[AliAODPidHF::kMaxEtaBins+1];
225  AliEventCuts fAliEventCuts;
228  AliTimeRangeCut fTimeRangeCut;
229 
230  ClassDef(AliAnalysisTaskSEHFSystPID, 16);
231 };
232 
233 #endif
void SetCentralityLimits(int mincent, int maxcent)
float fNsigmaMaxForNucleiTag
max nSigma value to tag kaons
int fApplyPbPbOutOfBunchPileupCuts
event-cut object for centrality correlation event cuts
void SetKinksSelections(float qtmin=0.15, float Rmin=120, float Rmax=210)
Definition: External.C:236
float fCutGeoNcrNclLength
1st parameter geometrical cut
AliPIDResponse * fPIDresp
AOD object.
void SetTriggerInfo(TString trigClass, unsigned long long mask=0)
TH1F * fHistNEvents
! histo with number of events
unsigned short fPt
ToF signal to fill the tree.
unsigned short fPTOF
TPC momentum to fill the tree.
vector< vector< float > > fSigmaNsigmaTPCProtonData
array of NsigmaTPC kaon mean in data
float fNsigmaMaxForKaonTag
bit map for tag (see enum above)
unsigned short fTrackLength
number of PID clusters in TPC to fill the tree
void SetCentralityEstimator(int centest=kCentV0M)
double fFracToKeepDownSampling
flag to enable/disable downsampling
AliEventCuts fAliEventCuts
flag to enable usage of AliEventCuts foe event-selection
int fNEtabinsNsigmaTPCDataCorr
vector of eta limits for data-driven NsigmaTPC correction
int fSystNsigmaTPCDataCorr
flag to enable data-driven NsigmaTPC correction
vector< vector< float > > fMeanNsigmaTPCPionData
system for data-driven NsigmaTPC correction
unsigned char fTPCNcls
transverse momentum to fill the tree
TH2F * fHistOpeningAngleVsPMotherKink
! histo for opening angle vs. pT mother kink
float fQtMinKinks
max nSigma value to tag nuclei
unsigned char fTPCNcrossed
start time resolution for TOF PID
int fAODProtection
option for downsampling
TH2F * fHistNTPCclsVsRadius
! histo for nTPC clusters vs. R mother kink
TH2F * fHistQtVsMassKinks
! histo for mother-kink qt vs. mass distribution
unsigned char fTPCNclsPID
number of clusters in TPC to fill the tree
unsigned short fStartTimeRes
track length for TOF PID
Double_t * sigma
int fNPbinsNsigmaTPCDataCorr
array of p limits for data-driven NsigmaTPC correction
void EnableSelectionWithAliEventCuts(bool useAliEventCuts=true, int opt=2)
void SetESDtrackCuts(AliESDtrackCuts *trackCuts)
unsigned short fdEdxTPC
HMPID momentum to fill the tree.
unsigned short fToF
ITS dEdX to fill the tree.
void SetNsigmaForKaonTagging(float nsigmamax=0.02)
double fPtMaxDownSampling
fraction to keep when downsampling activated
AliTimeRangeCut fTimeRangeCut
flag to enable time-range cut in PbPb 2018
float fCentMin
5th parameter geometrical cut
unsigned short fHMPIDsignal
ITS cluster map.
float fRMaxKinks
min radius in XY for kinks
const Double_t ptmax
int fDownSamplingOpt
pT max of tracks to downsample
AliAODEvent * fAOD
single-track cut set
unsigned short fPTPC
Momentum at primary vertex to fill the tree.
static const int kMaxPBins
Definition: AliAODPidHF.h:45
unsigned char fTPCFindable
number of TPC crossed rows
vector< vector< float > > fSigmaNsigmaTPCKaonData
array of NsigmaTPC pion mean in data
void EnableDownSampling(double fractokeep=0.1, double ptmax=1.5, int opt=0)
TH2F * fHistdEdxVsPMotherKink
! histo for mother kink TPC dEdx vs. p
TH2F * fHistPDaughterVsMotherKink
! histo for pT daughter vs. pT mother kink
void SetNsigmaForNucleiTagging(float nsigmamax=3)
AliESDtrackCuts * fESDtrackCuts
conversion factor from float to short for dE/dx
unsigned short fPhi
pseudorapidity of the track
bool fUseAliEventCuts
number of eta bins for data-driven NsigmaTPC correction
unsigned short fHMPIDoccupancy
HMPID signal.
void SetfFillTreeWithTrackQualityInfo(bool fillTrack=true)
bool fEnableNsigmaTPCDataCorr
run number of previous event
float fCutGeoNcrNclFractionNcl
4th parameter geometrical cut
unsigned short fTag
PDG code in case of MC to fill the tree.
vector< vector< float > > fMeanNsigmaTPCKaonData
array of NsigmaTPC pion mean in data
void SetfFillTreeWithPIDInfo(bool fillPID=true)
bool fUseTimeRangeCutForPbPb2018
option for Pb-Pb out-of bunch pileup cuts with AliEventCuts
TList * fOutputList
! output list for histograms
TTree * fPIDtree
! tree with PID info
AliAODv0KineCuts * fV0cuts
basic pid object
unsigned long long fTriggerMask
trigger class
int fSystem
flag to switch on the MC analysis for the efficiency estimation
unsigned short fdEdxITS
TPC dEdX to fill the tree.
static const int kMaxEtaBins
Definition: AliAODPidHF.h:44
float fConversionFactordEdx
system: 0->pp,pPb 1->PbPb
bool fFillTreeWithNsigmaPIDOnly
flag to enable filling of the tree with PID variables
const char Option_t
Definition: External.C:48
unsigned short fPHMPID
TOF momentum to fill the tree.
vector< vector< float > > fSigmaNsigmaTPCPionData
array of NsigmaTPC proton mean in data
unsigned char fITSclsMap
number of TPC findable clusters
const Double_t pi
void SetfFillTreeWithRawPIDOnly(bool fillonlyRawPID=true)
float fDeadZoneWidth
max radius in XY for kink
TString fTriggerClass
centrality estimator
bool fFillTreeWithTrackQualityInfo
flag to enable filling of the tree with only raw variables for the PID
int fRunNumberPrevEvent
flag to activate protection against AOD-dAOD mismatch
unsigned char fTrackInfoMap
HMPID occupancy.
bool fEnabledDownSampling
flag to enable filling of the tree with track selections
short fEta
bit map with some track info (see enum above)
void SetfFillTreeWithNsigmaPIDOnly(bool fillonlyNsigma=true)
void ConfigureCutGeoNcrNcl(double dz, double len, double onept, double fncr, double fncl)
float fCutGeoNcrNclGeom1Pt
2nd parameter geometrical cut
int fPDGcode
azimuthal angle of the track
unsigned short fP
Nsigma PID to fill the tree.
bool fFillTreeWithRawPIDOnly
flag to enable filling of the tree with only Nsigma variables for the PID
float fCutGeoNcrNclFractionNcr
3rd parameter geometrical cut
vector< vector< float > > fMeanNsigmaTPCProtonData
array of NsigmaTPC kaon mean in data