22 #include <TClonesArray.h>
24 #include <THashList.h>
27 #include <TLorentzVector.h>
28 #include <TObjArray.h>
29 #include <TParameter.h>
32 #include "AliAnalysisManager.h"
33 #include "AliAnalysisUtils.h"
36 #include "AliEMCALGeometry.h"
38 #include "AliEMCALTriggerPatchInfo.h"
40 #include "AliESDEvent.h"
41 #include "AliInputEventHandler.h"
43 #include "AliMultSelection.h"
44 #include "AliMultEstimator.h"
45 #include "AliVCluster.h"
46 #include "AliVEvent.h"
47 #include "AliVEventHandler.h"
48 #include "AliVVertex.h"
56 namespace EMCalTriggerPtAnalysis {
58 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
60 fCentralityRange(-999., 999.),
61 fRequestCentrality(false),
63 fCentralityEstimator(
"V0M"),
64 fEnergyDefinition(kDefaultEnergy),
66 fClusterTimeRange(-50e-6, 50e-6)
72 fCentralityRange(-999., 999.),
73 fRequestCentrality(false),
75 fCentralityEstimator(
"V0M"),
76 fEnergyDefinition(kDefaultEnergy),
78 fClusterTimeRange(-50e-6, 50e-6)
89 TLinearBinning smbinning(21, -0.5, 20.5), etabinning(100, -0.7, 0.7), timebinning(100, -500e-9, 500e-9);
98 std::array<Double_t, 5> encuts = {1., 2., 5., 10., 20.};
99 Int_t sectorsWithEMCAL[10] = {4, 5, 6, 7, 8, 9, 13, 14, 15, 16};
101 fHistos->
CreateTH1(Form(
"hEventCount%s", trg.Data()), Form(
"Event count for trigger class %s", trg.Data()), 1, 0.5, 1.5, optionstring);
102 fHistos->
CreateTH1(Form(
"hEventCentrality%s", trg.Data()), Form(
"Event centrality for trigger class %s", trg.Data()), 103, -2., 101., optionstring);
103 fHistos->
CreateTH1(Form(
"hVertexZ%s", trg.Data()), Form(
"z-position of the primary vertex for trigger class %s", trg.Data()), 200, -40., 40., optionstring);
104 fHistos->
CreateTH1(Form(
"hClusterEnergy%s", trg.Data()), Form(
"Cluster energy for trigger class %s", trg.Data()), energybinning, optionstring);
105 fHistos->
CreateTH1(Form(
"hClusterET%s", trg.Data()), Form(
"Cluster transverse energy for trigger class %s", trg.Data()), energybinning, optionstring);
106 fHistos->
CreateTH1(Form(
"hClusterEnergyFired%s", trg.Data()), Form(
"Cluster energy for trigger class %s, firing the trigger", trg.Data()), energybinning, optionstring);
107 fHistos->
CreateTH1(Form(
"hClusterETFired%s", trg.Data()), Form(
"Cluster transverse energy for trigger class %s, firing the trigger", trg.Data()), energybinning, optionstring);
108 fHistos->
CreateTH2(Form(
"hClusterEnergySM%s", trg.Data()), Form(
"Cluster energy versus supermodule for trigger class %s", trg.Data()), smbinning, energybinning, optionstring);
109 fHistos->
CreateTH2(Form(
"hClusterETSM%s", trg.Data()), Form(
"Cluster transverse energy versus supermodule for trigger class %s", trg.Data()), smbinning, energybinning, optionstring);
110 fHistos->
CreateTH2(Form(
"hClusterEnergyFiredSM%s", trg.Data()), Form(
"Cluster energy versus supermodule for trigger class %s, firing the trigger", trg.Data()), smbinning, energybinning, optionstring);
111 fHistos->
CreateTH2(Form(
"hClusterETFiredSM%s", trg.Data()), Form(
"Cluster transverse energy versus supermodule for trigger class %s, firing the trigger", trg.Data()), smbinning, energybinning, optionstring);
112 fHistos->
CreateTH2(Form(
"hEtaEnergy%s", trg.Data()), Form(
"Cluster energy vs. eta for trigger class %s", trg.Data()), etabinning, energybinning, optionstring);
113 fHistos->
CreateTH2(Form(
"hEtaET%s", trg.Data()), Form(
"Cluster transverse energy vs. eta for trigger class %s", trg.Data()), etabinning, energybinning, optionstring);
114 fHistos->
CreateTH2(Form(
"hTimeEnergy%s", trg.Data()), Form(
"Cluster time vs. energy for trigger class %s", trg.Data()), timebinning, energybinning, optionstring);
115 fHistos->
CreateTH2(Form(
"hEtaEnergyFired%s", trg.Data()), Form(
"Cluster energy vs. eta for trigger class %s, firing the trigger", trg.Data()), etabinning, energybinning, optionstring);
116 fHistos->
CreateTH2(Form(
"hEtaETFired%s", trg.Data()), Form(
"Cluster transverse energy vs. eta for trigger class %s, firing the trigger", trg.Data()), etabinning, energybinning, optionstring);
117 for(
int ism = 0; ism < 20; ism++){
118 fHistos->
CreateTH2(Form(
"hEtaEnergySM%d%s", ism, trg.Data()), Form(
"Cluster energy vs. eta in Supermodule %d for trigger %s", ism, trg.Data()), etabinning, energybinning, optionstring);
119 fHistos->
CreateTH2(Form(
"hEtaETSM%d%s", ism, trg.Data()), Form(
"Cluster transverse energy vs. eta in Supermodule %d for trigger %s", ism, trg.Data()), etabinning, energybinning, optionstring);
120 fHistos->
CreateTH2(Form(
"hEtaEnergyFiredSM%d%s", ism, trg.Data()), Form(
"Cluster energy vs. eta in Supermodule %d for trigger %s, firing the trigger", ism, trg.Data()), etabinning, energybinning, optionstring);
121 fHistos->
CreateTH2(Form(
"hEtaETFiredSM%d%s", ism, trg.Data()), Form(
"Cluster transverse energy vs. eta in Supermodule %d for trigger %s, firing the trigger", ism, trg.Data()), etabinning, energybinning, optionstring);
123 for(
int isec = 0; isec < 10; isec++){
124 fHistos->
CreateTH2(Form(
"hEtaEnergySec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form(
"Cluster energy vs.eta in tracking sector %d for trigger %s", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning, optionstring);
125 fHistos->
CreateTH2(Form(
"hEtaETSec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form(
"Cluster transverse energy vs.eta in tracking sector %d for trigger %s", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning, optionstring);
126 fHistos->
CreateTH2(Form(
"hEtaEnergyFiredSec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form(
"Cluster energy vs.eta in tracking sector %d for trigger %s, firing the trigger", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning, optionstring);
127 fHistos->
CreateTH2(Form(
"hEtaETFiredSec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form(
"Cluster transverse energy vs.eta in tracking sector %d for trigger %s, firing the trigger", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning, optionstring);
129 for(
auto ien : encuts){
130 fHistos->
CreateTH2(Form(
"hEtaPhi%dG%s", static_cast<int>(ien), trg.Data()), Form(
"cluster #eta-#phi map for clusters with energy larger than %f GeV/c for trigger class %s", ien, trg.Data()), 100, -0.7, 0.7, 200, 0, 2*TMath::Pi(), optionstring);
131 fHistos->
CreateTH2(Form(
"hEtaPhiFired%dG%s", static_cast<int>(ien), trg.Data()), Form(
"cluster #eta-#phi map for clusters fired the trigger with energy larger than %f GeV/c for trigger class %s", ien, trg.Data()), 200, -0.7, 0.7, 200, 0, 2*TMath::Pi(), optionstring);
139 AliMultSelection *mult =
dynamic_cast<AliMultSelection *
>(InputEvent()->FindListObject(
"MultSelection"));
141 AliErrorStream() << GetName() <<
": Centrality selection enabled but no centrality estimator found" << std::endl;
144 if(mult->IsEventSelected())
return false;
146 AliDebugStream(1) << GetName() <<
": Centrality " <<
fEventCentrality << std::endl;
148 AliDebugStream(1) << GetName() <<
": reject centrality: " <<
fEventCentrality << std::endl;
151 AliDebugStream(1) << GetName() <<
": select centrality " <<
fEventCentrality << std::endl;
154 AliDebugStream(1) << GetName() <<
": No centrality selection applied" << std::endl;
160 AliDebugStream(1) << GetName() <<
": UserExec start" << std::endl;
162 TList ej1patches, dj1patches, ej2patches, dj2patches, eg1patches, dg1patches, eg2patches, dg2patches;
173 TList *selpatches(
nullptr);
176 if(!clust->IsEMCAL())
continue;
177 if(clust->GetIsExotic())
continue;
183 AliDebugStream(2) << GetName() <<
": Using cluster energy definition: default" << std::endl;
187 AliDebugStream(2) << GetName() <<
": Using cluster energy definition: corrected for non-linearity" << std::endl;
188 energy = clust->GetNonLinCorrEnergy();
191 AliDebugStream(2) << GetName() <<
": Using cluster energy definition: corrected for hadronic contribution" << std::endl;
192 energy = clust->GetHadCorrEnergy();
196 AliDebugStream(2) << GetName() <<
": Using energy " << energy <<
" (def: " << clust->E()
197 <<
" | NL: " << clust->GetNonLinCorrEnergy()
198 <<
" | HD: " << clust->GetHadCorrEnergy()
201 TLorentzVector posvec;
202 clust->GetMomentum(posvec,
fVertex);
210 selpatches =
nullptr;
211 if(trg.Contains(
"EJ2")) selpatches = &ej2patches;
212 if(trg.Contains(
"DJ2")) selpatches = &dj2patches;
213 if(trg.Contains(
"EJ1")) selpatches = &ej1patches;
214 if(trg.Contains(
"DJ1")) selpatches = &dj1patches;
215 if(trg.Contains(
"EG2")) selpatches = &eg2patches;
216 if(trg.Contains(
"DG2")) selpatches = &dg2patches;
217 if(trg.Contains(
"EG1")) selpatches = &eg1patches;
218 if(trg.Contains(
"DG1")) selpatches = &dg1patches;
227 Int_t supermoduleID = -1, sector = -1;
229 AliDebugStream(1) << GetName() <<
": Using weight " << weight <<
" for trigger " << triggerclass << std::endl;
231 fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
232 fHistos->
FillTH1(Form(
"hClusterEnergy%s", triggerclass.Data()), energy, weight);
233 fHistos->
FillTH1(Form(
"hClusterET%s", triggerclass.Data()), transverseenergy, weight);
234 fHistos->
FillTH2(Form(
"hEtaEnergy%s", triggerclass.Data()), eta, energy, weight);
235 fHistos->
FillTH2(Form(
"hEtaET%s", triggerclass.Data()), eta, transverseenergy, weight);
236 fHistos->
FillTH2(Form(
"hTimeEnergy%s", triggerclass.Data()), clustertime, energy, weight);
237 if(supermoduleID >= 0){
238 fHistos->
FillTH2(Form(
"hClusterEnergySM%s", triggerclass.Data()), supermoduleID, energy, weight);
239 fHistos->
FillTH2(Form(
"hClusterETSM%s", triggerclass.Data()), supermoduleID, transverseenergy, weight);
240 fHistos->
FillTH2(Form(
"hEtaEnergySM%d%s", supermoduleID, triggerclass.Data()), eta, energy, weight);
241 fHistos->
FillTH2(Form(
"hEtaETSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy, weight);
242 if(supermoduleID < 12)
243 sector = 4 + int(supermoduleID/2);
245 sector = 13 + int((supermoduleID-12)/2);
246 fHistos->
FillTH2(Form(
"hEtaEnergySec%d%s", sector, triggerclass.Data()), eta, energy, weight);
247 fHistos->
FillTH2(Form(
"hEtaETSec%d%s", sector, triggerclass.Data()), eta, transverseenergy, weight);
250 fHistos->
FillTH1(Form(
"hClusterEnergyFired%s", triggerclass.Data()), energy, weight);
251 fHistos->
FillTH1(Form(
"hClusterETFired%s", triggerclass.Data()), energy, weight);
252 fHistos->
FillTH2(Form(
"hEtaEnergyFired%s", triggerclass.Data()), eta, energy, weight);
253 fHistos->
FillTH2(Form(
"hEtaETFired%s", triggerclass.Data()), eta, energy, weight);
254 if(supermoduleID >= 0){
255 fHistos->
FillTH2(Form(
"hClusterEnergyFiredSM%s", triggerclass.Data()), supermoduleID, energy, weight);
256 fHistos->
FillTH2(Form(
"hClusterETFiredSM%s", triggerclass.Data()), supermoduleID, transverseenergy, weight);
257 fHistos->
FillTH2(Form(
"hEtaEnergyFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, energy,weight);
258 fHistos->
FillTH2(Form(
"hEtaETFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy, weight);
259 fHistos->
FillTH2(Form(
"hEtaEnergyFiredSec%d%s", sector, triggerclass.Data()), eta, energy, weight);
260 fHistos->
FillTH2(Form(
"hEtaETFiredSec%d%s", sector, triggerclass.Data()), eta, transverseenergy, weight);
263 Double_t encuts[5] = {1., 2., 5., 10., 20.};
264 for(
int ien = 0; ien < 5; ien++){
265 if(energy > encuts[ien]){
266 fHistos->
FillTH2(Form(
"hEtaPhi%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi, weight);
268 fHistos->
FillTH2(Form(
"hEtaPhiFired%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi, weight);
285 for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
289 etamax = TMath::Max(boundaries[0], boundaries[1]),
290 phimin = TMath::Min(boundaries[2], boundaries[3]),
291 phimax = TMath::Max(boundaries[2], boundaries[3]);
292 if(etaclust > etamin && etaclust < etamax && phiclust >
phimin && phiclust < phimax){
301 foundtriggers.Clear();
302 if(!triggerPatches)
return;
313 for(
auto patchiter : *triggerPatches){
314 AliEMCALTriggerPatchInfo *mypatch =
static_cast<AliEMCALTriggerPatchInfo *
>(patchiter);
315 if(!mypatch->IsOfflineSimple())
continue;
317 if(!mypatch->IsDCalPHOS())
continue;
319 if(mypatch->IsDCalPHOS())
continue;
322 if(!mypatch->IsGammaLowSimple())
continue;
324 if(!mypatch->IsJetLowSimple())
continue;
327 if(mypatch->GetPatchE() > threshold) foundtriggers.Add(patchiter);
332 AliEMCALTriggerPatchInfo *patch=
dynamic_cast<AliEMCALTriggerPatchInfo *
>(o);
333 boundaries[0] = patch->GetEtaMin();
334 boundaries[1] = patch->GetEtaMax();
335 boundaries[2] = patch->GetPhiMin();
336 boundaries[3] = patch->GetPhiMax();
355 TString outfile(mgr->GetCommonFileName());
356 outfile +=
":ClusterQA_" +
TString(suffix);
358 printf(
"Outfile: %s, container: %s\n", outfile.Data(), containername.Data());
360 task->ConnectInput(0, mgr->GetCommonInputContainer());
361 mgr->ConnectOutput(task, 1, mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
389 TString outfile(mgr->GetCommonFileName());
390 outfile +=
":ClusterQA";
392 task->ConnectInput(0, mgr->GetCommonInputContainer());
393 mgr->ConnectOutput(task, 1, mgr->CreateContainer(
"ClusterResults", AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
EMCAL L1 Jet trigger, low threshold.
AliCutValueRange< double > fClusterTimeRange
Selected range on cluster time.
void GetPatchBoundaries(TObject *o, Double_t *boundaries) const
std::vector< TString > fSelectedTriggers
! Triggers selected for given event
std::vector< TString > GetSupportedTriggers()
Class creating a linear binning, used in the histogram manager.
Double_t fEventCentrality
! Current event centrality
THistManager * fHistos
Task Histogram container.
Bool_t CorrelateToTrigger(Double_t etaclust, Double_t phiclust, TList *triggerpatches) const
Double_t GetTriggerWeight(const TString &triggerclass) const
static TString ClusterContainerNameFactory(Bool_t isAOD)
DCAL L1 Gamma trigger, low threshold.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
DCAL L1 Jet trigger, high threshold.
virtual bool IsUserEventSelected()
Energy corrected for the hadronic contribution.
Simple monitoring task for cluster-related quantities in EMCAL-triggered events.
AliEmcalTriggerOfflineSelection * fTriggerSelection
Offline trigger selection.
Bool_t fRequestCentrality
Switch on request for centrality range.
static AliEmcalTriggerOfflineSelection * TriggerSelectionFactory(Double_t el0, Double_t eg1, Double_t eg2, Double_t ej1, Double_t ej2, AliEmcalTriggerOfflineSelection::EmcalEnergyDefinition_t endef=AliEmcalTriggerOfflineSelection::kFEEEnergy)
void AddStep(Double_t max, Double_t binwidth)
EMCAL L1 Gamma trigger, high threshold.
void SetOfflineTriggerSelection(AliEmcalTriggerOfflineSelection *sel)
DCAL L1 Jet trigger, low threshold.
AliClusterContainer * AddClusterContainer(const char *n)
EMCAL L1 Jet trigger, high threshold.
Base class for analyses using EMCAL triggers.
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
AliAnalysisTaskEmcalClustersRef()
TString fNameClusterContainer
Name of the cluster container in the event.
virtual void UserFillHistosAfterEventSelection()
AliEMCALGeometry * fGeom
!emcal geometry
EmcalTriggerClass
Definition of the various supported trigger types.
Bool_t fEnableSumw2
Enable sumw2 when creating histograms.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Helper class creating user defined custom binning.
static Bool_t IsSingleShower(EmcalTriggerClass cls)
Double_t GetThresholdForTrigger(EmcalTriggerClass trgcls) const
static AliAnalysisTaskEmcalClustersRef * AddTaskEmcalClustersRef(const TString &nClusters="usedefault", const TString &suffix="")
DCAL L1 Gamma trigger, high threshold.
EMCAL L1 Gamma trigger, low threshold.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
TString fCentralityEstimator
Centrality estimator (default: V0M for PbPb)
void FillClusterHistograms(const TString &triggerclass, double energy, double transversenergy, double eta, double phi, double clustertime, TList *triggerpatches)
void SetClusterContainer(TString clustercontname)
static AliAnalysisTaskEmcalClustersRef * AddTaskEmcalClustersRefDefault(const TString &nClusters="usedefault")
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fVertex[3]
!event vertex
AliCutValueRange< double > fCentralityRange
Selected centrality range.
TClonesArray * fTriggerPatchInfo
!trigger patch info array
Uncorrected energy measurement.
static Bool_t IsDCAL(EmcalTriggerClass cls)
EnergyDefinition_t fEnergyDefinition
Energy definition used for a given cluster.
Energy corrected for non-linearity.
virtual void CreateUserHistos()
virtual ~AliAnalysisTaskEmcalClustersRef()
void FindPatchesForTrigger(TString triggerclass, const TClonesArray *triggerpatches, TList &foundpatches) const
bool IsInRange(t value) const
void SetMinimum(Double_t min)