AliPhysics  05c4c93 (05c4c93)
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 <TObjArray.h>
42 #include <TParameter.h>
43 #include <TMath.h>
44 
45 #include "AliAnalysisManager.h"
46 #include "AliAnalysisUtils.h"
47 #include "AliClusterContainer.h"
49 #include "AliEMCALGeometry.h"
50 #include "AliEmcalList.h"
51 #include "AliEMCALTriggerPatchInfo.h"
56 #include "AliESDEvent.h"
57 #include "AliInputEventHandler.h"
58 #include "AliLog.h"
59 #include "AliMultSelection.h"
60 #include "AliMultEstimator.h"
61 #include "AliVCluster.h"
62 #include "AliVEvent.h"
63 #include "AliVEventHandler.h"
64 #include "AliVVertex.h"
65 
67 
71 
72 namespace EMCalTriggerPtAnalysis {
73 
74 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
76  fCentralityRange(-999., 999.),
77  fRequestCentrality(false),
78  fEventCentrality(-1),
79  fCentralityEstimator("V0M"),
80  fBunchCrossingIndex(-1),
81  fEnergyDefinition(kDefaultEnergy),
82  fEnableSumw2(false),
83  fDoFillMultiplicityHistograms(false),
84  fUseExclusiveTriggers(true),
85  fClusterTimeRange(-50e-6, 50e-6)
86 {
87 }
88 
91  fCentralityRange(-999., 999.),
92  fRequestCentrality(false),
93  fEventCentrality(-1),
94  fCentralityEstimator("V0M"),
97  fEnableSumw2(false),
100  fClusterTimeRange(-50e-6, 50e-6)
101 {
102 }
103 
105 }
106 
107 
109 
110  EnergyBinning energybinning;
111  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);
112  TString optionstring = fEnableSumw2 ? "s" : "";
113 
114  /*
115  * Exclusive classes are defined as triggered events
116  * in a class without lower threshold classes firing.
117  * This is needed to make the triggers statistically
118  * independent.
119  */
120  std::array<Double_t, 5> encuts = {1., 2., 5., 10., 20.};
121  Int_t sectorsWithEMCAL[10] = {4, 5, 6, 7, 8, 9, 13, 14, 15, 16};
122 
123  // Binnings for Multiplicity correlation
124  TLinearBinning v0abinning(1000, 0., 1000.), trackletbinning(500, 0., 500.), itsclustbinning(500, 0., 500.), emcclustbinning(100, 0., 100.), emccellbinning(3000, 0., 3000.), adcbinning(2000, 0., 2000.);
125  const TBinning *multbinning[6] = {&v0abinning, &trackletbinning, &trackletbinning, &itsclustbinning, &emcclustbinning, &emccellbinning};
127  fHistos->CreateTH1("hEventCount" + trg, "Event count for trigger class " + trg, 1, 0.5, 1.5, optionstring);
128  fHistos->CreateTH1("hEventCentrality" + trg, "Event centrality for trigger class " + trg, 103, -2., 101., optionstring);
129  fHistos->CreateTH1("hVertexZ" + trg, "z-position of the primary vertex for trigger class " + trg, 200, -40., 40., optionstring);
130  if(this->fDoFillMultiplicityHistograms) fHistos->CreateTHnSparse("hMultiplicityCorrelation" + trg, "Multiplicity correlation for trigger" + trg, 6, multbinning);
131  fHistos->CreateTH1("hClusterEnergy" + trg, "Cluster energy for trigger class " + trg, energybinning, optionstring);
132  fHistos->CreateTH1("hClusterET" + trg, "Cluster transverse energy for trigger class " + trg, energybinning, optionstring);
133  fHistos->CreateTH1("hClusterEnergyFired" + trg, "Cluster energy for trigger class " + trg + ", firing the trigger", energybinning, optionstring);
134  fHistos->CreateTH1("hClusterETFired" + trg, "Cluster transverse energy for trigger class " + trg + ", firing the trigger" , energybinning, optionstring);
135  fHistos->CreateTH2("hClusterEnergySM" + trg, "Cluster energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
136  fHistos->CreateTH2("hClusterETSM" + trg, "Cluster transverse energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
137  fHistos->CreateTH2("hClusterEnergyFiredSM" + trg, "Cluster energy versus supermodule for trigger class " + trg + ", firing the trigger" , smbinning, energybinning, optionstring);
138  fHistos->CreateTH2("hClusterETFiredSM" + trg, "Cluster transverse energy versus supermodule for trigger class " + trg + ", firing the trigger" , smbinning, energybinning, optionstring);
139  fHistos->CreateTH2("hEtaEnergy" + trg, "Cluster energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
140  fHistos->CreateTH2("hEtaET" + trg, "Cluster transverse energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
141  fHistos->CreateTH2("hTimeEnergy" + trg, "Cluster time vs. energy for trigger class " + trg, timebinning, energybinning, optionstring);
142  fHistos->CreateTH2("hNCellEnergy" + trg, "Cluster number of cells vs energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
143  fHistos->CreateTH2("hNCellET" + trg, "Cluster number of cells vs transverse energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
144  fHistos->CreateTH2("hEtaEnergyFired" + trg, "Cluster energy vs. eta for trigger class " + trg + ", firing the trigger", etabinning, energybinning, optionstring);
145  fHistos->CreateTH2("hEtaETFired" + trg, "Cluster transverse energy vs. eta for trigger class " + trg + ", firing the trigger", etabinning, energybinning, optionstring);
146  fHistos->CreateTH2("hCorrClusterEPatchADC" + trg, "Correlation between cluster E and patch ADC for trigger " + trg, energybinning, adcbinning);
147  fHistos->CreateTH2("hCorrClusterEPatchE" + trg, "Correlation between cluster E and patch E for trigger " + trg, energybinning, energybinning);
148  for(int ism = 0; ism < 20; ism++){
149  fHistos->CreateTH2(TString::Format("hEtaEnergySM%d", ism) + trg, TString::Format("Cluster energy vs. eta in Supermodule %d for trigger ", ism) + trg, etabinning, energybinning, optionstring);
150  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);
151  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);
152  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);
153  }
154  for(int isec = 0; isec < 10; isec++){
155  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);
156  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);
157  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);
158  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);
159  }
160  for(auto ien : encuts){
161  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);
162  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);
163  }
164  }
165 }
166 
168  fEventCentrality = -1;
169  if(fRequestCentrality){
170  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
171  if(!mult){
172  AliErrorStream() << GetName() << ": Centrality selection enabled but no centrality estimator found" << std::endl;
173  return false;
174  }
175  if(mult->IsEventSelected()) return false;
176  fEventCentrality = mult->GetEstimator(fCentralityEstimator)->GetPercentile();
177  AliDebugStream(1) << GetName() << ": Centrality " << fEventCentrality << std::endl;
179  AliDebugStream(1) << GetName() << ": reject centrality: " << fEventCentrality << std::endl;
180  return false;
181  } else {
182  AliDebugStream(1) << GetName() << ": select centrality " << fEventCentrality << std::endl;
183  }
184  } else {
185  AliDebugStream(1) << GetName() << ": No centrality selection applied" << std::endl;
186  }
187 
188  if(fBunchCrossingIndex > -1){
189  int bcindex = fInputEvent->GetHeader()->GetBunchCrossNumber() % 4;
190  if(bcindex != fBunchCrossingIndex) return false;
191  }
192  return true;
193 }
194 
196  AliDebugStream(1) << GetName() << ": UserExec start" << std::endl;
197 
198  std::map<TString, const TList *> patchhandlers;
199  const std::vector<TString> l1triggers = {"EJ1", "EJ2", "EG1", "EG2", "DJ1", "DJ2", "DG1", "DG2"};
200  int energycomp = -1;
201  // get fired trigger patches from the trigger selection task
202  if(auto trgsel = static_cast<PWG::EMCAL::AliEmcalTriggerDecisionContainer *>(fInputEvent->FindListObject("EmcalTriggerDecision"))){
203  /*
204  for(auto t : *(trgsel->GetListOfTriggerDecisions())){
205  auto dec = static_cast<PWG::EMCAL::AliEmcalTriggerDecision *>(t);
206  std::cout << "Found trigger decision " << dec->GetName() << std::endl;
207  }
208  */
209  for(auto t : l1triggers){
210  auto decision = trgsel->FindTriggerDecision(t.Data());
211  if(decision){
212  patchhandlers[t] = decision->GetAcceptedPatches();
213  if(energycomp < 0) {
214  switch(decision->GetSelectionCuts()->GetSelectionMethod()){
215  case PWG::EMCAL::AliEmcalTriggerSelectionCuts::kADC: energycomp = 0; break;
218  }
219  }
220  }
221  }
222  }
223 
224  auto supportedTriggers = GetSupportedTriggers(fUseExclusiveTriggers);
225  Double_t energy, et, eta, phi;
226  const TList *selpatches(nullptr);
227  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
228  //AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
229  if(!clust->IsEMCAL()) continue;
230  if(clust->GetIsExotic()) continue;
231  if(!fClusterTimeRange.IsInRange(clust->GetTOF())) continue;
232 
233  // Distinguish energy definition
234  switch(fEnergyDefinition){
235  case kDefaultEnergy:
236  AliDebugStream(2) << GetName() << ": Using cluster energy definition: default" << std::endl;
237  energy = clust->E();
238  break;
239  case kNonLinCorrEnergy:
240  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for non-linearity" << std::endl;
241  energy = clust->GetNonLinCorrEnergy();
242  break;
243  case kHadCorrEnergy:
244  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for hadronic contribution" << std::endl;
245  energy = clust->GetHadCorrEnergy();
246  break;
247  };
248 
249  AliDebugStream(2) << GetName() << ": Using energy " << energy << " (def: " << clust->E()
250  << " | NL: " << clust->GetNonLinCorrEnergy()
251  << " | HD: " << clust->GetHadCorrEnergy()
252  << ")" << std::endl;
253 
254  TLorentzVector posvec;
255  clust->GetMomentum(posvec, fVertex);
256  posvec.SetE(energy); // use energy definition as selected in the task
257  et = posvec.Et();
258  eta = posvec.Eta();
259  phi = posvec.Phi();
260 
261  // fill histograms allEta
262  for(const auto & trg : fSelectedTriggers){
263  if(std::find(supportedTriggers.begin(), supportedTriggers.end(), trg) == supportedTriggers.end()) continue;
264  selpatches = nullptr;
265  for(auto t : l1triggers) {
266  if(trg.Contains(t)) {
267  auto patchdata = patchhandlers.find(t);
268  if(patchdata != patchhandlers.end()){
269  selpatches = patchdata->second;
270  }
271  }
272  }
273  FillClusterHistograms(trg.Data(), energy, et, eta, phi, clust->GetTOF(), clust->GetNCells(), selpatches, energycomp);
274  }
275  }
276  return true;
277 }
278 
279 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(const TString &triggerclass, double energy, double transverseenergy, double eta, double phi, double clustertime, int ncell, const TList *triggerPatches, int energycomp){
280  std::vector<AliEMCALTriggerPatchInfo *> matchedPatches;
281  if(triggerPatches) {
282  matchedPatches = CorrelateToTrigger(eta, phi, *triggerPatches);
283  }
284  auto hasTriggerPatch = matchedPatches.size() > 0;
285  Int_t supermoduleID = -1, sector = -1;
286  Double_t weight = GetTriggerWeight(triggerclass);
287  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << std::endl;
288 
289  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
290  fHistos->FillTH1("hClusterEnergy" + triggerclass, energy, weight);
291  fHistos->FillTH1("hClusterET" + triggerclass, transverseenergy, weight);
292  fHistos->FillTH2("hEtaEnergy" + triggerclass, eta, energy, weight);
293  fHistos->FillTH2("hEtaET" + triggerclass, eta, transverseenergy, weight);
294  fHistos->FillTH2("hTimeEnergy" + triggerclass, clustertime, energy, weight);
295  fHistos->FillTH2("hNCellEnergy" + triggerclass, ncell, energy, weight);
296  fHistos->FillTH2("hNCellET" + triggerclass, ncell, transverseenergy, weight);
297  if(supermoduleID >= 0){
298  fHistos->FillTH2("hClusterEnergySM" + triggerclass, supermoduleID, energy, weight);
299  fHistos->FillTH2("hClusterETSM" + triggerclass, supermoduleID, transverseenergy, weight);
300  fHistos->FillTH2(TString::Format("hEtaEnergySM%d", supermoduleID) + triggerclass, eta, energy, weight);
301  fHistos->FillTH2(TString::Format("hEtaETSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
302  if(supermoduleID < 12)
303  sector = 4 + int(supermoduleID/2); // EMCAL
304  else
305  sector = 13 + int((supermoduleID-12)/2); // DCAL
306  fHistos->FillTH2(TString::Format("hEtaEnergySec%d", sector) + triggerclass, eta, energy, weight);
307  fHistos->FillTH2(TString::Format("hEtaETSec%d", sector) + triggerclass, eta, transverseenergy, weight);
308  }
309  if(hasTriggerPatch){
310  // find maximum trigger patch
311  AliEMCALTriggerPatchInfo *maxpatch(nullptr);
312  double maxenergy = 0;
313  for(auto patch : matchedPatches) {
314  double patche = 0;
315  switch(energycomp){
316  case 0: patche = patch->GetADCAmp(); break;
317  case 1: patche = patch->GetPatchE(); break;
318  case 2: patche = patch->GetSmearedEnergy(); break;
319  };
320  if(patche > maxenergy) {
321  maxpatch = patch;
322  maxenergy = patche;
323  }
324  }
325  fHistos->FillTH2("hCorrClusterEPatchADC" + triggerclass, energy, maxpatch->GetADCAmp());
326  fHistos->FillTH2("hCorrClusterEPatchE" + triggerclass, energy, maxpatch->GetPatchE());
327  fHistos->FillTH1("hClusterEnergyFired" + triggerclass, energy, weight);
328  fHistos->FillTH1("hClusterETFired" + triggerclass, energy, weight);
329  fHistos->FillTH2("hEtaEnergyFired" + triggerclass, eta, energy, weight);
330  fHistos->FillTH2("hEtaETFired" + triggerclass, eta, energy, weight);
331  if(supermoduleID >= 0){
332  fHistos->FillTH2("hClusterEnergyFiredSM" + triggerclass, supermoduleID, energy, weight);
333  fHistos->FillTH2("hClusterETFiredSM" + triggerclass, supermoduleID, transverseenergy, weight);
334  fHistos->FillTH2(TString::Format("hEtaEnergyFiredSM%d", supermoduleID) + triggerclass, eta, energy,weight);
335  fHistos->FillTH2(TString::Format("hEtaETFiredSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
336  fHistos->FillTH2(TString::Format("hEtaEnergyFiredSec%d", sector) + triggerclass, eta, energy, weight);
337  fHistos->FillTH2(TString::Format("hEtaETFiredSec%d", sector) + triggerclass, eta, transverseenergy, weight);
338  }
339  }
340  Double_t encuts[5] = {1., 2., 5., 10., 20.};
341  for(int ien = 0; ien < 5; ien++){
342  if(energy > encuts[ien]){
343  fHistos->FillTH2(TString::Format("hEtaPhi%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
344  if(hasTriggerPatch){
345  fHistos->FillTH2(TString::Format("hEtaPhiFired%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
346  }
347  }
348  }
349 }
350 
352  double v0amult = fInputEvent->GetVZEROData()->GetMTotV0A(),
353  trackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 0., TMath::TwoPi())),
354  emctrackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 1.4, TMath::Pi())),
355  itsclustermult = fInputEvent->GetMultiplicity()->GetNumberOfSPDClusters(),
356  emcclustermult = static_cast<double>(CountEmcalClusters(0.5)),
357  emccellocc = static_cast<double>(this->GetEMCALCellOccupancy(0.1));
358  for(const auto &t : fSelectedTriggers){
359  Double_t weight = GetTriggerWeight(t);
360  fHistos->FillTH1("hEventCount" + t, 1, weight);
361  fHistos->FillTH1("hEventCentrality" + t, fEventCentrality, weight);
362  fHistos->FillTH1("hVertexZ" + t, fVertex[2], weight);
363 
364  // Multiplicity correlation (no correction for downscaling)
366  double data[6] = {v0amult, trackletmult, emctrackletmult, itsclustermult, emcclustermult, emccellocc};
367  fHistos->FillTHnSparse("hMultiplicityCorrelation" + t, data);
368  }
369  }
370 }
371 
372 std::vector<AliEMCALTriggerPatchInfo *> AliAnalysisTaskEmcalClustersRef::CorrelateToTrigger(Double_t etaclust, Double_t phiclust, const TList &triggerPatches) const {
373  std::vector<AliEMCALTriggerPatchInfo *> foundpatches;
374  for(auto patchIter : triggerPatches){
375  Double_t boundaries[4];
376  auto testpatch = static_cast<AliEMCALTriggerPatchInfo *>(patchIter);
377  GetPatchBoundaries(*testpatch, boundaries);
378  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
379  etamax = TMath::Max(boundaries[0], boundaries[1]),
380  phimin = TMath::Min(boundaries[2], boundaries[3]),
381  phimax = TMath::Max(boundaries[2], boundaries[3]);
382  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
383  foundpatches.push_back(testpatch);
384  break;
385  }
386  }
387  return foundpatches;
388 }
389 
390 void AliAnalysisTaskEmcalClustersRef::GetPatchBoundaries(AliEMCALTriggerPatchInfo &patch, Double_t *boundaries) const {
391  boundaries[0] = patch.GetEtaMin();
392  boundaries[1] = patch.GetEtaMax();
393  boundaries[2] = patch.GetPhiMin();
394  boundaries[3] = patch.GetPhiMax();
395 }
396 
398  int nclusters = 0;
399  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
400  if(!clust->IsEMCAL()) continue;
401  if(clust->GetIsExotic()) continue;
402  if(clust->E() > ecut) nclusters++;
403  nclusters++;
404  }
405  return nclusters;
406 }
407 
408 int AliAnalysisTaskEmcalClustersRef::CountTracklets(double etamin, double etamax, double phimin, double phimax){
409  int ntracklets = 0;
410  AliVMultiplicity *mult = fInputEvent->GetMultiplicity();
411  for(int itl = 0; itl < mult->GetNumberOfTracklets(); itl++){
412  double eta = mult->GetEta(itl), phi = mult->GetPhi(itl);
413  if(!(eta > etamin && eta < etamax)) continue;
414  if(!(phi > phimin && phi < phimax)) continue;
415  ntracklets++;
416  }
417  return ntracklets;
418 }
419 
421  std::set<int> cellIDs;
422  AliVCaloCells *emccells = fInputEvent->GetEMCALCells();
423  for(short icell = 0; icell < emccells->GetNumberOfCells(); icell++){
424  if(emccells->GetAmplitude(icell) > ecut){
425  int cellID = emccells->GetCellNumber(icell);
426  if(cellIDs.find(cellID) == cellIDs.end()) cellIDs.insert(cellID);
427  }
428  }
429  return cellIDs.size();
430 }
431 
433  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
434 
435  //-------------------------------------------------------
436  // Init the task and do settings
437  //-------------------------------------------------------
438 
439  TString clusName(nclusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nclusters);
440 
441  TString taskname = "emcalClusterQA_" + suffix;
442 
444  task->AddClusterContainer(clusName);
445  task->SetClusterContainer(clusName);
446  mgr->AddTask(task);
447 
448  TString outfile(mgr->GetCommonFileName());
449  outfile += ":ClusterQA_" + TString(suffix);
450  TString containername = "ClusterResults_" + TString(suffix);
451  printf("Outfile: %s, container: %s\n", outfile.Data(), containername.Data());
452 
453  task->ConnectInput(0, mgr->GetCommonInputContainer());
454  mgr->ConnectOutput(task, 1, mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
455 
456  return task;
457 }
458 
460  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
461 
463  mgr->AddTask(task);
464 
465  // Adding cluster container
466  TString clusName(nClusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nClusters);
467  task->AddClusterContainer(clusName.Data());
468  task->SetClusterContainer(clusName);
469 
470  // Set Energy thresholds for additional patch selection:
471  // These are events with offline patches of a given type where the trigger reached already the plateau
472  // These numers are determined as:
473  // EMC7: 3.5 GeV
474  // EG1: 14 GeV
475  // EG2: 8 GeV
476  // EJ1: 22 GeV
477  // EJ2: 12 GeV
480  );
481 
482  TString outfile(mgr->GetCommonFileName());
483  outfile += ":ClusterQA";
484 
485  task->ConnectInput(0, mgr->GetCommonInputContainer());
486  mgr->ConnectOutput(task, 1, mgr->CreateContainer("ClusterResults", AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
487 
488  return task;
489 }
490 
491 
497 {
498  this->SetMinimum(0.);
499  this->AddStep(1, 0.05);
500  this->AddStep(2, 0.1);
501  this->AddStep(4, 0.2);
502  this->AddStep(7, 0.5);
503  this->AddStep(16, 1);
504  this->AddStep(32, 2);
505  this->AddStep(40, 4);
506  this->AddStep(50, 5);
507  this->AddStep(100, 10);
508  this->AddStep(200, 20);
509 }
510 
511 
512 } /* 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.
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.
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
void SetOfflineTriggerSelection(AliEmcalTriggerOfflineSelection *sel)
Set an offline trigger selection.
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
Bool_t fDoFillMultiplicityHistograms
Swich for multiplcity histograms.
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.
TString fNameClusterContainer
Name of the cluster container in the event.
int Int_t
Definition: External.C:63
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.
void FillClusterHistograms(const TString &triggerclass, double energy, double transversenergy, double eta, double phi, double clustertime, int ncell, const TList *triggerpatches, int energycomp)
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.
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.
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.