18 #include <TClonesArray.h>
22 #include <THnSparse.h>
25 #include <Riostream.h>
27 #include <AliVEventHandler.h>
28 #include <AliAnalysisManager.h>
32 #include "AliCentrality.h"
33 #include "AliVCluster.h"
34 #include "AliVParticle.h"
35 #include "AliVTrack.h"
37 #include "AliEMCALGeometry.h"
38 #include "AliEMCALGeoParams.h"
39 #include "AliESDtrack.h"
40 #include "AliAODTrack.h"
41 #include "AliAODMCParticle.h"
59 fSeparateEMCalDCal(kTRUE),
63 fGeneratorLevelName(),
74 fNPtRelDiffHistBins(0),
75 fPtRelDiffHistBins(0),
78 f1OverPtResHistBins(0),
79 fN1OverPtResHistBins(0),
83 fParticlesPhysPrim(0),
85 fHistManager(
"AliAnalysisTaskPWGJEQA"),
103 fCellEnergyCut(0.05),
106 fSeparateEMCalDCal(kTRUE),
110 fGeneratorLevelName(),
112 fDetectorLevelName(),
121 fNPtRelDiffHistBins(0),
122 fPtRelDiffHistBins(0),
125 f1OverPtResHistBins(0),
126 fN1OverPtResHistBins(0),
127 fNIntegerHistBins(0),
130 fParticlesPhysPrim(0),
131 fParticlesMatched(0),
169 while ((obj = next())) {
170 if (!strcmp(obj->GetName(),
"fHistCellsAbsIdEnergy") || !strcmp(obj->GetName(),
"fHistCellsAbsIdTime")) {
199 histname =
"fHistCellsAbsIdEnergy";
200 title = histname +
";cell abs. Id;#it{E}_{cell} (GeV);counts";
203 histname =
"fHistCellsAbsIdTime";
204 title = histname +
";cell abs. Id;#it{t}_{cell} (s);counts";
209 histname = TString::Format(
"%s/fHistCellEnergy",
fCaloCellsName.Data());
210 title = histname +
";#it{E}_{cell} (GeV);counts";
219 histname = TString::Format(
"%s/fHistCellTime",
fCaloCellsName.Data());
220 title = histname +
";#it{t}_{cell} (s);counts";
235 AliEmcalContainer* cont = 0;
241 while ((cont = static_cast<AliEmcalContainer*>(nextClusColl()))) {
243 histname = TString::Format(
"%s/fHistClusterRejectionReason", cont->GetArrayName().Data());
244 title = histname +
";Rejection reason;#it{E}_{clus} (GeV/);counts";
248 const Int_t nSM = 20;
249 for (
Int_t sm = 0; sm < nSM; sm++) {
250 histname = TString::Format(
"%s/BySM/fHistClusEnergy_SM%d", cont->GetArrayName().Data(), sm);
251 title = histname +
";#it{E}_{cluster} (GeV);counts";
263 title[dim] =
"Centrality %";
270 title[dim] =
"#it{E}_{clus} (GeV)";
285 max[dim] = 2*TMath::Pi();
288 title[dim] =
"cluster type";
294 TString thnname = TString::Format(
"%s/clusterObservables", cont->GetArrayName().Data());
296 for (
Int_t i = 0; i < dim; i++) {
297 hn->GetAxis(i)->SetTitle(title[i]);
309 while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
321 axisTitle[dim] =
"Centrality (%)";
328 axisTitle[dim] =
"#eta_{jet}";
329 nbins[dim] = nPtBins/10;
334 axisTitle[dim] =
"#phi_{jet} (rad)";
335 nbins[dim] = nPtBins/10*3;
337 max[dim] = 2*TMath::Pi();
340 axisTitle[dim] =
"#it{p}_{T} (GeV/#it{c})";
341 nbins[dim] = nPtBins/2;
347 axisTitle[dim] =
"#it{p}_{T}^{corr} (GeV/#it{c})";
348 nbins[dim] = nPtBins/2;
355 axisTitle[dim] =
"NEF";
356 nbins[dim] = nPtBins/20;
363 axisTitle[dim] =
"No. of constituents";
370 axisTitle[dim] =
"No. of constituents";
377 axisTitle[dim] =
"#it{p}_{T,particle}^{leading} (GeV/#it{c})";
378 nbins[dim] = nPtBins/10*3;
383 TString thnname = TString::Format(
"%s/fHistJetObservables", jets->GetArrayName().Data());
385 for (
Int_t i = 0; i < dim; i++) {
386 hn->GetAxis(i)->SetTitle(axisTitle[i]);
392 histname = TString::Format(
"%s/fHistJetRejectionReason", jets->GetArrayName().Data());
393 title = histname +
";Rejection reason;#it{p}_{T,jet} (GeV/#it{c});counts";
398 histname = TString::Format(
"%s/fHistRhoVsCent", jets->GetArrayName().Data());
399 title = histname +
";Centrality (%);#rho (GeV/#it{c});counts";
417 axistitle[dim] =
"Centrality %";
425 axistitle[dim] =
"No. of tracks";
438 axistitle[dim] =
"#it{p}_{T,track}^{leading} (GeV/c)";
439 nbins[dim] = nPtBins/2;
446 axistitle[dim] =
"No. of clusters";
461 axistitle[dim] =
"#it{E}_{EMCal cluster}^{leading} (GeV)";
462 nbins[dim] = nPtBins/2;
467 axistitle[dim] =
"#it{E}_{DCal cluster}^{leading} (GeV)";
468 nbins[dim] = nPtBins/2;
473 axistitle[dim] =
"#it{E}_{PHOS cluster}^{leading} (GeV)";
474 nbins[dim] = nPtBins/2;
480 axistitle[dim] =
"#it{E}_{cluster}^{leading} (GeV)";
481 nbins[dim] = nPtBins/2;
489 for (
Int_t i = 0; i < dim; i++)
490 hn->GetAxis(i)->SetTitle(axistitle[i]);
560 title[dim] =
"Centrality %";
566 title[dim] =
"#it{p}_{T} (GeV/#it{c})";
581 title[dim] =
"track type";
586 title[dim] =
"#sigma(#it{p}_{T}) / #it{p}_{T}";
591 fTracks =
new THnSparseF(
"tracks",
"tracks",dim,nbins);
592 for (
Int_t i = 0; i < dim; i++) {
593 fTracks->GetAxis(i)->SetTitle(title[i]);
594 fTracks->SetBinEdges(i, binEdges[i]);
610 title[dim] =
"Centrality %";
616 title[dim] =
"#it{p}_{T} (GeV/#it{c})";
632 for (
Int_t i = 0; i < dim; i++) {
649 title[dim] =
"Centrality %";
655 title[dim] =
"#it{p}_{T}^{gen} (GeV/#it{c})";
660 title[dim] =
"#eta^{gen}";
665 title[dim] =
"#phi^{gen}";
670 title[dim] =
"#it{p}_{T}^{det} (GeV/#it{c})";
675 title[dim] =
"#eta^{det}";
680 title[dim] =
"#phi^{det}";
685 title[dim] =
"(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{gen}";
690 title[dim] =
"track type";
696 for (
Int_t i = 0; i < dim; i++) {
750 track = trackIterator.second;
757 AliESDtrack *esdTrack =
dynamic_cast<AliESDtrack*
>(track);
758 if (esdTrack) sigma = TMath::Sqrt(esdTrack->GetSigma1Pt2());
762 AliAODTrack *aodtrack =
dynamic_cast<AliAODTrack*
>(track);
763 if(!aodtrack) AliFatal(
"Not a standard AOD");
765 AliExternalTrackParam exParam;
769 aodtrack->GetCovMatrix(cov);
771 aodtrack->PxPyPz(pxpypz);
773 aodtrack->GetXYZ(xyz);
774 Short_t sign = aodtrack->Charge();
775 exParam.Set(xyz,pxpypz,cov,sign);
777 sigma = TMath::Sqrt(exParam.GetSigma1Pt2());
781 Int_t label = TMath::Abs(track->GetLabel());
784 if (label==0 || track->GetGeneratorIndex() == 0) mcGen = 0;
791 if (part->GetGeneratorIndex() == 0) {
792 Int_t pdg = TMath::Abs(part->PdgCode());
794 if (pdg == 211 || pdg == 2212 || pdg == 321 || pdg == 11 || pdg == 13) {
802 AliError(Form(
"Track %d has type %d not recognized!",
fDetectorLevel->GetCurrentID(), type));
808 AliAODMCParticle* part;
810 part = partIterator.second;
815 if (part->GetGeneratorIndex() == 0) mcGen = 0;
817 Int_t pdg = TMath::Abs(part->PdgCode());
819 if (pdg == 211 || pdg == 2212 || pdg == 321 || pdg == 11 || pdg == 13) findable = 1;
831 TString histname_en2D =
"fHistCellsAbsIdEnergy";
832 TString histname_tm2D =
"fHistCellsAbsIdTime";
837 for (
Int_t pos = 0; pos < ncells; pos++) {
861 while ((clusters = static_cast<AliClusterContainer*>(nextClusColl()))) {
866 UInt_t rejectionReason = 0;
867 if (!clusters->
AcceptCluster(it.current_index(), rejectionReason)) {
868 histname = TString::Format(
"%s/fHistClusterRejectionReason", clusters->GetArrayName().Data());
869 fHistManager.
FillTH2(histname, clusters->GetRejectionReasonBitPosition(rejectionReason), it->first.E());
875 if (it->second->IsEMCAL()) {
876 Double_t phi = it->first.Phi_0_2pi();
880 }
else if (isDcal == 1) {
887 Int_t sm =
fGeom->GetSuperModuleNumber(it->second->GetCellAbsId(0));
888 if (sm >=0 && sm < 20) {
889 histname = TString::Format(
"%s/BySM/fHistClusEnergy_SM%d", clusters->GetArrayName().Data(), sm);
893 AliError(Form(
"Supermodule %d does not exist!", sm));
896 }
else if (it->second->IsPHOS()){
903 histname = TString::Format(
"%s/clusterObservables", clusters->GetArrayName().Data());
905 if (!histClusterObservables)
return;
906 for (
Int_t i = 0; i < histClusterObservables->GetNdimensions(); i++) {
907 TString title(histClusterObservables->GetAxis(i)->GetTitle());
908 if (
title==
"Centrality %")
910 else if (
title==
"#it{E}_{clus} (GeV)")
911 contents[i] = it->first.E();
912 else if (
title==
"#eta")
913 contents[i] = it->first.Eta();
914 else if (
title==
"#phi")
915 contents[i] = it->first.Phi_0_2pi();
916 else if (
title==
"cluster type")
917 contents[i] = clusType;
919 AliWarning(Form(
"Unable to fill dimension %s!",
title.Data()));
921 histClusterObservables->Fill(contents);
933 while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
937 histname = TString::Format(
"%s/fHistRhoVsCent", jets->GetArrayName().Data());
941 for (
auto jet : jets->
all()) {
943 UInt_t rejectionReason = 0;
944 if (!jets->
AcceptJet(jet, rejectionReason)) {
945 histname = TString::Format(
"%s/fHistJetRejectionReason", jets->GetArrayName().Data());
946 fHistManager.
FillTH2(histname.Data(), jets->GetRejectionReasonBitPosition(rejectionReason), jet->Pt());
951 Float_t corrPt = jet->Pt() - rhoVal * jet->Area();
953 TLorentzVector leadPart;
957 histname = TString::Format(
"%s/fHistJetObservables", jets->GetArrayName().Data());
959 if (!histJetObservables)
return;
960 for (
Int_t i = 0; i < histJetObservables->GetNdimensions(); i++) {
961 TString title(histJetObservables->GetAxis(i)->GetTitle());
962 if (
title==
"Centrality (%)")
964 else if (
title==
"#eta_{jet}")
965 contents[i] = jet->Eta();
966 else if (
title==
"#phi_{jet} (rad)")
967 contents[i] = jet->Phi_0_2pi();
968 else if (
title==
"#it{p}_{T} (GeV/#it{c})")
969 contents[i] = jet->Pt();
970 else if (
title==
"#it{p}_{T}^{MC} (GeV/#it{c})")
971 contents[i] = jet->MCPt();
972 else if (
title==
"#it{p}_{T}^{corr} (GeV/#it{c})")
973 contents[i] = corrPt;
974 else if (
title==
"NEF")
975 contents[i] = jet->NEF();
976 else if (
title==
"No. of constituents")
977 contents[i] = jet->GetNumberOfConstituents();
978 else if (
title==
"#it{p}_{T,particle}^{leading} (GeV/#it{c})")
979 contents[i] = ptLeading;
981 AliWarning(Form(
"Unable to fill dimension %s!",
title.Data()));
983 histJetObservables->Fill(contents);
993 for (
Int_t i = 0; i < 3; i++) {
1005 for (
Int_t i = 0; i < 3; i++) {
1011 for (
Int_t i = 0; i < histEventQA->GetNdimensions(); i++) {
1013 if (
title==
"Centrality %")
1014 contents[i] = eventQA.
fCent;
1015 else if (
title==
"No. of tracks")
1017 else if (
title==
"No. of clusters")
1018 contents[i] = globalNclusters;
1019 else if (
title==
"#it{p}_{T,track}^{leading} (GeV/c)")
1021 else if (
title==
"#it{E}_{cluster}^{leading} (GeV)")
1022 contents[i] = globalMaxCluster.E();
1023 else if (
title==
"#it{E}_{EMCal cluster}^{leading} (GeV)")
1025 else if (
title==
"#it{E}_{DCal cluster}^{leading} (GeV)")
1027 else if (
title==
"#it{E}_{PHOS cluster}^{leading} (GeV)")
1030 AliWarning(Form(
"Unable to fill dimension %s!",
title.Data()));
1033 histEventQA->Fill(contents);
1038 Double_t sigma1OverPt, Byte_t trackType)
1042 for (
Int_t i = 0; i <
fTracks->GetNdimensions(); i++) {
1044 if (
title==
"Centrality %")
1046 else if (
title==
"#it{p}_{T} (GeV/#it{c})")
1047 contents[i] = trackPt;
1048 else if (
title==
"#eta")
1049 contents[i] = trackEta;
1050 else if (
title==
"#phi")
1051 contents[i] = trackPhi;
1052 else if (
title==
"#sigma(1/#it{p}_{T}) (GeV/#it{c})^{-1}")
1053 contents[i] = sigma1OverPt;
1054 else if (
title==
"#sigma(#it{p}_{T}) / #it{p}_{T}")
1055 contents[i] = sigma1OverPt*trackPt;
1056 else if (
title==
"track type")
1057 contents[i] = trackType;
1059 AliWarning(Form(
"Unable to fill dimension %s of histogram %s!",
title.Data(),
fTracks->GetName()));
1072 if (
title==
"Centrality %")
1074 else if (
title==
"#it{p}_{T} (GeV/#it{c})")
1075 contents[i] = partPt;
1076 else if (
title==
"#eta")
1077 contents[i] = partEta;
1078 else if (
title==
"#phi")
1079 contents[i] = partPhi;
1081 AliWarning(Form(
"Unable to fill dimension %s of histogram %s!",
title.Data(),
fParticlesPhysPrim->GetName()));
1095 if (
title==
"Centrality %")
1097 else if (
title==
"#it{p}_{T}^{gen} (GeV/#it{c})")
1098 contents[i] = partPt;
1099 else if (
title==
"#eta^{gen}")
1100 contents[i] = partEta;
1101 else if (
title==
"#phi^{gen}")
1102 contents[i] = partPhi;
1103 else if (
title==
"#it{p}_{T}^{det} (GeV/#it{c})")
1104 contents[i] = trackPt;
1105 else if (
title==
"#eta^{det}")
1106 contents[i] = trackEta;
1107 else if (
title==
"#phi^{det}")
1108 contents[i] = trackPhi;
1109 else if (
title==
"(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{gen}")
1110 contents[i] = (partPt - trackPt) / partPt;
1111 else if (
title==
"(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{det}")
1112 contents[i] = (partPt - trackPt) / trackPt;
1113 else if (
title==
"track type")
1116 AliWarning(Form(
"Unable to fill dimension %s of histogram %s!",
title.Data(),
fParticlesMatched->GetName()));
void FillCellHistograms()
void AllocateMatchedParticlesTHnSparse()
Bool_t fDoEmcalQA
Set whether to enable cell/cluster QA.
Double_t * fEtaHistBins
number of eta bins
Double_t * fPtResHistBins
number of pt res bins
TObjArray fClusterCollArray
cluster collection array
Bool_t fDoEventQA
Set whether to enable event QA.
Double_t GetRhoVal() const
const TString & GetRhoName() const
Int_t fNEtaHistBins
pt bins
Int_t fN1OverPtResHistBins
1/pt res bins
Float_t fPtBinWidth
Histogram pt bin width.
Int_t fNPtResHistBins
pt relative difference bins
AliTrackContainer * fDetectorLevel
generator level container
Int_t fNPhiHistBins
eta bins
void AllocateEventQAHistograms()
Bool_t RetrieveEventObjects()
const AliMCParticleIterableMomentumContainer accepted_momentum() const
bidirectional stl iterator over the EMCAL iterable container
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
void AllocateJetHistograms()
AliAnalysisTaskPWGJEQA()
Default constructor for ROOT I/O purposes.
THnSparse * fTracks
integer bins
THistManager fHistManager
primary particles matched to detector level tracks
virtual Bool_t AcceptJet(Int_t i, UInt_t &rejectionReason) const
Int_t fNTotClusters[3]
!Total number of accepted clusters in current event (DCal/EMCal)
Bool_t RetrieveEventObjects()
AliTLorentzVector fMaxCluster[3]
TString fDetectorLevelName
detector level container name
AliTLorentzVector fMaxTrack
Bool_t fDoTrackQA
Set whether to enable track QA.
void FillTrackHistograms()
THnSparse * fParticlesPhysPrim
all tracks
TObjArray fParticleCollArray
particle/track collection array
void FillClusterHistograms()
Double_t * fPtHistBins
number of pt bins
void GetLeadingHadronMomentum(TLorentzVector &mom, const AliEmcalJet *jet) const
void AllocateDetectorLevelTHnSparse()
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
TObject * FindObject(const char *name) const
void FillEventQAHistograms()
THashList * GetListOfHistograms() const
Double_t GetLeadingHadronPt(const AliEmcalJet *jet) const
AliEMCALGeometry * fGeom
!emcal geometry
void FillDetectorLevelTHnSparse(Double_t cent, Double_t trackEta, Double_t trackPhi, Double_t trackPt, Double_t sigma1OverPt, Byte_t trackType)
Bool_t fSeparateEMCalDCal
Separate EMCal from DCal in QA plots.
virtual AliAODMCParticle * GetAcceptMCParticleWithLabel(Int_t lab)
Int_t fNTotTracks
!Total number of accepted tracks in current event
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Float_t fCellEnergyCut
Energy cell cut.
BeamType fForceBeamType
forced beam type
virtual Bool_t AcceptCluster(Int_t i, UInt_t &rejectionReason) const
Double_t * fPtRelDiffHistBins
number of pt relative difference bins
void AllocateClusterHistograms()
Declaration of class AliAnalysisTaskPWGJEQA.
Double_t fCent
!event centrality
Int_t fNPtHistBins
detector level container
TString fCaloCellsName
name of calo cell collection
Int_t fNIntegerHistBins
number of 1/pt res bins
Double_t * f1OverPtResHistBins
pt res bins
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
TObjArray fJetCollArray
jet collection array
AliVCaloCells * fCaloCells
!cells
AliRhoParameter * GetRhoParameter()
Int_t fNCentHistBins
phi bins
Double_t * fIntegerHistBins
number of integer bins
const AliClusterIterableMomentumContainer all_momentum() const
void FillMatchedParticlesTHnSparse(Double_t cent, Double_t partEta, Double_t partPhi, Double_t partPt, Double_t trackEta, Double_t trackPhi, Double_t trackPt, Byte_t trackType)
void FillGeneratorLevelTHnSparse(Double_t cent, Double_t partEta, Double_t partPhi, Double_t partPt)
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
void AllocateCellHistograms()
AliTLorentzVector fLeadingTrack
!Leading track in current event
Float_t GetJetRadius() const
void UserCreateOutputObjects()
AliEmcalList * fOutput
!output list
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
Char_t GetTrackType(const AliVTrack *track) const
Bool_t fIsEsd
!whether it's an ESD analysis
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
void GenerateHistoBins()
Generate histogram binning arrays for track histograms.
AliTrackContainer * GetTrackContainer(Int_t i=0) const
void SetMakeGeneralHistograms(Bool_t g)
This is a task used to do basic PWGJE QA on tracks, clusters, and jets. Based on code from Salvatore ...
Base task in the EMCAL jet framework.
const AliTrackIterableMomentumContainer accepted_momentum() const
Bool_t fDoJetQA
Set whether to enable jet QA.
TString fGeneratorLevelName
generator level container name
void SetRejectionReasonLabels(TAxis *axis)
void UserCreateOutputObjects()
Float_t fMaxPt
Histogram pt limit.
AliMCParticleContainer * fGeneratorLevel
Double_t * fCentHistBins
number of cent bins
THnSparse * fParticlesMatched
all physical primary particles
virtual ~AliAnalysisTaskPWGJEQA()
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
void AllocateTrackHistograms()
Container structure for EMCAL clusters.
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
Int_t fNPtRelDiffHistBins
cent bins
void AllocateGeneratorLevelTHnSparse()
Container for jet within the EMCAL jet framework.
Double_t * fPhiHistBins
number of phi bins
AliTLorentzVector fLeadingCluster[3]
!Leading cluster in current event (EMCal/DCal)
const AliJetIterableContainer all() const
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal