AliPhysics  d9e9949 (d9e9949)
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  fClusterTimeRange(-50e-6, 50e-6),
90  fTriggerClusters(),
91  fRequiredOverlaps(),
92  fExcludedOverlaps()
93 {
94 }
95 
98  fCentralityRange(-999., 999.),
99  fRequestCentrality(false),
100  fEventCentrality(-1),
101  fCentralityEstimator("V0M"),
104  fEnableSumw2(false),
106  fUseFiredTriggers(false),
107  fUseExclusiveTriggers(true),
108  fFillTriggerClusters(true),
109  fClusterTimeRange(-50e-6, 50e-6),
113 {
114 }
115 
117 }
118 
119 
121 
122  EnergyBinning energybinning;
123  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);
124  TLinearBinning trgclustbinning(kTrgClusterN, -0.5, kTrgClusterN - 0.5);
125  TString optionstring = fEnableSumw2 ? "s" : "";
126 
127  /*
128  * Exclusive classes are defined as triggered events
129  * in a class without lower threshold classes firing.
130  * This is needed to make the triggers statistically
131  * independent.
132  */
133 
134  // Binnings for Multiplicity correlation
135  TLinearBinning v0abinning(1000, 0., 1000.), centralitybinning(100, 0., 100.), trackletbinning(500, 0., 500.), itsclustbinning(500, 0., 500.),
136  emcclustbinning(100, 0., 100.), emccellbinning(3000, 0., 3000.), adcbinning(2000, 0., 2000.);
137  const TBinning *multbinning[6] = {&v0abinning, &trackletbinning, &trackletbinning, &itsclustbinning, &emcclustbinning, &emccellbinning};
138  const TBinning *clustallbinning[6] = {&smbinning, &centralitybinning, &energybinning, &etabinning, &phibinning, &trgclustbinning};
139  AliDebugStream(1) << "Using exclusive triggers: " << (fUseExclusiveTriggers ? "yes" : "no") << std::endl;
141  AliDebugStream(1) << "Creating histograms for trigger " << trg << std::endl;
142  fHistos->CreateTH1("hTrgClustCounter" + trg, "Event counter in trigger cluster " + trg, trgclustbinning);
143  fHistos->CreateTH1("hEventCentrality" + trg, "Event centrality for trigger class " + trg, 103, -2., 101., optionstring);
144  fHistos->CreateTH1("hVertexZ" + trg, "z-position of the primary vertex for trigger class " + trg, 200, -40., 40., optionstring);
145  if(this->fDoFillMultiplicityHistograms) fHistos->CreateTHnSparse("hMultiplicityCorrelation" + trg, "Multiplicity correlation for trigger" + trg, 6, multbinning);
146  fHistos->CreateTHnSparse("hClusterTHnSparseAll" + trg, "Cluster THnSparse (all) for trigger" + trg, 6, clustallbinning);
147  fHistos->CreateTHnSparse("hClusterTHnSparseMax" + trg, "Cluster THnSparse (max) for trigger" + trg, 6, clustallbinning);
148  if(fUseFiredTriggers) fHistos->CreateTHnSparse("hClusterTHnSparseFired" + trg, "Cluster THnSparse (firing) for trigger" + trg, 6, clustallbinning);
149  fHistos->CreateTH2("hTimeEnergy" + trg, "Cluster time vs. energy for trigger class " + trg, timebinning, energybinning, optionstring);
150  fHistos->CreateTH2("hNCellEnergy" + trg, "Cluster number of cells vs energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
151  if(fUseFiredTriggers){
152  fHistos->CreateTH2("hCorrClusterEPatchADC" + trg, "Correlation between cluster E and patch ADC for trigger " + trg, energybinning, adcbinning);
153  fHistos->CreateTH2("hCorrClusterEPatchE" + trg, "Correlation between cluster E and patch E for trigger " + trg, energybinning, energybinning);
154  }
155  }
156 }
157 
159  fEventCentrality = 99; // without centrality put everything in the peripheral bin
160  if(fRequestCentrality){
161  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
162  if(!mult){
163  AliErrorStream() << GetName() << ": Centrality selection enabled but no centrality estimator found" << std::endl;
164  return false;
165  }
166  //if(mult->IsEventSelected()) return false;
167  fEventCentrality = mult->GetEstimator(fCentralityEstimator)->GetPercentile();
168  AliDebugStream(1) << GetName() << ": Centrality " << fEventCentrality << std::endl;
170  AliDebugStream(1) << GetName() << ": reject centrality: " << fEventCentrality << std::endl;
171  return false;
172  } else {
173  AliDebugStream(1) << GetName() << ": select centrality " << fEventCentrality << std::endl;
174  }
175  } else {
176  AliDebugStream(1) << GetName() << ": No centrality selection applied" << std::endl;
177  }
178 
179  if(fBunchCrossingIndex > -1){
180  int bcindex = fInputEvent->GetHeader()->GetBunchCrossNumber() % 4;
181  if(bcindex != fBunchCrossingIndex) return false;
182  }
183 
184  // handle overlaps
185  if(fRequiredOverlaps.GetEntries() || fExcludedOverlaps.GetEntries()){
186  if(fRequiredOverlaps.GetEntries()){
187  Bool_t allFound(true);
188  for(auto t : fRequiredOverlaps){
189  auto trgstr = static_cast<TObjString *>(t)->String();
190  if(std::find_if(fSelectedTriggers.begin(), fSelectedTriggers.end(), [&trgstr](const TString &seltrigger) -> bool { return seltrigger.Contains(trgstr); }) == fSelectedTriggers.end()) {
191  allFound = false;
192  break;
193  }
194  }
195  if(!allFound) return false;
196  }
197 
198  if(fExcludedOverlaps.GetEntries()){
199  Bool_t oneFound(false);
200  for(auto t : fExcludedOverlaps){
201  auto trgstr = static_cast<TObjString *>(t)->String();
202  if(std::find_if(fSelectedTriggers.begin(), fSelectedTriggers.end(), [&trgstr](const TString &seltrigger) -> bool { return seltrigger.Contains(trgstr); }) != fSelectedTriggers.end()) {
203  oneFound = true;
204  break;
205  }
206  }
207  if(oneFound) return false;
208  }
209  }
210 
211  // determine trigger clusters (ANY - 0 always included)
212  // Only meaningfull in data
213  fTriggerClusters.clear();
214  fTriggerClusters.emplace_back(kTrgClusterANY);
216  Bool_t isCENT(false), isCENTNOTRD(false), isCALO(false), isCALOFAST(false);
217  for(auto trg : PWG::EMCAL::Triggerinfo::DecodeTriggerString(fInputEvent->GetFiredTriggerClasses().Data())){
218  auto trgclust = trg.Triggercluster();
219  if(trgclust == "CENT" && !isCENT){
220  isCENT = true;
221  fTriggerClusters.emplace_back(kTrgClusterCENT);
222  }
223  if(trgclust == "CENTNOTRD" && ! isCENTNOTRD){
224  isCENTNOTRD = true;
226  }
227  if(trgclust == "CALO" && !isCALO){
228  isCALO = true;
229  fTriggerClusters.emplace_back(kTrgClusterCALO);
230  }
231  if(trgclust == "CALOFAST" && ! isCALOFAST) {
232  isCALOFAST = true;
233  fTriggerClusters.emplace_back();
234  }
235  }
236  // Mixed clusters
237  if(isCENT || isCENTNOTRD) {
238  if(isCENT) {
239  if(isCENTNOTRD) fTriggerClusters.emplace_back(kTrgClusterCENTBOTH);
240  else fTriggerClusters.emplace_back(kTrgClusterOnlyCENT);
241  } else fTriggerClusters.emplace_back(kTrgClusterOnlyCENTNOTRD);
242  }
243  if(isCALO || isCALOFAST){
244  if(isCALO) {
245  if(isCALOFAST) fTriggerClusters.emplace_back(kTrgClusterCALOBOTH);
246  else fTriggerClusters.emplace_back(kTrgClusterOnlyCALO);
247  } else fTriggerClusters.emplace_back(kTrgClusterOnlyCALOFAST);
248  }
249  }
250 
251  return true;
252 }
253 
255  AliDebugStream(1) << GetName() << ": UserExec start" << std::endl;
256 
257  std::map<TString, const TList *> patchhandlers;
258  const std::vector<TString> l1triggers = {"EJ1", "EJ2", "EG1", "EG2", "DJ1", "DJ2", "DG1", "DG2"};
259  int energycomp = -1;
260  // get fired trigger patches from the trigger selection task
261  if(auto trgsel = static_cast<PWG::EMCAL::AliEmcalTriggerDecisionContainer *>(fInputEvent->FindListObject("EmcalTriggerDecision"))){
262  /*
263  for(auto t : *(trgsel->GetListOfTriggerDecisions())){
264  auto dec = static_cast<PWG::EMCAL::AliEmcalTriggerDecision *>(t);
265  std::cout << "Found trigger decision " << dec->GetName() << std::endl;
266  }
267  */
268  for(auto t : l1triggers){
269  auto decision = trgsel->FindTriggerDecision(t.Data());
270  if(decision){
271  patchhandlers[t] = decision->GetAcceptedPatches();
272  if(energycomp < 0) {
273  switch(decision->GetSelectionCuts()->GetSelectionMethod()){
274  case PWG::EMCAL::AliEmcalTriggerSelectionCuts::kADC: energycomp = 0; break;
277  }
278  }
279  }
280  }
281  }
282 
283  auto supportedTriggers = GetSupportedTriggers(fUseExclusiveTriggers);
284  Double_t energy, et, eta, phi;
285  const TList *selpatches(nullptr);
286  AliVCluster *maxcluster = nullptr;
287  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
288  //AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
289  if(!clust->IsEMCAL()) continue;
290  if(clust->GetIsExotic()) continue;
291  if(!fClusterTimeRange.IsInRange(clust->GetTOF())) continue;
292  if(!maxcluster || clust->E() > maxcluster->E()) maxcluster = clust;
293 
294  // Distinguish energy definition
295  switch(fEnergyDefinition){
296  case kDefaultEnergy:
297  AliDebugStream(2) << GetName() << ": Using cluster energy definition: default" << std::endl;
298  energy = clust->E();
299  break;
300  case kNonLinCorrEnergy:
301  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for non-linearity" << std::endl;
302  energy = clust->GetNonLinCorrEnergy();
303  break;
304  case kHadCorrEnergy:
305  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for hadronic contribution" << std::endl;
306  energy = clust->GetHadCorrEnergy();
307  break;
308  };
309 
310  AliDebugStream(2) << GetName() << ": Using energy " << energy << " (def: " << clust->E()
311  << " | NL: " << clust->GetNonLinCorrEnergy()
312  << " | HD: " << clust->GetHadCorrEnergy()
313  << ")" << std::endl;
314 
315  TLorentzVector posvec;
316  clust->GetMomentum(posvec, fVertex);
317  posvec.SetE(energy); // use energy definition as selected in the task
318  eta = posvec.Eta();
319  phi = posvec.Phi();
320  if(phi < 0) phi += TMath::TwoPi();
321 
322  // fill histograms allEta
323  for(const auto & trg : fSelectedTriggers){
324  if(std::find(supportedTriggers.begin(), supportedTriggers.end(), trg) == supportedTriggers.end()) continue;
325  selpatches = nullptr;
326  for(auto t : l1triggers) {
327  if(trg.Contains(t)) {
328  auto patchdata = patchhandlers.find(t);
329  if(patchdata != patchhandlers.end()){
330  selpatches = patchdata->second;
331  }
332  }
333  }
334  for(auto trgclust : fTriggerClusters) {
335  FillClusterHistograms(trg.Data(), energy, eta, phi, clust->GetTOF(), clust->GetNCells(), trgclust, selpatches, energycomp);
336  }
337  }
338  }
339 
340  // Fill max cluster histogram
341  // in case not found fill also 0
342  double maxpoint[6] = {-1, fEventCentrality, 0, -1. -1., 0};
343  if(maxcluster) {
344  maxpoint[2] = maxcluster->E();
345  TLorentzVector maxvector;
346  maxcluster->GetMomentum(maxvector, fVertex);
347  maxpoint[3] = maxvector.Eta();
348  maxpoint[4] = maxvector.Phi();
349  if(maxpoint[4] < 0) maxpoint[4] += TMath::TwoPi();
350  Int_t supermoduleID = -1;
351  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
352  maxpoint[0] = supermoduleID;
353  }
354  for(const auto & trg : fSelectedTriggers){
355  auto weight = GetTriggerWeight(trg);
356  for(auto trgclust : fTriggerClusters) {
357  maxpoint[5] = trgclust;
358  fHistos->FillTHnSparse("hClusterTHnSparseMax" + trg, maxpoint, weight);
359  }
360  }
361  return true;
362 }
363 
364 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(const TString &triggerclass, double energy, double eta, double phi, double clustertime, int ncell, int trgcluster, const TList *triggerPatches, int energycomp){
365  std::vector<AliEMCALTriggerPatchInfo *> matchedPatches;
366  if(fUseFiredTriggers && triggerPatches) {
367  matchedPatches = CorrelateToTrigger(eta, phi, *triggerPatches);
368  }
369  auto hasTriggerPatch = matchedPatches.size() > 0;
370  Int_t supermoduleID = -1;
371  Double_t weight = GetTriggerWeight(triggerclass);
372  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << std::endl;
373 
374  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
375  double point[6] = {static_cast<double>(supermoduleID), fEventCentrality, energy, eta, phi, static_cast<double>(trgcluster)};
376  fHistos->FillTHnSparse("hClusterTHnSparseAll" + triggerclass, point, weight);
377 
378  fHistos->FillTH2("hTimeEnergy" + triggerclass, clustertime, energy, weight);
379  fHistos->FillTH2("hNCellEnergy" + triggerclass, ncell, energy, weight);
380  if(fUseFiredTriggers && hasTriggerPatch){
381  // find maximum trigger patch
382  AliEMCALTriggerPatchInfo *maxpatch(nullptr);
383  double maxenergy = 0;
384  for(auto patch : matchedPatches) {
385  double patche = 0;
386  switch(energycomp){
387  case 0: patche = patch->GetADCAmp(); break;
388  case 1: patche = patch->GetPatchE(); break;
389  case 2: patche = patch->GetSmearedEnergy(); break;
390  };
391  if(patche > maxenergy) {
392  maxpatch = patch;
393  maxenergy = patche;
394  }
395  }
396  fHistos->FillTH2("hCorrClusterEPatchADC" + triggerclass, energy, maxpatch->GetADCAmp());
397  fHistos->FillTH2("hCorrClusterEPatchE" + triggerclass, energy, maxpatch->GetPatchE());
398  fHistos->FillTHnSparse("hClusterTHnSparseFired" + triggerclass, point, weight);
399  }
400 }
401 
403  double v0amult = fInputEvent->GetVZEROData()->GetMTotV0A(),
404  trackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 0., TMath::TwoPi())),
405  emctrackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 1.4, TMath::Pi())),
406  itsclustermult = fInputEvent->GetMultiplicity()->GetNumberOfSPDClusters(),
407  emcclustermult = static_cast<double>(CountEmcalClusters(0.5)),
408  emccellocc = static_cast<double>(this->GetEMCALCellOccupancy(0.1));
409 
410  auto supportedTriggers = GetSupportedTriggers(fUseExclusiveTriggers);
411 
412  for(const auto &t : fSelectedTriggers){
413  if(std::find(supportedTriggers.begin(), supportedTriggers.end(), t) == supportedTriggers.end()) continue;
414  Double_t weight = GetTriggerWeight(t);
415  fHistos->FillTH1("hEventCentrality" + t, fEventCentrality, weight);
416  fHistos->FillTH1("hVertexZ" + t, fVertex[2], weight);
417 
418  for(auto trgclust : fTriggerClusters){
419  fHistos->FillTH1("hTrgClustCounter" + t, static_cast<double>(trgclust), weight);
420  }
421 
422  // Multiplicity correlation (no correction for downscaling)
424  double data[6] = {v0amult, trackletmult, emctrackletmult, itsclustermult, emcclustermult, emccellocc};
425  fHistos->FillTHnSparse("hMultiplicityCorrelation" + t, data);
426  }
427  }
428 }
429 
430 std::vector<AliEMCALTriggerPatchInfo *> AliAnalysisTaskEmcalClustersRef::CorrelateToTrigger(Double_t etaclust, Double_t phiclust, const TList &triggerPatches) const {
431  std::vector<AliEMCALTriggerPatchInfo *> foundpatches;
432  for(auto patchIter : triggerPatches){
433  Double_t boundaries[4];
434  auto testpatch = static_cast<AliEMCALTriggerPatchInfo *>(patchIter);
435  GetPatchBoundaries(*testpatch, boundaries);
436  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
437  etamax = TMath::Max(boundaries[0], boundaries[1]),
438  phimin = TMath::Min(boundaries[2], boundaries[3]),
439  phimax = TMath::Max(boundaries[2], boundaries[3]);
440  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
441  foundpatches.push_back(testpatch);
442  break;
443  }
444  }
445  return foundpatches;
446 }
447 
448 void AliAnalysisTaskEmcalClustersRef::GetPatchBoundaries(AliEMCALTriggerPatchInfo &patch, Double_t *boundaries) const {
449  boundaries[0] = patch.GetEtaMin();
450  boundaries[1] = patch.GetEtaMax();
451  boundaries[2] = patch.GetPhiMin();
452  boundaries[3] = patch.GetPhiMax();
453 }
454 
456  int nclusters = 0;
457  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
458  if(!clust->IsEMCAL()) continue;
459  if(clust->GetIsExotic()) continue;
460  if(clust->E() > ecut) nclusters++;
461  nclusters++;
462  }
463  return nclusters;
464 }
465 
466 int AliAnalysisTaskEmcalClustersRef::CountTracklets(double etamin, double etamax, double phimin, double phimax){
467  int ntracklets = 0;
468  AliVMultiplicity *mult = fInputEvent->GetMultiplicity();
469  for(int itl = 0; itl < mult->GetNumberOfTracklets(); itl++){
470  double eta = mult->GetEta(itl), phi = mult->GetPhi(itl);
471  if(!(eta > etamin && eta < etamax)) continue;
472  if(!(phi > phimin && phi < phimax)) continue;
473  ntracklets++;
474  }
475  return ntracklets;
476 }
477 
479  std::set<int> cellIDs;
480  AliVCaloCells *emccells = fInputEvent->GetEMCALCells();
481  for(short icell = 0; icell < emccells->GetNumberOfCells(); icell++){
482  if(emccells->GetAmplitude(icell) > ecut){
483  int cellID = emccells->GetCellNumber(icell);
484  if(cellIDs.find(cellID) == cellIDs.end()) cellIDs.insert(cellID);
485  }
486  }
487  return cellIDs.size();
488 }
489 
491  if(fRequiredOverlaps.FindObject(trigger)) return;
492  fRequiredOverlaps.Add(new TObjString(trigger));
493 }
494 
496  if(fExcludedOverlaps.FindObject(trigger)) return;
497  fExcludedOverlaps.Add(new TObjString(trigger));
498 }
499 
501  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
502 
503  //-------------------------------------------------------
504  // Init the task and do settings
505  //-------------------------------------------------------
506 
507  TString clusName(nclusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nclusters);
508 
509  TString taskname = "emcalClusterQA_" + suffix;
510 
512  task->AddClusterContainer(clusName);
513  task->SetClusterContainer(clusName);
514  mgr->AddTask(task);
515 
516  TString outfile(mgr->GetCommonFileName());
517  outfile += ":ClusterQA_" + TString(suffix);
518  TString containername = "ClusterResults_" + TString(suffix);
519  printf("Outfile: %s, container: %s\n", outfile.Data(), containername.Data());
520 
521  task->ConnectInput(0, mgr->GetCommonInputContainer());
522  mgr->ConnectOutput(task, 1, mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
523 
524  return task;
525 }
526 
528  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
529 
531  mgr->AddTask(task);
532 
533  // Adding cluster container
534  TString clusName(nClusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nClusters);
535  task->AddClusterContainer(clusName.Data());
536  task->SetClusterContainer(clusName);
537 
538  // Set Energy thresholds for additional patch selection:
539  // These are events with offline patches of a given type where the trigger reached already the plateau
540  // These numers are determined as:
541  // EMC7: 3.5 GeV
542  // EG1: 14 GeV
543  // EG2: 8 GeV
544  // EJ1: 22 GeV
545  // EJ2: 12 GeV
548  );
549 
550  TString outfile(mgr->GetCommonFileName());
551  outfile += ":ClusterQA";
552 
553  task->ConnectInput(0, mgr->GetCommonInputContainer());
554  mgr->ConnectOutput(task, 1, mgr->CreateContainer("ClusterResults", AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
555 
556  return task;
557 }
558 
559 
565 {
566  this->SetMinimum(0.);
567  this->AddStep(1, 0.05);
568  this->AddStep(2, 0.1);
569  this->AddStep(4, 0.2);
570  this->AddStep(7, 0.5);
571  this->AddStep(16, 1);
572  this->AddStep(32, 2);
573  this->AddStep(40, 4);
574  this->AddStep(50, 5);
575  this->AddStep(100, 10);
576  this->AddStep(200, 20);
577 }
578 
579 
580 } /* 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:44
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.
void AddStep(Double_t max, Double_t binwidth)
Interface for binnings used by the histogram handler.
Definition: TBinning.h:21
static std::vector< PWG::EMCAL::Triggerinfo > DecodeTriggerString(const std::string &triggerstring)
Decoding trigger string.
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.
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.