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 fBunchCrossingIndex(-1),
65 fEnergyDefinition(kDefaultEnergy),
67 fClusterTimeRange(-50e-6, 50e-6)
73 fCentralityRange(-999., 999.),
74 fRequestCentrality(false),
76 fCentralityEstimator(
"V0M"),
77 fBunchCrossingIndex(-1),
78 fEnergyDefinition(kDefaultEnergy),
80 fClusterTimeRange(-50e-6, 50e-6)
91 TLinearBinning smbinning(21, -0.5, 20.5), etabinning(100, -0.7, 0.7), timebinning(1000, -500e-9, 500e-9), ncellbinning(101, -0.5, 100.5);
100 std::array<Double_t, 5> encuts = {1., 2., 5., 10., 20.};
101 Int_t sectorsWithEMCAL[10] = {4, 5, 6, 7, 8, 9, 13, 14, 15, 16};
103 fHistos->
CreateTH1(
"hEventCount" + trg,
"Event count for trigger class " + trg, 1, 0.5, 1.5, optionstring);
104 fHistos->
CreateTH1(
"hEventCentrality" + trg,
"Event centrality for trigger class " + trg, 103, -2., 101., optionstring);
105 fHistos->
CreateTH1(
"hVertexZ" + trg,
"z-position of the primary vertex for trigger class " + trg, 200, -40., 40., optionstring);
106 fHistos->
CreateTH1(
"hClusterEnergy" + trg,
"Cluster energy for trigger class " + trg, energybinning, optionstring);
107 fHistos->
CreateTH1(
"hClusterET" + trg,
"Cluster transverse energy for trigger class " + trg, energybinning, optionstring);
108 fHistos->
CreateTH1(
"hClusterEnergyFired" + trg,
"Cluster energy for trigger class " + trg +
", firing the trigger", energybinning, optionstring);
109 fHistos->
CreateTH1(
"hClusterETFired" + trg,
"Cluster transverse energy for trigger class " + trg +
", firing the trigger" , energybinning, optionstring);
110 fHistos->
CreateTH2(
"hClusterEnergySM" + trg,
"Cluster energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
111 fHistos->
CreateTH2(
"hClusterETSM" + trg,
"Cluster transverse energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
112 fHistos->
CreateTH2(
"hClusterEnergyFiredSM" + trg,
"Cluster energy versus supermodule for trigger class " + trg +
", firing the trigger" , smbinning, energybinning, optionstring);
113 fHistos->
CreateTH2(
"hClusterETFiredSM" + trg,
"Cluster transverse energy versus supermodule for trigger class " + trg +
", firing the trigger" , smbinning, energybinning, optionstring);
114 fHistos->
CreateTH2(
"hEtaEnergy" + trg,
"Cluster energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
115 fHistos->
CreateTH2(
"hEtaET" + trg,
"Cluster transverse energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
116 fHistos->
CreateTH2(
"hTimeEnergy" + trg,
"Cluster time vs. energy for trigger class " + trg, timebinning, energybinning, optionstring);
117 fHistos->
CreateTH2(
"hNCellEnergy" + trg,
"Cluster number of cells vs energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
118 fHistos->
CreateTH2(
"hNCellET" + trg,
"Cluster number of cells vs transverse energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
119 fHistos->
CreateTH2(
"hEtaEnergyFired" + trg,
"Cluster energy vs. eta for trigger class " + trg +
", firing the trigger", etabinning, energybinning, optionstring);
120 fHistos->
CreateTH2(
"hEtaETFired" + trg,
"Cluster transverse energy vs. eta for trigger class " + trg +
", firing the trigger", etabinning, energybinning, optionstring);
121 for(
int ism = 0; ism < 20; ism++){
122 fHistos->
CreateTH2(TString::Format(
"hEtaEnergySM%d", ism) + trg, TString::Format(
"Cluster energy vs. eta in Supermodule %d for trigger ", ism) + trg, etabinning, energybinning, optionstring);
123 fHistos->
CreateTH2(TString::Format(
"hEtaETSM%d", ism) + trg, TString::Format(
"Cluster transverse energy vs. eta in Supermodule %d for trigger ", ism) + trg, etabinning, energybinning, optionstring);
124 fHistos->
CreateTH2(TString::Format(
"hEtaEnergyFiredSM%d", ism) + trg, TString::Format(
"Cluster energy vs. eta in Supermodule %d for trigger ", ism) + trg +
", firing the trigger", etabinning, energybinning, optionstring);
125 fHistos->
CreateTH2(TString::Format(
"hEtaETFiredSM%d", ism) + trg, TString::Format(
"Cluster transverse energy vs. eta in Supermodule %d for trigger ", ism) + trg +
", firing the trigger", etabinning, energybinning, optionstring);
127 for(
int isec = 0; isec < 10; isec++){
128 fHistos->
CreateTH2(TString::Format(
"hEtaEnergySec%d", sectorsWithEMCAL[isec]) + trg, TString::Format(
"Cluster energy vs.eta in tracking sector %d for trigger ", sectorsWithEMCAL[isec]) + trg, etabinning, energybinning, optionstring);
129 fHistos->
CreateTH2(TString::Format(
"hEtaETSec%d", sectorsWithEMCAL[isec]) + trg, TString::Format(
"Cluster transverse energy vs.eta in tracking sector %d for trigger ", sectorsWithEMCAL[isec]) + trg, etabinning, energybinning, optionstring);
130 fHistos->
CreateTH2(TString::Format(
"hEtaEnergyFiredSec%d", sectorsWithEMCAL[isec]) + trg, TString::Format(
"Cluster energy vs.eta in tracking sector %d for trigger ", sectorsWithEMCAL[isec]) + trg +
", firing the trigger", etabinning, energybinning, optionstring);
131 fHistos->
CreateTH2(TString::Format(
"hEtaETFiredSec%d", sectorsWithEMCAL[isec]) + trg, TString::Format(
"Cluster transverse energy vs.eta in tracking sector %d for trigger ", sectorsWithEMCAL[isec]) + trg +
", firing the trigger", etabinning, energybinning, optionstring);
133 for(
auto ien : encuts){
134 fHistos->
CreateTH2(TString::Format(
"hEtaPhi%dG", static_cast<int>(ien)) + trg, TString::Format(
"cluster #eta-#phi map for clusters with energy larger than %f GeV/c for trigger class ", ien) + trg, 100, -0.7, 0.7, 200, 0, 2*TMath::Pi(), optionstring);
135 fHistos->
CreateTH2(TString::Format(
"hEtaPhiFired%dG", static_cast<int>(ien)) + trg, TString::Format(
"cluster #eta-#phi map for clusters fired the trigger with energy larger than %f GeV/c for trigger class", ien) + trg +
", firing the trigger", 200, -0.7, 0.7, 200, 0, 2*TMath::Pi(), optionstring);
143 AliMultSelection *mult =
dynamic_cast<AliMultSelection *
>(InputEvent()->FindListObject(
"MultSelection"));
145 AliErrorStream() << GetName() <<
": Centrality selection enabled but no centrality estimator found" << std::endl;
148 if(mult->IsEventSelected())
return false;
150 AliDebugStream(1) << GetName() <<
": Centrality " <<
fEventCentrality << std::endl;
152 AliDebugStream(1) << GetName() <<
": reject centrality: " <<
fEventCentrality << std::endl;
155 AliDebugStream(1) << GetName() <<
": select centrality " <<
fEventCentrality << std::endl;
158 AliDebugStream(1) << GetName() <<
": No centrality selection applied" << std::endl;
162 int bcindex = fInputEvent->GetHeader()->GetBunchCrossNumber() % 4;
169 AliDebugStream(1) << GetName() <<
": UserExec start" << std::endl;
171 TList ej1patches, dj1patches, ej2patches, dj2patches, eg1patches, dg1patches, eg2patches, dg2patches;
182 TList *selpatches(
nullptr);
185 if(!clust->IsEMCAL())
continue;
186 if(clust->GetIsExotic())
continue;
192 AliDebugStream(2) << GetName() <<
": Using cluster energy definition: default" << std::endl;
196 AliDebugStream(2) << GetName() <<
": Using cluster energy definition: corrected for non-linearity" << std::endl;
197 energy = clust->GetNonLinCorrEnergy();
200 AliDebugStream(2) << GetName() <<
": Using cluster energy definition: corrected for hadronic contribution" << std::endl;
201 energy = clust->GetHadCorrEnergy();
205 AliDebugStream(2) << GetName() <<
": Using energy " << energy <<
" (def: " << clust->E()
206 <<
" | NL: " << clust->GetNonLinCorrEnergy()
207 <<
" | HD: " << clust->GetHadCorrEnergy()
210 TLorentzVector posvec;
211 clust->GetMomentum(posvec,
fVertex);
219 selpatches =
nullptr;
220 if(trg.Contains(
"EJ2")) selpatches = &ej2patches;
221 if(trg.Contains(
"DJ2")) selpatches = &dj2patches;
222 if(trg.Contains(
"EJ1")) selpatches = &ej1patches;
223 if(trg.Contains(
"DJ1")) selpatches = &dj1patches;
224 if(trg.Contains(
"EG2")) selpatches = &eg2patches;
225 if(trg.Contains(
"DG2")) selpatches = &dg2patches;
226 if(trg.Contains(
"EG1")) selpatches = &eg1patches;
227 if(trg.Contains(
"DG1")) selpatches = &dg1patches;
236 Int_t supermoduleID = -1, sector = -1;
238 AliDebugStream(1) << GetName() <<
": Using weight " << weight <<
" for trigger " << triggerclass << std::endl;
240 fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
241 fHistos->
FillTH1(
"hClusterEnergy" + triggerclass, energy, weight);
242 fHistos->
FillTH1(
"hClusterET" + triggerclass, transverseenergy, weight);
243 fHistos->
FillTH2(
"hEtaEnergy" + triggerclass, eta, energy, weight);
244 fHistos->
FillTH2(
"hEtaET" + triggerclass, eta, transverseenergy, weight);
245 fHistos->
FillTH2(
"hTimeEnergy" + triggerclass, clustertime, energy, weight);
246 fHistos->
FillTH2(
"hNCellEnergy" + triggerclass, ncell, energy, weight);
247 fHistos->
FillTH2(
"hNCellET" + triggerclass, ncell, transverseenergy, weight);
248 if(supermoduleID >= 0){
249 fHistos->
FillTH2(
"hClusterEnergySM" + triggerclass, supermoduleID, energy, weight);
250 fHistos->
FillTH2(
"hClusterETSM" + triggerclass, supermoduleID, transverseenergy, weight);
251 fHistos->
FillTH2(TString::Format(
"hEtaEnergySM%d", supermoduleID) + triggerclass, eta, energy, weight);
252 fHistos->
FillTH2(TString::Format(
"hEtaETSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
253 if(supermoduleID < 12)
254 sector = 4 + int(supermoduleID/2);
256 sector = 13 + int((supermoduleID-12)/2);
257 fHistos->
FillTH2(TString::Format(
"hEtaEnergySec%d", sector) + triggerclass, eta, energy, weight);
258 fHistos->
FillTH2(TString::Format(
"hEtaETSec%d", sector) + triggerclass, eta, transverseenergy, weight);
261 fHistos->
FillTH1(
"hClusterEnergyFired" + triggerclass, energy, weight);
262 fHistos->
FillTH1(
"hClusterETFired" + triggerclass, energy, weight);
263 fHistos->
FillTH2(
"hEtaEnergyFired" + triggerclass, eta, energy, weight);
264 fHistos->
FillTH2(
"hEtaETFired" + triggerclass, eta, energy, weight);
265 if(supermoduleID >= 0){
266 fHistos->
FillTH2(
"hClusterEnergyFiredSM" + triggerclass, supermoduleID, energy, weight);
267 fHistos->
FillTH2(
"hClusterETFiredSM" + triggerclass, supermoduleID, transverseenergy, weight);
268 fHistos->
FillTH2(TString::Format(
"hEtaEnergyFiredSM%d", supermoduleID) + triggerclass, eta, energy,weight);
269 fHistos->
FillTH2(TString::Format(
"hEtaETFiredSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
270 fHistos->
FillTH2(TString::Format(
"hEtaEnergyFiredSec%d", sector) + triggerclass, eta, energy, weight);
271 fHistos->
FillTH2(TString::Format(
"hEtaETFiredSec%d", sector) + triggerclass, eta, transverseenergy, weight);
274 Double_t encuts[5] = {1., 2., 5., 10., 20.};
275 for(
int ien = 0; ien < 5; ien++){
276 if(energy > encuts[ien]){
277 fHistos->
FillTH2(TString::Format(
"hEtaPhi%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
279 fHistos->
FillTH2(TString::Format(
"hEtaPhiFired%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
296 for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
300 etamax = TMath::Max(boundaries[0], boundaries[1]),
301 phimin = TMath::Min(boundaries[2], boundaries[3]),
302 phimax = TMath::Max(boundaries[2], boundaries[3]);
303 if(etaclust > etamin && etaclust < etamax && phiclust >
phimin && phiclust < phimax){
312 foundtriggers.Clear();
313 if(!triggerPatches)
return;
324 for(
auto patchiter : *triggerPatches){
325 AliEMCALTriggerPatchInfo *mypatch =
static_cast<AliEMCALTriggerPatchInfo *
>(patchiter);
326 if(!mypatch->IsOfflineSimple())
continue;
328 if(!mypatch->IsDCalPHOS())
continue;
330 if(mypatch->IsDCalPHOS())
continue;
333 if(!mypatch->IsGammaLowSimple())
continue;
335 if(!mypatch->IsJetLowSimple())
continue;
338 if(mypatch->GetPatchE() > threshold) foundtriggers.Add(patchiter);
343 AliEMCALTriggerPatchInfo *patch=
dynamic_cast<AliEMCALTriggerPatchInfo *
>(o);
344 boundaries[0] = patch->GetEtaMin();
345 boundaries[1] = patch->GetEtaMax();
346 boundaries[2] = patch->GetPhiMin();
347 boundaries[3] = patch->GetPhiMax();
366 TString outfile(mgr->GetCommonFileName());
367 outfile +=
":ClusterQA_" +
TString(suffix);
369 printf(
"Outfile: %s, container: %s\n", outfile.Data(), containername.Data());
371 task->ConnectInput(0, mgr->GetCommonInputContainer());
372 mgr->ConnectOutput(task, 1, mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
400 TString outfile(mgr->GetCommonFileName());
401 outfile +=
":ClusterQA";
403 task->ConnectInput(0, mgr->GetCommonInputContainer());
404 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
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.
Char_t fBunchCrossingIndex
Bunch Crossing index.
AliEmcalTriggerOfflineSelection * fTriggerSelection
Offline trigger selection.
Bool_t fRequestCentrality
Switch on request for centrality range.
void AddStep(Double_t max, Double_t binwidth)
EMCAL L1 Gamma trigger, high threshold.
void SetOfflineTriggerSelection(AliEmcalTriggerOfflineSelection *sel)
Set an offline trigger selection.
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)
Checks if the trigger class is a single shower patch trigger class.
Double_t GetThresholdForTrigger(EmcalTriggerClass trgcls) const
Get the offline trigger threshold (on energy) for a given trigger class.
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 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)
Checks if the trigger class is a jet patch trigger class.
EnergyDefinition_t fEnergyDefinition
Energy definition used for a given cluster.
Energy corrected for non-linearity.
virtual void CreateUserHistos()
virtual ~AliAnalysisTaskEmcalClustersRef()
void FillClusterHistograms(const TString &triggerclass, double energy, double transversenergy, double eta, double phi, double clustertime, int ncell, TList *triggerpatches)
static AliEmcalTriggerOfflineSelection * TriggerSelectionFactory(Double_t el0, Double_t eg1, Double_t eg2, Double_t ej1, Double_t ej2, AliEmcalTriggerOfflineSelection::EmcalEnergyDefinition_t endef=AliEmcalTriggerOfflineSelection::kFEEEnergy)
Configures EMCAL trigger offline selection used to restrict EMCAL triggered sample.
void FindPatchesForTrigger(TString triggerclass, const TClonesArray *triggerpatches, TList &foundpatches) const
bool IsInRange(t value) const
void SetMinimum(Double_t min)
static TString ClusterContainerNameFactory(Bool_t isAOD)
Get name of the default cluster container.