23 #include <THashList.h>
26 #include <TObjArray.h>
27 #include <TParameter.h>
29 #include "AliAnalysisUtils.h"
30 #include "AliAODInputHandler.h"
31 #include "AliAODTrack.h"
33 #include "AliEMCALGeometry.h"
34 #include "AliEMCALRecoUtils.h"
35 #include "AliEMCALTriggerPatchInfo.h"
38 #include "AliESDtrackCuts.h"
39 #include "AliESDEvent.h"
40 #include "AliInputEventHandler.h"
41 #include "AliOADBContainer.h"
42 #include "AliPIDResponse.h"
43 #include "AliTOFPIDResponse.h"
44 #include "AliVVertex.h"
53 namespace EMCalTriggerPtAnalysis {
58 AliAnalysisTaskChargedParticlesRef::AliAnalysisTaskChargedParticlesRef() :
66 fTriggerStringFromPatches(kFALSE),
69 fKineCorrelation(false),
71 fNameDownscaleOADB(
""),
96 fTriggerStringFromPatches(kFALSE),
99 fKineCorrelation(false),
101 fNameDownscaleOADB(
""),
112 DefineOutput(1, TList::Class());
139 std::array<TString, 11> triggers = {
141 "EJ1",
"EJ2",
"EG1",
"EG2",
142 "EMC7excl",
"EG1excl",
"EG2excl",
"EJ1excl",
"EJ2excl"
144 std::array<Double_t, 5> ptcuts = {1., 2., 5., 10., 20.};
146 const int kdimPID = 3;
147 const int knbinsPID[kdimPID] = {1000, 200, 300};
148 const double kminPID[kdimPID] = {-100., 0., 0.}, kmaxPID[kdimPID] = {100., 200., 1.5};
149 for(
auto trg : triggers){
150 fHistos->
CreateTH1(Form(
"hEventCount%s", trg.Data()), Form(
"Event Counter for trigger class %s", trg.Data()), 1, 0.5, 1.5);
151 fHistos->
CreateTH1(Form(
"hVertexBefore%s", trg.Data()), Form(
"Vertex distribution before z-cut for trigger class %s", trg.Data()), 500, -50, 50);
152 fHistos->
CreateTH1(Form(
"hVertexAfter%s", trg.Data()), Form(
"Vertex distribution after z-cut for trigger class %s", trg.Data()), 100, -10, 10);
153 fHistos->
CreateTH1(Form(
"hPtEtaAll%s", trg.Data()), Form(
"Charged particle pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
154 fHistos->
CreateTH1(Form(
"hPtEtaCent%s", trg.Data()), Form(
"Charged particle pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
155 fHistos->
CreateTH1(Form(
"hPtEMCALEtaAll%s", trg.Data()), Form(
"Charged particle in EMCAL pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
156 fHistos->
CreateTH1(Form(
"hPtEMCALEtaCent%s", trg.Data()), Form(
"Charged particle in EMCAL pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
157 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);
158 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);
159 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);
160 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);
162 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()));
163 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()));
166 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.);
167 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);
168 fHistos->
CreateTHnSparse(Form(
"hPIDcorrEMCAL%s", trg.Data()), Form(
"Correlation of PID observables for Trigger %s", trg.Data()), kdimPID, knbinsPID, kminPID, kmaxPID);
170 for(
auto ptcut : ptcuts) {
172 Form(
"hEtaLabDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
173 Form(
"Eta (lab) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
179 Form(
"hEtaLabDistCutPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
180 Form(
"Eta (lab) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
186 Form(
"hEtaCentDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
187 Form(
"Eta (cent) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s",
194 Form(
"hEtaCentDistCutPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
195 Form(
"Eta (cent) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
201 Form(
"hEtaLabDistAllEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
202 Form(
"Eta (lab) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
208 Form(
"hEtaLabDistCutEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
209 Form(
"Eta (lab) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
215 Form(
"hEtaCentDistAllEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
216 Form(
"Eta (cent) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
222 Form(
"hEtaCentDistCutEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
223 Form(
"Eta (cent) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
229 Form(
"hPhiDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
230 Form(
"#phi distribution of particles with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
251 AliInfoStream() << GetName() <<
": Initializing ..." << std::endl;
256 AliInfoStream() << GetName() <<
": Changing run from " <<
fCurrentRun <<
" to " << InputEvent()->GetRunNumber() << std::endl;
260 Bool_t hasPIDresponse = fInputHandler->GetPIDResponse() !=
nullptr;
261 if(
fStudyPID && !hasPIDresponse) AliErrorStream() <<
"PID requested but PID response not available" << std::endl;
267 triggerstring = fInputEvent->GetFiredTriggerClasses();
269 UInt_t selectionstatus = fInputHandler->IsEventSelected();
270 Bool_t isMinBias = selectionstatus & AliVEvent::kINT7,
271 isEJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains(
"EJ1"),
272 isEJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains(
"EJ2"),
273 isEG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains(
"EG1"),
274 isEG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains(
"EG2"),
275 isEMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains(
"CEMC7");
283 if(!(isMinBias || isEMC7 || isEG1 || isEG2 || isEJ1 || isEJ2))
return;
284 const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
286 if(vtx->GetNContributors() < 1)
return;
287 if(fInputEvent->IsA() == AliESDEvent::Class() &&
fAnalysisUtil->IsFirstEventInChunk(fInputEvent))
return;
288 bool isSelected = kTRUE;
289 if(!
fAnalysisUtil->IsVertexSelected2013pA(fInputEvent)) isSelected = kFALSE;
290 if(
fAnalysisUtil->IsPileUpEvent(fInputEvent)) isSelected = kFALSE;
292 if(vtx->GetZ() < -10. || vtx->GetZ() > 10.) isSelected = kFALSE;
307 if(!(isMinBias || isEMC7)){
314 if(!(isMinBias || isEMC7 || isEJ2)){
321 if(!(isMinBias || isEMC7)){
328 if(!(isMinBias || isEMC7 || isEG2)){
333 if(!isSelected)
return;
344 AliVTrack *checktrack(
nullptr);
345 int ptmin[5] = {1,2,5,10,20};
346 Bool_t isEMCAL(kFALSE), hasTRD(kFALSE);
347 Double_t etaEMCAL(0.), phiEMCAL(0.);
348 for(
int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); ++itrk){
349 checktrack =
dynamic_cast<AliVTrack *
>(fInputEvent->GetTrack(itrk));
350 if(!checktrack)
continue;
352 if(TMath::Abs(checktrack->Pt()) < 0.1)
continue;
353 if(checktrack->IsA() == AliESDtrack::Class()){
354 AliESDtrack copytrack(*(static_cast<AliESDtrack *>(checktrack)));
355 AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(©track);
356 etaEMCAL = copytrack.GetTrackEtaOnEMCal();
357 phiEMCAL = copytrack.GetTrackPhiOnEMCal();
359 AliAODTrack copytrack(*(static_cast<AliAODTrack *>(checktrack)));
360 AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(©track);
361 etaEMCAL = copytrack.GetTrackEtaOnEMCal();
362 phiEMCAL = copytrack.GetTrackPhiOnEMCal();
364 Int_t supermoduleID = -1;
365 isEMCAL =
fGeometry->SuperModuleNumberFromEtaPhi(etaEMCAL, phiEMCAL, supermoduleID);
367 isEMCAL = isEMCAL && supermoduleID < 10;
368 hasTRD = isEMCAL && supermoduleID >= 4;
382 FillTrackHistos(
"MB", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
387 FillTrackHistos(
"EMC7", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
391 FillTrackHistos(
"EMC7excl", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
397 FillTrackHistos(
"EJ2", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
401 if(!(isMinBias || isEMC7)){
402 FillTrackHistos(
"EJ2excl", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
408 FillTrackHistos(
"EJ1", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
412 if(!(isMinBias ||isEMC7 || isEJ2)){
413 FillTrackHistos(
"EJ1excl", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
419 FillTrackHistos(
"EG2", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
423 if(!(isMinBias || isEMC7)){
424 FillTrackHistos(
"EG2excl", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
430 FillTrackHistos(
"EG1", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
433 if(!(isMinBias || isEMC7 || isEG2)){
434 FillTrackHistos(
"EG1excl", checktrack->Pt(), checktrack->Eta() *
fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
450 const std::string &triggerclass,
456 AliDebugStream(1) << GetName() <<
": Using weight " << weight <<
" for trigger " << triggerclass <<
" in event histograms." << std::endl;
458 fHistos->
FillTH1(Form(
"hVertexBefore%s", triggerclass.c_str()), vtxz, weight);
461 fHistos->
FillTH1(Form(
"hEventCount%s", triggerclass.c_str()), 1, weight);
462 fHistos->
FillTH1(Form(
"hVertexAfter%s", triggerclass.c_str()), vtxz, weight);
475 fGeometry = AliEMCALGeometry::GetInstance();
479 fTriggerPatches =
static_cast<TClonesArray *
>(fInputEvent->FindListObject(
"EmcalTriggers"));
483 fDownscaleOADB =
new AliOADBContainer(
"AliEmcalDownscaleFactors");
512 const std::string &eventclass,
523 AliDebugStream(1) << GetName() <<
": Using weight " << weight <<
" for trigger " << eventclass <<
" in particle histograms." << std::endl;
524 fHistos->
FillTH1(Form(
"hPtEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
525 double kinepoint[3] = {TMath::Abs(pt), etalab, phi};
528 fHistos->
FillTH1(Form(
"hPtEMCALEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
531 fHistos->
FillTH1(Form(
"hPtEMCALWithTRDEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
533 fHistos->
FillTH1(Form(
"hPtEMCALNoTRDEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
537 std::array<int, 5>
ptmin = {1,2,5,10,20};
538 for(
auto ptmincut : ptmin){
539 if(TMath::Abs(pt) >
static_cast<double>(ptmincut)){
540 fHistos->
FillTH1(Form(
"hPhiDistAllPt%d%s", ptmincut, eventclass.c_str()), phi, weight);
541 fHistos->
FillTH1(Form(
"hEtaLabDistAllPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
542 fHistos->
FillTH1(Form(
"hEtaCentDistAllPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
544 fHistos->
FillTH1(Form(
"hEtaLabDistAllEMCALPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
545 fHistos->
FillTH1(Form(
"hEtaCentDistAllEMCALPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
551 fHistos->
FillTH1(Form(
"hPtEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
553 fHistos->
FillTH1(Form(
"hPtEMCALEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
555 fHistos->
FillTH1(Form(
"hPtEMCALWithTRDEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
557 fHistos->
FillTH1(Form(
"hPtEMCALNoTRDEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
560 for(
auto ptmincut : ptmin){
561 if(TMath::Abs(pt) >
static_cast<double>(ptmincut)){
562 fHistos->
FillTH1(Form(
"hEtaLabDistCutPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
563 fHistos->
FillTH1(Form(
"hEtaCentDistCutPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
565 fHistos->
FillTH1(Form(
"hEtaLabDistCutEMCALPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
566 fHistos->
FillTH1(Form(
"hEtaCentDistCutEMCALPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
574 const std::string &eventclass,
578 AliDebugStream(1) << GetName() <<
": Using weight " << weight <<
" for trigger " << eventclass <<
" in PID histograms." << std::endl;
579 AliPIDResponse *pid = fInputHandler->GetPIDResponse();
580 if(TMath::Abs(trk.Eta()) > 0.5)
return;
581 if(!((trk.GetStatus() & AliVTrack::kTOFout) && (trk.GetStatus() & AliVTrack::kTIME)))
return;
583 double poverz = TMath::Abs(trk.P())/static_cast<double>(trk.Charge());
584 fHistos->
FillTH2(Form(
"hTPCdEdxEMCAL%s", eventclass.c_str()), poverz, trk.GetTPCsignal(), weight);
586 Double_t trtime = (trk.GetTOFsignal() - pid->GetTOFResponse().GetTimeZero()) * 1e-12;
587 Double_t v = trk.GetIntegratedLength()/(100. * trtime);
589 fHistos->
FillTH2(Form(
"hTOFBetaEMCAL%s", eventclass.c_str()), poverz, beta, weight);
590 double datapoint[3] = {poverz, trk.GetTPCsignal(), beta};
610 if(result)
return 1./result->GetVal();
631 Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0;
632 double minADC_EJ1 = 260.,
636 for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
637 AliEMCALTriggerPatchInfo *patch =
dynamic_cast<AliEMCALTriggerPatchInfo *
>(*patchIter);
638 if(!patch->IsOfflineSimple())
continue;
639 if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_EJ1) nEJ1++;
640 if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_EJ2) nEJ2++;
641 if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_EG1) nEG1++;
642 if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_EG2) nEG2++;
644 if(nEJ1) triggerstring +=
"EJ1";
646 if(triggerstring.Length()) triggerstring +=
",";
647 triggerstring +=
"EJ2";
650 if(triggerstring.Length()) triggerstring +=
",";
651 triggerstring +=
"EG1";
654 if(triggerstring.Length()) triggerstring +=
",";
655 triggerstring +=
"EG2";
657 return triggerstring;
Double_t fEtaSign
Sign of the eta distribution (swaps when beam directions swap): p-Pb: +1, Pb-p: -1.
AliEmcalTriggerOfflineSelection * fTriggerSelection
Offline trigger selection.
AliEmcalTrackSelection * fTrackCuts
Standard track selection.
Class creating a linear binning, used in the histogram manager.
void UserCreateOutputObjects()
static AliEmcalTrackSelection * TrackCutsFactory(TString name, Bool_t isAOD)
virtual ~AliAnalysisTaskChargedParticlesRef()
Double_t GetTriggerWeight(const std::string &triggerclass) const
Unit test class for charged particle distributions.
Bool_t fKineCorrelation
Use kinematics correlation histograms.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
TObjArray * fDownscaleFactors
! Downscalfactors for given run
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)
AliOADBContainer * fDownscaleOADB
! Container with downscale factors for different triggers
TString GetFiredTriggerClassesFromPatches(const TClonesArray *triggerpatches) const
AliEMCALGeometry * fGeometry
EMCAL geometry methods.
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="")
THashList * GetListOfHistograms() const
Bool_t fTriggerStringFromPatches
Do rebuild the trigger string from trigger patches.
TString fNameDownscaleOADB
Name of the downscale OADB container.
AliAnalysisTaskChargedParticlesRef()
void FillPIDHistos(const std::string &eventclass, const AliVTrack &track)
void SetEMCALTrackSelection(AliEmcalTrackSelection *sel)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
TClonesArray * fTriggerPatches
! Container with trigger patches
virtual void RunChanged(Int_t runnuber)
Helper class creating user defined custom binning.
void FillEventCounterHists(const std::string &triggerclass, double vtxz, bool isSelected)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Bool_t IsOfflineSelected(EmcalTriggerClass trgcls, const TClonesArray *const triggerpatches) const
AliAnalysisUtils * fAnalysisUtil
Event selection.
void UserExec(Option_t *)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fEtaCmsCut[2]
Cut applied in Eta centre-of-mass frame.
Container class for histograms for the high- charged particle analysis.
THistManager * fHistos
! Histogram manager
void InitializeTrackCuts(TString cutname, bool isAOD)
Int_t GetRunNumber(TString)
void FillTrackHistos(const std::string &eventclass, Double_t pt, Double_t eta, Double_t etacent, Double_t phi, Bool_t etacut, Bool_t inEmcal, Bool_t hasTRD)
Bool_t fInitialized
Check for initialized.
Int_t fCurrentRun
Current run number (for RunChange method)
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Double_t fEtaLabCut[2]
Cut applied in Eta Lab frame.
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 SetMinimum(Double_t min)