25 #include "AliAnalysisUtils.h"
26 #include "AliAODInputHandler.h"
27 #include "AliAODTrack.h"
29 #include "AliEMCALGeometry.h"
30 #include "AliEMCALRecoUtils.h"
31 #include "AliEMCALTriggerPatchInfo.h"
33 #include "AliESDtrackCuts.h"
34 #include "AliESDEvent.h"
35 #include "AliInputEventHandler.h"
36 #include "AliPIDResponse.h"
37 #include "AliTOFPIDResponse.h"
38 #include "AliVVertex.h"
47 namespace EMCalTriggerPtAnalysis {
52 AliAnalysisTaskChargedParticlesRef::AliAnalysisTaskChargedParticlesRef() :
57 fEtaLabCut(-0.5, 0.5),
58 fEtaCmsCut(-0.13, 0.13),
59 fPhiCut(0., TMath::TwoPi()),
60 fKineCorrelation(false),
74 fEtaLabCut(-0.5, 0.5),
75 fEtaCmsCut(-0.13, 0.13),
76 fPhiCut(0., TMath::TwoPi()),
77 fKineCorrelation(false),
102 std::array<Double_t, 5> ptcuts = {1., 2., 5., 10., 20.};
104 const int kdimPID = 3;
105 const int knbinsPID[kdimPID] = {1000, 200, 300};
106 const double kminPID[kdimPID] = {-100., 0., 0.}, kmaxPID[kdimPID] = {100., 200., 1.5};
108 fHistos->
CreateTH1(Form(
"hEventCount%s", trg.Data()), Form(
"Event Counter for trigger class %s", trg.Data()), 1, 0.5, 1.5);
109 fHistos->
CreateTH1(Form(
"hVertexBefore%s", trg.Data()), Form(
"Vertex distribution before z-cut for trigger class %s", trg.Data()), 500, -50, 50);
110 fHistos->
CreateTH1(Form(
"hVertexAfter%s", trg.Data()), Form(
"Vertex distribution after z-cut for trigger class %s", trg.Data()), 100, -10, 10);
111 fHistos->
CreateTH1(Form(
"hPtEtaAll%s", trg.Data()), Form(
"Charged particle pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
112 fHistos->
CreateTH1(Form(
"hPtEtaCent%s", trg.Data()), Form(
"Charged particle pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
113 fHistos->
CreateTH1(Form(
"hPtEMCALEtaAll%s", trg.Data()), Form(
"Charged particle in EMCAL pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
114 fHistos->
CreateTH1(Form(
"hPtEMCALEtaCent%s", trg.Data()), Form(
"Charged particle in EMCAL pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
115 fHistos->
CreateTH1(Form(
"hPtEMCALNoTRDEtaAll%s", trg.Data()), Form(
"Charged particle in EMCAL (no TRD in front) pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
116 fHistos->
CreateTH1(Form(
"hPtEMCALNoTRDEtaCent%s", trg.Data()), Form(
"Charged particle in EMCAL (no TRD in front) pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
117 fHistos->
CreateTH1(Form(
"hPtEMCALWithTRDEtaAll%s", trg.Data()), Form(
"Charged particle in EMCAL (with TRD in front) pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
118 fHistos->
CreateTH1(Form(
"hPtEMCALWithTRDEtaCent%s", trg.Data()), Form(
"Charged particle in EMCAL (with TRD in front) pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
120 fHistos->
CreateTH3(Form(
"hPtEtaPhiAll%s", trg.Data()), Form(
"p_{t}-#eta-#phi distribution of all accepted tracks for trigger %s; p_{t} (GeV/c); #eta; #phi", trg.Data()), newbinning,
TLinearBinning(64, -0.8, 0.8),
TLinearBinning(100, 0., 2*TMath::Pi()));
121 fHistos->
CreateTH3(Form(
"hPtEtaPhiEMCALAll%s", trg.Data()), Form(
"p_{t}-#eta-#phi distribution of all accepted tracks pointing to the EMCAL for trigger %s; p_{t} (GeV/c); #eta; #phi", trg.Data()), newbinning,
TLinearBinning(64, -0.8, 0.8),
TLinearBinning(100, 0., 2*TMath::Pi()));
124 fHistos->
CreateTH2(Form(
"hTPCdEdxEMCAL%s", trg.Data()), Form(
"TPC dE/dx of charged particles in the EMCAL region for trigger %s", trg.Data()), 400, -20., 20., 200, 0., 200.);
125 fHistos->
CreateTH2(Form(
"hTOFBetaEMCAL%s", trg.Data()), Form(
"TOF beta of charged particles in the EMCAL region for trigger %s", trg.Data()), 400, -20., 20., 150, 0., 1.5);
126 fHistos->
CreateTHnSparse(Form(
"hPIDcorrEMCAL%s", trg.Data()), Form(
"Correlation of PID observables for Trigger %s", trg.Data()), kdimPID, knbinsPID, kminPID, kmaxPID);
128 for(
auto ptcut : ptcuts) {
130 Form(
"hEtaLabDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
131 Form(
"Eta (lab) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
137 Form(
"hEtaLabDistCutPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
138 Form(
"Eta (lab) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
144 Form(
"hEtaCentDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
145 Form(
"Eta (cent) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s",
152 Form(
"hEtaCentDistCutPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
153 Form(
"Eta (cent) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
159 Form(
"hEtaLabDistAllEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
160 Form(
"Eta (lab) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
166 Form(
"hEtaLabDistCutEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
167 Form(
"Eta (lab) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
173 Form(
"hEtaCentDistAllEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
174 Form(
"Eta (cent) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
180 Form(
"hEtaCentDistCutEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
181 Form(
"Eta (cent) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
187 Form(
"hPhiDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
188 Form(
"#phi distribution of particles with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
206 Bool_t hasPIDresponse = fInputHandler->GetPIDResponse() !=
nullptr;
207 if(
fStudyPID && !hasPIDresponse) AliErrorStream() <<
"PID requested but PID response not available" << std::endl;
219 AliVTrack *checktrack(
nullptr);
220 int ptmin[5] = {1,2,5,10,20};
221 Bool_t isEMCAL(kFALSE), hasTRD(kFALSE);
222 Double_t etaEMCAL(0.), phiEMCAL(0.);
223 for(
int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); ++itrk){
224 checktrack =
dynamic_cast<AliVTrack *
>(fInputEvent->GetTrack(itrk));
225 if(!checktrack)
continue;
228 if(TMath::Abs(checktrack->Pt()) < 0.1)
continue;
229 if(checktrack->IsA() == AliESDtrack::Class()){
230 AliESDtrack copytrack(*(static_cast<AliESDtrack *>(checktrack)));
231 AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(©track);
232 etaEMCAL = copytrack.GetTrackEtaOnEMCal();
233 phiEMCAL = copytrack.GetTrackPhiOnEMCal();
235 AliAODTrack copytrack(*(static_cast<AliAODTrack *>(checktrack)));
236 AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(©track);
237 etaEMCAL = copytrack.GetTrackEtaOnEMCal();
238 phiEMCAL = copytrack.GetTrackPhiOnEMCal();
240 Int_t supermoduleID = -1;
241 isEMCAL =
fGeom->SuperModuleNumberFromEtaPhi(etaEMCAL, phiEMCAL, supermoduleID);
243 isEMCAL = isEMCAL && supermoduleID < 10;
244 hasTRD = isEMCAL && supermoduleID >= 4;
257 FillTrackHistos(t, checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
305 AliDebugStream(1) << GetName() <<
": Using weight " << weight <<
" for trigger " << eventclass <<
" in particle histograms." << std::endl;
306 fHistos->
FillTH1(Form(
"hPtEtaAll%s", eventclass.Data()), TMath::Abs(pt), weight);
307 double kinepoint[3] = {TMath::Abs(pt), etalab, phi};
310 fHistos->
FillTH1(Form(
"hPtEMCALEtaAll%s", eventclass.Data()), TMath::Abs(pt), weight);
313 fHistos->
FillTH1(Form(
"hPtEMCALWithTRDEtaAll%s", eventclass.Data()), TMath::Abs(pt), weight);
315 fHistos->
FillTH1(Form(
"hPtEMCALNoTRDEtaAll%s", eventclass.Data()), TMath::Abs(pt), weight);
319 std::array<int, 5>
ptmin = {1,2,5,10,20};
320 for(
auto ptmincut : ptmin){
321 if(TMath::Abs(pt) >
static_cast<double>(ptmincut)){
322 fHistos->
FillTH1(Form(
"hPhiDistAllPt%d%s", ptmincut, eventclass.Data()), phi, weight);
323 fHistos->
FillTH1(Form(
"hEtaLabDistAllPt%d%s", ptmincut, eventclass.Data()), etalab, weight);
324 fHistos->
FillTH1(Form(
"hEtaCentDistAllPt%d%s", ptmincut, eventclass.Data()), etacent, weight);
326 fHistos->
FillTH1(Form(
"hEtaLabDistAllEMCALPt%d%s", ptmincut, eventclass.Data()), etalab, weight);
327 fHistos->
FillTH1(Form(
"hEtaCentDistAllEMCALPt%d%s", ptmincut, eventclass.Data()), etacent, weight);
333 fHistos->
FillTH1(Form(
"hPtEtaCent%s", eventclass.Data()), TMath::Abs(pt), weight);
335 fHistos->
FillTH1(Form(
"hPtEMCALEtaCent%s", eventclass.Data()), TMath::Abs(pt), weight);
337 fHistos->
FillTH1(Form(
"hPtEMCALWithTRDEtaCent%s", eventclass.Data()), TMath::Abs(pt), weight);
339 fHistos->
FillTH1(Form(
"hPtEMCALNoTRDEtaCent%s", eventclass.Data()), TMath::Abs(pt), weight);
342 for(
auto ptmincut : ptmin){
343 if(TMath::Abs(pt) >
static_cast<double>(ptmincut)){
344 fHistos->
FillTH1(Form(
"hEtaLabDistCutPt%d%s", ptmincut, eventclass.Data()), etalab, weight);
345 fHistos->
FillTH1(Form(
"hEtaCentDistCutPt%d%s", ptmincut, eventclass.Data()), etacent, weight);
347 fHistos->
FillTH1(Form(
"hEtaLabDistCutEMCALPt%d%s", ptmincut, eventclass.Data()), etalab, weight);
348 fHistos->
FillTH1(Form(
"hEtaCentDistCutEMCALPt%d%s", ptmincut, eventclass.Data()), etacent, weight);
360 AliDebugStream(1) << GetName() <<
": Using weight " << weight <<
" for trigger " << eventclass <<
" in PID histograms." << std::endl;
361 AliPIDResponse *pid = fInputHandler->GetPIDResponse();
362 if(TMath::Abs(trk.Eta()) > 0.5)
return;
363 if(!((trk.GetStatus() & AliVTrack::kTOFout) && (trk.GetStatus() & AliVTrack::kTIME)))
return;
365 double poverz = TMath::Abs(trk.P())/static_cast<double>(trk.Charge());
366 fHistos->
FillTH2(Form(
"hTPCdEdxEMCAL%s", eventclass.Data()), poverz, trk.GetTPCsignal(), weight);
368 Double_t trtime = (trk.GetTOFsignal() - pid->GetTOFResponse().GetTimeZero()) * 1e-12;
369 Double_t v = trk.GetIntegratedLength()/(100. * trtime);
371 fHistos->
FillTH2(Form(
"hTOFBetaEMCAL%s", eventclass.Data()), poverz, beta, weight);
372 double datapoint[3] = {poverz, trk.GetTPCsignal(), beta};
std::vector< TString > fSelectedTriggers
! Triggers selected for given event
std::vector< TString > GetSupportedTriggers()
Double_t fEtaSign
Sign of the eta distribution (swaps when beam directions swap): p-Pb: +1, Pb-p: -1.
AliEmcalTrackSelection * fTrackCuts
Standard track selection.
Class creating a linear binning, used in the histogram manager.
THistManager * fHistos
Task Histogram container.
static AliEmcalTrackSelection * TrackCutsFactory(TString name, Bool_t isAOD)
virtual ~AliAnalysisTaskChargedParticlesRef()
Unit test class for charged particle distributions.
Double_t GetTriggerWeight(const TString &triggerclass) const
Bool_t fKineCorrelation
Use kinematics correlation histograms.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
void FillTH3(const char *hname, double x, double y, double z, double weight=1., Option_t *opt="")
Bool_t fStudyPID
Use kinematics correlation histograms.
NewPtBinning()
Constructor Create new Pt binning.
void AddStep(Double_t max, Double_t binwidth)
virtual void UserFillHistosBeforeEventSelection()
void SetCaloTriggerPatchInfoName(const char *n)
AliCutValueRange< double > fEtaCmsCut
Cut applied in frame.
Base class for analyses using EMCAL triggers.
Double_t fYshift
Rapidity shift.
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
AliEMCALGeometry * fGeom
!emcal geometry
virtual void CreateUserHistos()
AliAnalysisTaskChargedParticlesRef()
void SetEMCALTrackSelection(AliEmcalTrackSelection *sel)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Helper class creating user defined custom binning.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
virtual void CreateUserObjects()
AliCutValueRange< double > fPhiCut
Cut applied in .
AliCutValueRange< double > fEtaLabCut
Cut applied in frame.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fVertex[3]
!event vertex
void FillPIDHistos(const TString &eventclass, const AliVTrack &track)
void SetNeedEmcalGeom(Bool_t n)
void InitializeTrackCuts(TString cutname, bool isAOD)
virtual void UserFillHistosAfterEventSelection()
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
TH3 * CreateTH3(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax, Option_t *opt="")
virtual bool IsTrackAccepted(AliVTrack *const trk)=0
void FillTrackHistos(const TString &eventclass, Double_t pt, Double_t eta, Double_t etacent, Double_t phi, Bool_t etacut, Bool_t inEmcal, Bool_t hasTRD)
bool IsInRange(t value) const
void SetMinimum(Double_t min)