AliPhysics  master (3d17d9d)
AliAnalysisTaskEmcalClustersRef.cxx
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2017, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  ************************************************************************************/
27 #include <array>
28 #include <bitset>
29 #include <iostream>
30 #include <map>
31 #include <set>
32 #include <vector>
33 
34 #include <TArrayD.h>
35 #include <TClonesArray.h>
36 #include <TGrid.h>
37 #include <THashList.h>
38 #include <THistManager.h>
39 #include <TLinearBinning.h>
40 #include <TLorentzVector.h>
41 #include <TMath.h>
42 #include <TObjArray.h>
43 #include <TObjString.h>
44 #include <TParameter.h>
45 
46 #include "AliAnalysisManager.h"
47 #include "AliAnalysisUtils.h"
48 #include "AliClusterContainer.h"
50 #include "AliEMCALGeometry.h"
51 #include "AliEmcalList.h"
52 #include "AliEMCALTriggerPatchInfo.h"
58 #include "AliESDEvent.h"
59 #include "AliInputEventHandler.h"
60 #include "AliLog.h"
61 #include "AliMultSelection.h"
62 #include "AliMultEstimator.h"
63 #include "AliVCluster.h"
64 #include "AliVEvent.h"
65 #include "AliVEventHandler.h"
66 #include "AliVVertex.h"
67 
69 
73 
74 namespace EMCalTriggerPtAnalysis {
75 
76 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
78  fCentralityRange(-999., 999.),
79  fRequestCentrality(false),
80  fEventCentrality(-1),
81  fCentralityEstimator("V0M"),
82  fBunchCrossingIndex(-1),
83  fEnergyDefinition(kDefaultEnergy),
84  fEnableSumw2(false),
85  fDoFillMultiplicityHistograms(false),
86  fUseFiredTriggers(false),
87  fUseExclusiveTriggers(true),
88  fFillTriggerClusters(true),
89  fMonitorEtaPhi(false),
90  fClusterTimeRange(-50e-6, 50e-6),
91  fTriggerClusters(),
92  fRequiredOverlaps(),
93  fExcludedOverlaps()
94 {
95 }
96 
99  fCentralityRange(-999., 999.),
100  fRequestCentrality(false),
101  fEventCentrality(-1),
102  fCentralityEstimator("V0M"),
105  fEnableSumw2(false),
107  fUseFiredTriggers(false),
108  fUseExclusiveTriggers(true),
109  fFillTriggerClusters(true),
110  fMonitorEtaPhi(false),
111  fClusterTimeRange(-50e-6, 50e-6),
115 {
116 }
117 
119 }
120 
121 
123 
124  EnergyBinning energybinning;
125  TLinearBinning smbinning(21, -0.5, 20.5), etabinning(100, -0.7, 0.7), phibinning(200, 0., TMath::TwoPi()), timebinning(1000, -500e-9, 500e-9), ncellbinning(101, -0.5, 100.5);
126  TLinearBinning trgclustbinning(kTrgClusterN, -0.5, kTrgClusterN - 0.5);
127  TString optionstring = fEnableSumw2 ? "s" : "";
128 
129  /*
130  * Exclusive classes are defined as triggered events
131  * in a class without lower threshold classes firing.
132  * This is needed to make the triggers statistically
133  * independent.
134  */
135 
136  // Binnings for Multiplicity correlation
137  TLinearBinning v0abinning(1000, 0., 1000.), centralitybinning(100, 0., 100.), trackletbinning(500, 0., 500.), itsclustbinning(500, 0., 500.),
138  emcclustbinning(100, 0., 100.), emccellbinning(3000, 0., 3000.), adcbinning(2000, 0., 2000.);
139  const TBinning *multbinning[6] = {&v0abinning, &trackletbinning, &trackletbinning, &itsclustbinning, &emcclustbinning, &emccellbinning};
140  std::vector<const TBinning *> clusterallbinning;
141  clusterallbinning.push_back(&smbinning);
142  clusterallbinning.push_back(&centralitybinning);
143  clusterallbinning.push_back(&energybinning);
144  if(fMonitorEtaPhi) {
145  clusterallbinning.push_back(&etabinning);
146  clusterallbinning.push_back(&phibinning);
147  }
148  clusterallbinning.push_back(&trgclustbinning);
149  AliDebugStream(1) << "Using exclusive triggers: " << (fUseExclusiveTriggers ? "yes" : "no") << std::endl;
151  AliDebugStream(1) << "Creating histograms for trigger " << trg << std::endl;
152  fHistos->CreateTH1("hTrgClustCounter" + trg, "Event counter in trigger cluster " + trg, trgclustbinning);
153  fHistos->CreateTH1("hEventCentrality" + trg, "Event centrality for trigger class " + trg, 103, -2., 101., optionstring);
154  fHistos->CreateTH1("hVertexZ" + trg, "z-position of the primary vertex for trigger class " + trg, 200, -40., 40., optionstring);
155  if(this->fDoFillMultiplicityHistograms) fHistos->CreateTHnSparse("hMultiplicityCorrelation" + trg, "Multiplicity correlation for trigger" + trg, 6, multbinning);
156  fHistos->CreateTHnSparse("hClusterTHnSparseAll" + trg, "Cluster THnSparse (all) for trigger" + trg, clusterallbinning.size(), clusterallbinning.data());
157  fHistos->CreateTHnSparse("hClusterTHnSparseMax" + trg, "Cluster THnSparse (max) for trigger" + trg, clusterallbinning.size(), clusterallbinning.data());
158  if(fUseFiredTriggers) fHistos->CreateTHnSparse("hClusterTHnSparseFired" + trg, "Cluster THnSparse (firing) for trigger" + trg, clusterallbinning.size(), clusterallbinning.data());
159  fHistos->CreateTH2("hTimeEnergy" + trg, "Cluster time vs. energy for trigger class " + trg, timebinning, energybinning, optionstring);
160  fHistos->CreateTH2("hNCellEnergy" + trg, "Cluster number of cells vs energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
161  if(fUseFiredTriggers){
162  fHistos->CreateTH2("hCorrClusterEPatchADC" + trg, "Correlation between cluster E and patch ADC for trigger " + trg, energybinning, adcbinning);
163  fHistos->CreateTH2("hCorrClusterEPatchE" + trg, "Correlation between cluster E and patch E for trigger " + trg, energybinning, energybinning);
164  }
165  }
166 }
167 
169  fEventCentrality = 99; // without centrality put everything in the peripheral bin
170  if(fRequestCentrality){
171  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
172  if(!mult){
173  AliErrorStream() << GetName() << ": Centrality selection enabled but no centrality estimator found" << std::endl;
174  return false;
175  }
176  //if(mult->IsEventSelected()) return false;
177  fEventCentrality = mult->GetEstimator(fCentralityEstimator)->GetPercentile();
178  AliDebugStream(1) << GetName() << ": Centrality " << fEventCentrality << std::endl;
180  AliDebugStream(1) << GetName() << ": reject centrality: " << fEventCentrality << std::endl;
181  return false;
182  } else {
183  AliDebugStream(1) << GetName() << ": select centrality " << fEventCentrality << std::endl;
184  }
185  } else {
186  AliDebugStream(1) << GetName() << ": No centrality selection applied" << std::endl;
187  }
188 
189  if(fBunchCrossingIndex > -1){
190  int bcindex = fInputEvent->GetHeader()->GetBunchCrossNumber() % 4;
191  if(bcindex != fBunchCrossingIndex) return false;
192  }
193 
194  // handle overlaps
195  if(fRequiredOverlaps.GetEntries() || fExcludedOverlaps.GetEntries()){
196  if(fRequiredOverlaps.GetEntries()){
197  Bool_t allFound(true);
198  for(auto t : fRequiredOverlaps){
199  auto trgstr = static_cast<TObjString *>(t)->String();
200  if(std::find_if(fSelectedTriggers.begin(), fSelectedTriggers.end(), [&trgstr](const TString &seltrigger) -> bool { return seltrigger.Contains(trgstr); }) == fSelectedTriggers.end()) {
201  allFound = false;
202  break;
203  }
204  }
205  if(!allFound) return false;
206  }
207 
208  if(fExcludedOverlaps.GetEntries()){
209  Bool_t oneFound(false);
210  for(auto t : fExcludedOverlaps){
211  auto trgstr = static_cast<TObjString *>(t)->String();
212  if(std::find_if(fSelectedTriggers.begin(), fSelectedTriggers.end(), [&trgstr](const TString &seltrigger) -> bool { return seltrigger.Contains(trgstr); }) != fSelectedTriggers.end()) {
213  oneFound = true;
214  break;
215  }
216  }
217  if(oneFound) return false;
218  }
219  }
220 
221  // determine trigger clusters (ANY - 0 always included)
222  // Only meaningfull in data
223  fTriggerClusters.clear();
224  fTriggerClusters.emplace_back(kTrgClusterANY);
226  Bool_t isCENT(false), isCENTNOTRD(false), isCALO(false), isCALOFAST(false);
227  for(auto trg : PWG::EMCAL::Triggerinfo::DecodeTriggerString(fInputEvent->GetFiredTriggerClasses().Data())){
228  auto trgclust = trg.Triggercluster();
229  if(trgclust == "CENT" && !isCENT){
230  isCENT = true;
231  fTriggerClusters.emplace_back(kTrgClusterCENT);
232  }
233  if(trgclust == "CENTNOTRD" && ! isCENTNOTRD){
234  isCENTNOTRD = true;
236  }
237  if(trgclust == "CALO" && !isCALO){
238  isCALO = true;
239  fTriggerClusters.emplace_back(kTrgClusterCALO);
240  }
241  if(trgclust == "CALOFAST" && ! isCALOFAST) {
242  isCALOFAST = true;
243  fTriggerClusters.emplace_back();
244  }
245  }
246  // Mixed clusters
247  if(isCENT || isCENTNOTRD) {
248  if(isCENT) {
249  if(isCENTNOTRD) fTriggerClusters.emplace_back(kTrgClusterCENTBOTH);
250  else fTriggerClusters.emplace_back(kTrgClusterOnlyCENT);
251  } else fTriggerClusters.emplace_back(kTrgClusterOnlyCENTNOTRD);
252  }
253  if(isCALO || isCALOFAST){
254  if(isCALO) {
255  if(isCALOFAST) fTriggerClusters.emplace_back(kTrgClusterCALOBOTH);
256  else fTriggerClusters.emplace_back(kTrgClusterOnlyCALO);
257  } else fTriggerClusters.emplace_back(kTrgClusterOnlyCALOFAST);
258  }
259  }
260 
261  return true;
262 }
263 
265  AliDebugStream(1) << GetName() << ": UserExec start" << std::endl;
266 
267  std::map<TString, const TList *> patchhandlers;
268  const std::vector<TString> l1triggers = {"EJ1", "EJ2", "EG1", "EG2", "DJ1", "DJ2", "DG1", "DG2"};
269  int energycomp = -1;
270  // get fired trigger patches from the trigger selection task
271  if(auto trgsel = static_cast<PWG::EMCAL::AliEmcalTriggerDecisionContainer *>(fInputEvent->FindListObject("EmcalTriggerDecision"))){
272  /*
273  for(auto t : *(trgsel->GetListOfTriggerDecisions())){
274  auto dec = static_cast<PWG::EMCAL::AliEmcalTriggerDecision *>(t);
275  std::cout << "Found trigger decision " << dec->GetName() << std::endl;
276  }
277  */
278  for(auto t : l1triggers){
279  auto decision = trgsel->FindTriggerDecision(t.Data());
280  if(decision){
281  patchhandlers[t] = decision->GetAcceptedPatches();
282  if(energycomp < 0) {
283  switch(decision->GetSelectionCuts()->GetSelectionMethod()){
284  case PWG::EMCAL::AliEmcalTriggerSelectionCuts::kADC: energycomp = 0; break;
287  }
288  }
289  }
290  }
291  }
292 
293  auto supportedTriggers = GetSupportedTriggers(fUseExclusiveTriggers);
294  Double_t energy, et, eta, phi;
295  const TList *selpatches(nullptr);
296  AliVCluster *maxcluster = nullptr;
297  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
298  //AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
299  if(!clust->IsEMCAL()) continue;
300  if(clust->GetIsExotic()) continue;
301  if(!fClusterTimeRange.IsInRange(clust->GetTOF())) continue;
302  if(!maxcluster || clust->E() > maxcluster->E()) maxcluster = clust;
303 
304  // Distinguish energy definition
305  switch(fEnergyDefinition){
306  case kDefaultEnergy:
307  AliDebugStream(2) << GetName() << ": Using cluster energy definition: default" << std::endl;
308  energy = clust->E();
309  break;
310  case kNonLinCorrEnergy:
311  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for non-linearity" << std::endl;
312  energy = clust->GetNonLinCorrEnergy();
313  break;
314  case kHadCorrEnergy:
315  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for hadronic contribution" << std::endl;
316  energy = clust->GetHadCorrEnergy();
317  break;
318  };
319 
320  AliDebugStream(2) << GetName() << ": Using energy " << energy << " (def: " << clust->E()
321  << " | NL: " << clust->GetNonLinCorrEnergy()
322  << " | HD: " << clust->GetHadCorrEnergy()
323  << ")" << std::endl;
324 
325  TLorentzVector posvec;
326  clust->GetMomentum(posvec, fVertex);
327  posvec.SetE(energy); // use energy definition as selected in the task
328  eta = posvec.Eta();
329  phi = posvec.Phi();
330  if(phi < 0) phi += TMath::TwoPi();
331 
332  // fill histograms allEta
333  for(const auto & trg : fSelectedTriggers){
334  if(std::find(supportedTriggers.begin(), supportedTriggers.end(), trg) == supportedTriggers.end()) continue;
335  selpatches = nullptr;
336  for(auto t : l1triggers) {
337  if(trg.Contains(t)) {
338  auto patchdata = patchhandlers.find(t);
339  if(patchdata != patchhandlers.end()){
340  selpatches = patchdata->second;
341  }
342  }
343  }
344  for(auto trgclust : fTriggerClusters) {
345  FillClusterHistograms(trg.Data(), energy, eta, phi, clust->GetTOF(), clust->GetNCells(), trgclust, selpatches, energycomp);
346  }
347  }
348  }
349 
350  // Fill max cluster histogram
351  // in case not found fill also 0
352  double maxpointFull[6] = {-1, fEventCentrality, 0, -1. -1., 0};
353  if(maxcluster) {
354  maxpointFull[2] = maxcluster->E();
355  TLorentzVector maxvector;
356  maxcluster->GetMomentum(maxvector, fVertex);
357  maxpointFull[3] = maxvector.Eta();
358  maxpointFull[4] = maxvector.Phi();
359  if(maxpointFull[4] < 0) maxpointFull[4] += TMath::TwoPi();
360  Int_t supermoduleID = -1;
361  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
362  maxpointFull[0] = supermoduleID;
363  }
364  std::vector<double> maxpoint = {maxpointFull[0], maxpointFull[1], maxpointFull[2]};
365  if(fMonitorEtaPhi) {
366  maxpoint.push_back(maxpointFull[3]);
367  maxpoint.push_back(maxpointFull[4]);
368  }
369  maxpoint.push_back(maxpointFull[5]);
370  for(const auto & trg : fSelectedTriggers){
371  if(std::find(supportedTriggers.begin(), supportedTriggers.end(), trg) == supportedTriggers.end()) continue;
372  auto weight = GetTriggerWeight(trg);
373  for(auto trgclust : fTriggerClusters) {
374  maxpoint[5] = trgclust;
375  fHistos->FillTHnSparse("hClusterTHnSparseMax" + trg, maxpoint.data(), weight);
376  }
377  }
378  return true;
379 }
380 
381 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(const TString &triggerclass, double energy, double eta, double phi, double clustertime, int ncell, int trgcluster, const TList *triggerPatches, int energycomp){
382  std::vector<AliEMCALTriggerPatchInfo *> matchedPatches;
383  if(fUseFiredTriggers && triggerPatches) {
384  matchedPatches = CorrelateToTrigger(eta, phi, *triggerPatches);
385  }
386  auto hasTriggerPatch = matchedPatches.size() > 0;
387  Int_t supermoduleID = -1;
388  Double_t weight = GetTriggerWeight(triggerclass);
389  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << std::endl;
390 
391  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
392  std::vector<double> point;
393  point.push_back(static_cast<double>(supermoduleID));
394  point.push_back(fEventCentrality);
395  point.push_back(energy);
396  if(fMonitorEtaPhi){
397  point.push_back(eta);
398  point.push_back(phi);
399  }
400  point.push_back(static_cast<double>(trgcluster));
401  fHistos->FillTHnSparse("hClusterTHnSparseAll" + triggerclass, point.data(), weight);
402 
403  fHistos->FillTH2("hTimeEnergy" + triggerclass, clustertime, energy, weight);
404  fHistos->FillTH2("hNCellEnergy" + triggerclass, ncell, energy, weight);
405  if(fUseFiredTriggers && hasTriggerPatch){
406  // find maximum trigger patch
407  AliEMCALTriggerPatchInfo *maxpatch(nullptr);
408  double maxenergy = 0;
409  for(auto patch : matchedPatches) {
410  double patche = 0;
411  switch(energycomp){
412  case 0: patche = patch->GetADCAmp(); break;
413  case 1: patche = patch->GetPatchE(); break;
414  case 2: patche = patch->GetSmearedEnergy(); break;
415  };
416  if(patche > maxenergy) {
417  maxpatch = patch;
418  maxenergy = patche;
419  }
420  }
421  fHistos->FillTH2("hCorrClusterEPatchADC" + triggerclass, energy, maxpatch->GetADCAmp());
422  fHistos->FillTH2("hCorrClusterEPatchE" + triggerclass, energy, maxpatch->GetPatchE());
423  fHistos->FillTHnSparse("hClusterTHnSparseFired" + triggerclass, point.data(), weight);
424  }
425 }
426 
428  double v0amult = fInputEvent->GetVZEROData()->GetMTotV0A(),
429  trackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 0., TMath::TwoPi())),
430  emctrackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 1.4, TMath::Pi())),
431  itsclustermult = fInputEvent->GetMultiplicity()->GetNumberOfSPDClusters(),
432  emcclustermult = static_cast<double>(CountEmcalClusters(0.5)),
433  emccellocc = static_cast<double>(this->GetEMCALCellOccupancy(0.1));
434 
435  auto supportedTriggers = GetSupportedTriggers(fUseExclusiveTriggers);
436 
437  for(const auto &t : fSelectedTriggers){
438  if(std::find(supportedTriggers.begin(), supportedTriggers.end(), t) == supportedTriggers.end()) continue;
439  Double_t weight = GetTriggerWeight(t);
440  fHistos->FillTH1("hEventCentrality" + t, fEventCentrality, weight);
441  fHistos->FillTH1("hVertexZ" + t, fVertex[2], weight);
442 
443  for(auto trgclust : fTriggerClusters){
444  fHistos->FillTH1("hTrgClustCounter" + t, static_cast<double>(trgclust), weight);
445  }
446 
447  // Multiplicity correlation (no correction for downscaling)
449  double data[6] = {v0amult, trackletmult, emctrackletmult, itsclustermult, emcclustermult, emccellocc};
450  fHistos->FillTHnSparse("hMultiplicityCorrelation" + t, data);
451  }
452  }
453 }
454 
455 std::vector<AliEMCALTriggerPatchInfo *> AliAnalysisTaskEmcalClustersRef::CorrelateToTrigger(Double_t etaclust, Double_t phiclust, const TList &triggerPatches) const {
456  std::vector<AliEMCALTriggerPatchInfo *> foundpatches;
457  for(auto patchIter : triggerPatches){
458  Double_t boundaries[4];
459  auto testpatch = static_cast<AliEMCALTriggerPatchInfo *>(patchIter);
460  GetPatchBoundaries(*testpatch, boundaries);
461  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
462  etamax = TMath::Max(boundaries[0], boundaries[1]),
463  phimin = TMath::Min(boundaries[2], boundaries[3]),
464  phimax = TMath::Max(boundaries[2], boundaries[3]);
465  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
466  foundpatches.push_back(testpatch);
467  break;
468  }
469  }
470  return foundpatches;
471 }
472 
473 void AliAnalysisTaskEmcalClustersRef::GetPatchBoundaries(AliEMCALTriggerPatchInfo &patch, Double_t *boundaries) const {
474  boundaries[0] = patch.GetEtaMin();
475  boundaries[1] = patch.GetEtaMax();
476  boundaries[2] = patch.GetPhiMin();
477  boundaries[3] = patch.GetPhiMax();
478 }
479 
481  int nclusters = 0;
482  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
483  if(!clust->IsEMCAL()) continue;
484  if(clust->GetIsExotic()) continue;
485  if(clust->E() > ecut) nclusters++;
486  nclusters++;
487  }
488  return nclusters;
489 }
490 
491 int AliAnalysisTaskEmcalClustersRef::CountTracklets(double etamin, double etamax, double phimin, double phimax){
492  int ntracklets = 0;
493  AliVMultiplicity *mult = fInputEvent->GetMultiplicity();
494  for(int itl = 0; itl < mult->GetNumberOfTracklets(); itl++){
495  double eta = mult->GetEta(itl), phi = mult->GetPhi(itl);
496  if(!(eta > etamin && eta < etamax)) continue;
497  if(!(phi > phimin && phi < phimax)) continue;
498  ntracklets++;
499  }
500  return ntracklets;
501 }
502 
504  std::set<int> cellIDs;
505  AliVCaloCells *emccells = fInputEvent->GetEMCALCells();
506  for(short icell = 0; icell < emccells->GetNumberOfCells(); icell++){
507  if(emccells->GetAmplitude(icell) > ecut){
508  int cellID = emccells->GetCellNumber(icell);
509  if(cellIDs.find(cellID) == cellIDs.end()) cellIDs.insert(cellID);
510  }
511  }
512  return cellIDs.size();
513 }
514 
516  if(fRequiredOverlaps.FindObject(trigger)) return;
517  fRequiredOverlaps.Add(new TObjString(trigger));
518 }
519 
521  if(fExcludedOverlaps.FindObject(trigger)) return;
522  fExcludedOverlaps.Add(new TObjString(trigger));
523 }
524 
526  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
527 
528  //-------------------------------------------------------
529  // Init the task and do settings
530  //-------------------------------------------------------
531 
532  TString clusName(nclusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nclusters);
533 
534  TString taskname = "emcalClusterQA_" + suffix;
535 
537  task->AddClusterContainer(clusName);
538  task->SetClusterContainer(clusName);
539  mgr->AddTask(task);
540 
541  TString outfile(mgr->GetCommonFileName());
542  outfile += ":ClusterQA_" + TString(suffix);
543  TString containername = "ClusterResults_" + TString(suffix);
544  printf("Outfile: %s, container: %s\n", outfile.Data(), containername.Data());
545 
546  task->ConnectInput(0, mgr->GetCommonInputContainer());
547  mgr->ConnectOutput(task, 1, mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
548 
549  return task;
550 }
551 
553  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
554 
556  mgr->AddTask(task);
557 
558  // Adding cluster container
559  TString clusName(nClusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nClusters);
560  task->AddClusterContainer(clusName.Data());
561  task->SetClusterContainer(clusName);
562 
563  // Set Energy thresholds for additional patch selection:
564  // These are events with offline patches of a given type where the trigger reached already the plateau
565  // These numers are determined as:
566  // EMC7: 3.5 GeV
567  // EG1: 14 GeV
568  // EG2: 8 GeV
569  // EJ1: 22 GeV
570  // EJ2: 12 GeV
573  );
574 
575  TString outfile(mgr->GetCommonFileName());
576  outfile += ":ClusterQA";
577 
578  task->ConnectInput(0, mgr->GetCommonInputContainer());
579  mgr->ConnectOutput(task, 1, mgr->CreateContainer("ClusterResults", AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
580 
581  return task;
582 }
583 
584 
590 {
591  this->SetMinimum(0.);
592  this->AddStep(1, 0.05);
593  this->AddStep(2, 0.1);
594  this->AddStep(4, 0.2);
595  this->AddStep(7, 0.5);
596  this->AddStep(16, 1);
597  this->AddStep(32, 2);
598  this->AddStep(40, 4);
599  this->AddStep(50, 5);
600  this->AddStep(100, 10);
601  this->AddStep(200, 20);
602 }
603 
604 
605 } /* namespace EMCalTriggerPtAnalysis */
AliCutValueRange< double > fClusterTimeRange
Selected range on cluster time.
std::vector< TString > fSelectedTriggers
! Triggers selected for given event
double Double_t
Definition: External.C:58
Class creating a linear binning, used in the histogram manager.
TObjArray fRequiredOverlaps
Add option to require overlap with certain triggers.
void AddExcludedTriggerOverlap(const char *trigger)
Add trigger for which overlap is excluded.
energy
Definition: HFPtSpectrum.C:45
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
TObjArray fExcludedOverlaps
Add option to exclude overlap with certain triggers.
virtual bool IsUserEventSelected()
User event selection: Select event in maching centrality range (if requested)
Simple monitoring task for cluster-related quantities in EMCAL-triggered events.
Bool_t fRequestCentrality
Switch on request for centrality range.
static std::vector< PWG::EMCAL::Triggerinfo > DecodeTriggerString(EMCAL_STRINGVIEW triggerstring)
Decoding trigger string.
void AddStep(Double_t max, Double_t binwidth)
Interface for binnings used by the histogram handler.
Definition: TBinning.h:23
void SetOfflineTriggerSelection(AliEmcalTriggerOfflineSelection *sel)
Set an offline trigger selection.
void AddRequiredTriggerOverlap(const char *trigger)
Add trigger for which overlap is required.
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
Bool_t fDoFillMultiplicityHistograms
Swich for multiplcity histograms.
std::vector< TriggerCluster_t > fTriggerClusters
! Detected trigger clusters for event
void FillClusterHistograms(const TString &triggerclass, double energy, double eta, double phi, double clustertime, int ncell, int trgcluster, const TList *triggerpatches, int energycomp)
std::vector< AliEMCALTriggerPatchInfo * > CorrelateToTrigger(Double_t etaclust, Double_t phiclust, const TList &triggerpatches) const
Check whether cluster is inside a trigger patch which has fired the trigger.
const Double_t etamin
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="")
Create a new TH2 within the container.
int Int_t
Definition: External.C:63
TString fNameClusterContainer
Name of the cluster container in the event.
AliEMCALGeometry * fGeom
!emcal geometry
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
Helper class creating user defined custom binning.
static AliAnalysisTaskEmcalClustersRef * AddTaskEmcalClustersRef(const TString &nClusters="usedefault", const TString &suffix="")
Preconfigure task so that it can be used in subwagons.
Bool_t fMonitorEtaPhi
Add dimensions for eta-phi in the THnSparses.
int CountTracklets(double etamin, double etamax, double phimin, double phimax)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
TString fCentralityEstimator
Centrality estimator (default: V0M for PbPb)
Bool_t fUseExclusiveTriggers
Include exclusive triggers (without lower threshold triggers)
static AliAnalysisTaskEmcalClustersRef * AddTaskEmcalClustersRefDefault(const TString &nClusters="usedefault")
Preconfigure task and add it to the analysis manager.
Analysis of high- tracks in triggered events.
Double_t fVertex[3]
!event vertex
AliCutValueRange< double > fCentralityRange
Selected centrality range.
const Double_t etamax
EnergyDefinition_t fEnergyDefinition
Energy definition used for a given cluster.
bool Bool_t
Definition: External.C:53
virtual void CreateUserHistos()
Creating histograms for the distributions monitored by the task.
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
std::vector< TString > GetSupportedTriggers(Bool_t useExclusiveTriggers=true) const
void GetPatchBoundaries(AliEMCALTriggerPatchInfo &o, Double_t *boundaries) const
Get the boundaries of the trigger patch.
Bool_t fUseFiredTriggers
Study clusters connected with patches.
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.
const Double_t phimin
void SetMinimum(Double_t min)
static TString ClusterContainerNameFactory(Bool_t isAOD)
Get name of the default cluster container.