AliPhysics  deb3cd0 (deb3cd0)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalClustersRef.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2015, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <array>
16 #include <bitset>
17 #include <iostream>
18 #include <map>
19 #include <set>
20 #include <vector>
21 
22 #include <TArrayD.h>
23 #include <TClonesArray.h>
24 #include <TGrid.h>
25 #include <THashList.h>
26 #include <THistManager.h>
27 #include <TLinearBinning.h>
28 #include <TLorentzVector.h>
29 #include <TObjArray.h>
30 #include <TParameter.h>
31 #include <TMath.h>
32 
33 #include "AliAnalysisManager.h"
34 #include "AliAnalysisUtils.h"
35 #include "AliClusterContainer.h"
37 #include "AliEMCALGeometry.h"
38 #include "AliEmcalList.h"
39 #include "AliEMCALTriggerPatchInfo.h"
41 #include "AliESDEvent.h"
42 #include "AliInputEventHandler.h"
43 #include "AliLog.h"
44 #include "AliMultSelection.h"
45 #include "AliMultEstimator.h"
46 #include "AliVCluster.h"
47 #include "AliVEvent.h"
48 #include "AliVEventHandler.h"
49 #include "AliVVertex.h"
50 
52 
56 
57 namespace EMCalTriggerPtAnalysis {
58 
59 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
61  fCentralityRange(-999., 999.),
62  fRequestCentrality(false),
63  fEventCentrality(-1),
64  fCentralityEstimator("V0M"),
65  fBunchCrossingIndex(-1),
66  fEnergyDefinition(kDefaultEnergy),
67  fEnableSumw2(false),
68  fClusterTimeRange(-50e-6, 50e-6)
69 {
70 }
71 
74  fCentralityRange(-999., 999.),
75  fRequestCentrality(false),
76  fEventCentrality(-1),
77  fCentralityEstimator("V0M"),
78  fBunchCrossingIndex(-1),
79  fEnergyDefinition(kDefaultEnergy),
80  fEnableSumw2(false),
81  fClusterTimeRange(-50e-6, 50e-6)
82 {
83 }
84 
86 }
87 
88 
90 
91  EnergyBinning energybinning;
92  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);
93  TString optionstring = fEnableSumw2 ? "s" : "";
94 
95  /*
96  * Exclusive classes are defined as triggered events
97  * in a class without lower threshold classes firing.
98  * This is needed to make the triggers statistically
99  * independent.
100  */
101  std::array<Double_t, 5> encuts = {1., 2., 5., 10., 20.};
102  Int_t sectorsWithEMCAL[10] = {4, 5, 6, 7, 8, 9, 13, 14, 15, 16};
103 
104  // Binnings for Multiplicity correlation
105  TLinearBinning v0abinning(1000, 0., 1000.), trackletbinning(500, 0., 500.), itsclustbinning(500, 0., 500.), emcclustbinning(100, 0., 100.), emccellbinning(3000, 0., 3000.);
106  const TBinning *multbinning[6] = {&v0abinning, &trackletbinning, &trackletbinning, &itsclustbinning, &emcclustbinning, &emccellbinning};
107  for(auto trg : GetSupportedTriggers()){
108  fHistos->CreateTH1("hEventCount" + trg, "Event count for trigger class " + trg, 1, 0.5, 1.5, optionstring);
109  fHistos->CreateTH1("hEventCentrality" + trg, "Event centrality for trigger class " + trg, 103, -2., 101., optionstring);
110  fHistos->CreateTH1("hVertexZ" + trg, "z-position of the primary vertex for trigger class " + trg, 200, -40., 40., optionstring);
111  fHistos->CreateTHnSparse("hMultiplicityCorrelation" + trg, "Multiplicity correlation for trigger" + trg, 6, multbinning);
112  fHistos->CreateTH1("hClusterEnergy" + trg, "Cluster energy for trigger class " + trg, energybinning, optionstring);
113  fHistos->CreateTH1("hClusterET" + trg, "Cluster transverse energy for trigger class " + trg, energybinning, optionstring);
114  fHistos->CreateTH1("hClusterEnergyFired" + trg, "Cluster energy for trigger class " + trg + ", firing the trigger", energybinning, optionstring);
115  fHistos->CreateTH1("hClusterETFired" + trg, "Cluster transverse energy for trigger class " + trg + ", firing the trigger" , energybinning, optionstring);
116  fHistos->CreateTH2("hClusterEnergySM" + trg, "Cluster energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
117  fHistos->CreateTH2("hClusterETSM" + trg, "Cluster transverse energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
118  fHistos->CreateTH2("hClusterEnergyFiredSM" + trg, "Cluster energy versus supermodule for trigger class " + trg + ", firing the trigger" , smbinning, energybinning, optionstring);
119  fHistos->CreateTH2("hClusterETFiredSM" + trg, "Cluster transverse energy versus supermodule for trigger class " + trg + ", firing the trigger" , smbinning, energybinning, optionstring);
120  fHistos->CreateTH2("hEtaEnergy" + trg, "Cluster energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
121  fHistos->CreateTH2("hEtaET" + trg, "Cluster transverse energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
122  fHistos->CreateTH2("hTimeEnergy" + trg, "Cluster time vs. energy for trigger class " + trg, timebinning, energybinning, optionstring);
123  fHistos->CreateTH2("hNCellEnergy" + trg, "Cluster number of cells vs energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
124  fHistos->CreateTH2("hNCellET" + trg, "Cluster number of cells vs transverse energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
125  fHistos->CreateTH2("hEtaEnergyFired" + trg, "Cluster energy vs. eta for trigger class " + trg + ", firing the trigger", etabinning, energybinning, optionstring);
126  fHistos->CreateTH2("hEtaETFired" + trg, "Cluster transverse energy vs. eta for trigger class " + trg + ", firing the trigger", etabinning, energybinning, optionstring);
127  for(int ism = 0; ism < 20; ism++){
128  fHistos->CreateTH2(TString::Format("hEtaEnergySM%d", ism) + trg, TString::Format("Cluster energy vs. eta in Supermodule %d for trigger ", ism) + trg, etabinning, energybinning, optionstring);
129  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);
130  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);
131  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);
132  }
133  for(int isec = 0; isec < 10; isec++){
134  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);
135  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);
136  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);
137  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);
138  }
139  for(auto ien : encuts){
140  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);
141  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);
142  }
143  }
144 }
145 
147  fEventCentrality = -1;
148  if(fRequestCentrality){
149  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
150  if(!mult){
151  AliErrorStream() << GetName() << ": Centrality selection enabled but no centrality estimator found" << std::endl;
152  return false;
153  }
154  if(mult->IsEventSelected()) return false;
155  fEventCentrality = mult->GetEstimator(fCentralityEstimator)->GetPercentile();
156  AliDebugStream(1) << GetName() << ": Centrality " << fEventCentrality << std::endl;
158  AliDebugStream(1) << GetName() << ": reject centrality: " << fEventCentrality << std::endl;
159  return false;
160  } else {
161  AliDebugStream(1) << GetName() << ": select centrality " << fEventCentrality << std::endl;
162  }
163  } else {
164  AliDebugStream(1) << GetName() << ": No centrality selection applied" << std::endl;
165  }
166 
167  if(fBunchCrossingIndex > -1){
168  int bcindex = fInputEvent->GetHeader()->GetBunchCrossNumber() % 4;
169  if(bcindex != fBunchCrossingIndex) return false;
170  }
171  return true;
172 }
173 
175  AliDebugStream(1) << GetName() << ": UserExec start" << std::endl;
176 
177  TList ej1patches, dj1patches, ej2patches, dj2patches, eg1patches, dg1patches, eg2patches, dg2patches;
178  FindPatchesForTrigger("EJ2", fTriggerPatchInfo, ej2patches);
179  FindPatchesForTrigger("DJ2", fTriggerPatchInfo, dj2patches);
180  FindPatchesForTrigger("EJ1", fTriggerPatchInfo, ej1patches);
181  FindPatchesForTrigger("DJ1", fTriggerPatchInfo, dj1patches);
182  FindPatchesForTrigger("EG2", fTriggerPatchInfo, eg2patches);
183  FindPatchesForTrigger("DG2", fTriggerPatchInfo, dg2patches);
184  FindPatchesForTrigger("EG1", fTriggerPatchInfo, eg1patches);
185  FindPatchesForTrigger("DG1", fTriggerPatchInfo, dg1patches);
186 
187  Double_t energy, et, eta, phi;
188  TList *selpatches(nullptr);
189  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
190  //AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
191  if(!clust->IsEMCAL()) continue;
192  if(clust->GetIsExotic()) continue;
193  if(!fClusterTimeRange.IsInRange(clust->GetTOF())) continue;
194 
195  // Distinguish energy definition
196  switch(fEnergyDefinition){
197  case kDefaultEnergy:
198  AliDebugStream(2) << GetName() << ": Using cluster energy definition: default" << std::endl;
199  energy = clust->E();
200  break;
201  case kNonLinCorrEnergy:
202  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for non-linearity" << std::endl;
203  energy = clust->GetNonLinCorrEnergy();
204  break;
205  case kHadCorrEnergy:
206  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for hadronic contribution" << std::endl;
207  energy = clust->GetHadCorrEnergy();
208  break;
209  };
210 
211  AliDebugStream(2) << GetName() << ": Using energy " << energy << " (def: " << clust->E()
212  << " | NL: " << clust->GetNonLinCorrEnergy()
213  << " | HD: " << clust->GetHadCorrEnergy()
214  << ")" << std::endl;
215 
216  TLorentzVector posvec;
217  clust->GetMomentum(posvec, fVertex);
218  posvec.SetE(energy); // use energy definition as selected in the task
219  et = posvec.Et();
220  eta = posvec.Eta();
221  phi = posvec.Phi();
222 
223  // fill histograms allEta
224  for(const auto & trg : fSelectedTriggers){
225  selpatches = nullptr;
226  if(trg.Contains("EJ2")) selpatches = &ej2patches;
227  if(trg.Contains("DJ2")) selpatches = &dj2patches;
228  if(trg.Contains("EJ1")) selpatches = &ej1patches;
229  if(trg.Contains("DJ1")) selpatches = &dj1patches;
230  if(trg.Contains("EG2")) selpatches = &eg2patches;
231  if(trg.Contains("DG2")) selpatches = &dg2patches;
232  if(trg.Contains("EG1")) selpatches = &eg1patches;
233  if(trg.Contains("DG1")) selpatches = &dg1patches;
234  FillClusterHistograms(trg.Data(), energy, et, eta, phi, clust->GetTOF(), clust->GetNCells(), nullptr);
235  }
236  }
237  return true;
238 }
239 
240 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(const TString &triggerclass, double energy, double transverseenergy, double eta, double phi, double clustertime, int ncell, TList *fTriggerPatches){
241  Bool_t hasTriggerPatch = fTriggerPatches ? CorrelateToTrigger(eta, phi, fTriggerPatches) : kFALSE;
242  Int_t supermoduleID = -1, sector = -1;
243  Double_t weight = GetTriggerWeight(triggerclass);
244  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << std::endl;
245 
246  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
247  fHistos->FillTH1("hClusterEnergy" + triggerclass, energy, weight);
248  fHistos->FillTH1("hClusterET" + triggerclass, transverseenergy, weight);
249  fHistos->FillTH2("hEtaEnergy" + triggerclass, eta, energy, weight);
250  fHistos->FillTH2("hEtaET" + triggerclass, eta, transverseenergy, weight);
251  fHistos->FillTH2("hTimeEnergy" + triggerclass, clustertime, energy, weight);
252  fHistos->FillTH2("hNCellEnergy" + triggerclass, ncell, energy, weight);
253  fHistos->FillTH2("hNCellET" + triggerclass, ncell, transverseenergy, weight);
254  if(supermoduleID >= 0){
255  fHistos->FillTH2("hClusterEnergySM" + triggerclass, supermoduleID, energy, weight);
256  fHistos->FillTH2("hClusterETSM" + triggerclass, supermoduleID, transverseenergy, weight);
257  fHistos->FillTH2(TString::Format("hEtaEnergySM%d", supermoduleID) + triggerclass, eta, energy, weight);
258  fHistos->FillTH2(TString::Format("hEtaETSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
259  if(supermoduleID < 12)
260  sector = 4 + int(supermoduleID/2); // EMCAL
261  else
262  sector = 13 + int((supermoduleID-12)/2); // DCAL
263  fHistos->FillTH2(TString::Format("hEtaEnergySec%d", sector) + triggerclass, eta, energy, weight);
264  fHistos->FillTH2(TString::Format("hEtaETSec%d", sector) + triggerclass, eta, transverseenergy, weight);
265  }
266  if(hasTriggerPatch){
267  fHistos->FillTH1("hClusterEnergyFired" + triggerclass, energy, weight);
268  fHistos->FillTH1("hClusterETFired" + triggerclass, energy, weight);
269  fHistos->FillTH2("hEtaEnergyFired" + triggerclass, eta, energy, weight);
270  fHistos->FillTH2("hEtaETFired" + triggerclass, eta, energy, weight);
271  if(supermoduleID >= 0){
272  fHistos->FillTH2("hClusterEnergyFiredSM" + triggerclass, supermoduleID, energy, weight);
273  fHistos->FillTH2("hClusterETFiredSM" + triggerclass, supermoduleID, transverseenergy, weight);
274  fHistos->FillTH2(TString::Format("hEtaEnergyFiredSM%d", supermoduleID) + triggerclass, eta, energy,weight);
275  fHistos->FillTH2(TString::Format("hEtaETFiredSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
276  fHistos->FillTH2(TString::Format("hEtaEnergyFiredSec%d", sector) + triggerclass, eta, energy, weight);
277  fHistos->FillTH2(TString::Format("hEtaETFiredSec%d", sector) + triggerclass, eta, transverseenergy, weight);
278  }
279  }
280  Double_t encuts[5] = {1., 2., 5., 10., 20.};
281  for(int ien = 0; ien < 5; ien++){
282  if(energy > encuts[ien]){
283  fHistos->FillTH2(TString::Format("hEtaPhi%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
284  if(hasTriggerPatch){
285  fHistos->FillTH2(TString::Format("hEtaPhiFired%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
286  }
287  }
288  }
289 }
290 
292  double v0amult = fInputEvent->GetVZEROData()->GetMTotV0A(),
293  trackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 0., TMath::TwoPi())),
294  emctrackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 1.4, TMath::Pi())),
295  itsclustermult = fInputEvent->GetMultiplicity()->GetNumberOfSPDClusters(),
296  emcclustermult = static_cast<double>(CountEmcalClusters(0.5)),
297  emccellocc = static_cast<double>(this->GetEMCALCellOccupancy(0.1));
298  for(const auto &t : fSelectedTriggers){
299  Double_t weight = GetTriggerWeight(t);
300  fHistos->FillTH1("hEventCount" + t, 1, weight);
301  fHistos->FillTH1("hEventCentrality" + t, fEventCentrality, weight);
302  fHistos->FillTH1("hVertexZ" + t, fVertex[2], weight);
303 
304  // Multiplicity correlation (no correction for downscaling)
305  double data[6] = {v0amult, trackletmult, emctrackletmult, itsclustermult, emcclustermult, emccellocc};
306  fHistos->FillTHnSparse("hMultiplicityCorrelation" + t, data);
307  }
308 }
309 
311  Bool_t hasfound = kFALSE;
312  for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
313  Double_t boundaries[4];
314  GetPatchBoundaries(*patchIter, boundaries);
315  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
316  etamax = TMath::Max(boundaries[0], boundaries[1]),
317  phimin = TMath::Min(boundaries[2], boundaries[3]),
318  phimax = TMath::Max(boundaries[2], boundaries[3]);
319  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
320  hasfound = kTRUE;
321  break;
322  }
323  }
324  return hasfound;
325 }
326 
327 void AliAnalysisTaskEmcalClustersRef::FindPatchesForTrigger(TString triggerclass, const TClonesArray * triggerPatches, TList &foundtriggers) const {
328  foundtriggers.Clear();
329  if(!triggerPatches) return;
331  if(triggerclass == "EG1") myclass = AliEmcalTriggerOfflineSelection::kTrgEG1;
332  if(triggerclass == "EG2") myclass = AliEmcalTriggerOfflineSelection::kTrgEG2;
333  if(triggerclass == "EJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ1;
334  if(triggerclass == "EJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ2;
335  if(triggerclass == "DMC7") myclass = AliEmcalTriggerOfflineSelection::kTrgDL0;
336  if(triggerclass == "DG1") myclass = AliEmcalTriggerOfflineSelection::kTrgDG1;
337  if(triggerclass == "DG2") myclass = AliEmcalTriggerOfflineSelection::kTrgDG2;
338  if(triggerclass == "DJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ1;
339  if(triggerclass == "DJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ2;
340  for(auto patchiter : *triggerPatches){
341  AliEMCALTriggerPatchInfo *mypatch = static_cast<AliEMCALTriggerPatchInfo *>(patchiter);
342  if(!mypatch->IsOfflineSimple()) continue;
344  if(!mypatch->IsDCalPHOS()) continue;
345  } else {
346  if(mypatch->IsDCalPHOS()) continue;
347  }
349  if(!mypatch->IsGammaLowSimple()) continue;
350  } else {
351  if(!mypatch->IsJetLowSimple()) continue;
352  }
353  double threshold = fTriggerSelection ? fTriggerSelection->GetThresholdForTrigger(myclass) : -1;
354  if(mypatch->GetPatchE() > threshold) foundtriggers.Add(patchiter);
355  }
356 }
357 
359  AliEMCALTriggerPatchInfo *patch= dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
360  boundaries[0] = patch->GetEtaMin();
361  boundaries[1] = patch->GetEtaMax();
362  boundaries[2] = patch->GetPhiMin();
363  boundaries[3] = patch->GetPhiMax();
364 }
365 
367  int nclusters = 0;
368  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
369  if(!clust->IsEMCAL()) continue;
370  if(clust->GetIsExotic()) continue;
371  if(clust->E() > ecut) nclusters++;
372  nclusters++;
373  }
374  return nclusters;
375 }
376 
377 int AliAnalysisTaskEmcalClustersRef::CountTracklets(double etamin, double etamax, double phimin, double phimax){
378  int ntracklets = 0;
379  AliVMultiplicity *mult = fInputEvent->GetMultiplicity();
380  for(int itl = 0; itl < mult->GetNumberOfTracklets(); itl++){
381  double eta = mult->GetEta(itl), phi = mult->GetPhi(itl);
382  if(!(eta > etamin && eta < etamax)) continue;
383  if(!(phi > phimin && phi < phimax)) continue;
384  ntracklets++;
385  }
386  return ntracklets;
387 }
388 
390  std::set<int> cellIDs;
391  AliVCaloCells *emccells = fInputEvent->GetEMCALCells();
392  for(short icell = 0; icell < emccells->GetNumberOfCells(); icell++){
393  if(emccells->GetAmplitude(icell) > ecut){
394  int cellID = emccells->GetCellNumber(icell);
395  if(cellIDs.find(cellID) == cellIDs.end()) cellIDs.insert(cellID);
396  }
397  }
398  return cellIDs.size();
399 }
400 
402  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
403 
404  //-------------------------------------------------------
405  // Init the task and do settings
406  //-------------------------------------------------------
407 
408  TString clusName(nclusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nclusters);
409 
410  TString taskname = "emcalClusterQA_" + suffix;
411 
413  task->AddClusterContainer(clusName);
414  task->SetClusterContainer(clusName);
415  mgr->AddTask(task);
416 
417  TString outfile(mgr->GetCommonFileName());
418  outfile += ":ClusterQA_" + TString(suffix);
419  TString containername = "ClusterResults_" + TString(suffix);
420  printf("Outfile: %s, container: %s\n", outfile.Data(), containername.Data());
421 
422  task->ConnectInput(0, mgr->GetCommonInputContainer());
423  mgr->ConnectOutput(task, 1, mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
424 
425  return task;
426 }
427 
429  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
430 
432  mgr->AddTask(task);
433 
434  // Adding cluster container
435  TString clusName(nClusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nClusters);
436  task->AddClusterContainer(clusName.Data());
437  task->SetClusterContainer(clusName);
438 
439  // Set Energy thresholds for additional patch selection:
440  // These are events with offline patches of a given type where the trigger reached already the plateau
441  // These numers are determined as:
442  // EMC7: 3.5 GeV
443  // EG1: 14 GeV
444  // EG2: 8 GeV
445  // EJ1: 22 GeV
446  // EJ2: 12 GeV
449  );
450 
451  TString outfile(mgr->GetCommonFileName());
452  outfile += ":ClusterQA";
453 
454  task->ConnectInput(0, mgr->GetCommonInputContainer());
455  mgr->ConnectOutput(task, 1, mgr->CreateContainer("ClusterResults", AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
456 
457  return task;
458 }
459 
460 
466 {
467  this->SetMinimum(0.);
468  this->AddStep(1, 0.05);
469  this->AddStep(2, 0.1);
470  this->AddStep(4, 0.2);
471  this->AddStep(7, 0.5);
472  this->AddStep(16, 1);
473  this->AddStep(32, 2);
474  this->AddStep(40, 4);
475  this->AddStep(50, 5);
476  this->AddStep(100, 10);
477  this->AddStep(200, 20);
478 }
479 
480 
481 } /* namespace EMCalTriggerPtAnalysis */
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
double Double_t
Definition: External.C:58
Class creating a linear binning, used in the histogram manager.
Bool_t CorrelateToTrigger(Double_t etaclust, Double_t phiclust, TList *triggerpatches) const
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.
Simple monitoring task for cluster-related quantities in EMCAL-triggered events.
AliEmcalTriggerOfflineSelection * fTriggerSelection
Offline trigger selection.
Bool_t fRequestCentrality
Switch on request for centrality range.
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.
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
EmcalTriggerClass
Definition of the various supported trigger types.
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 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="")
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)
static AliAnalysisTaskEmcalClustersRef * AddTaskEmcalClustersRefDefault(const TString &nClusters="usedefault")
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fVertex[3]
!event vertex
AliCutValueRange< double > fCentralityRange
Selected centrality range.
const Double_t etamax
TClonesArray * fTriggerPatchInfo
!trigger patch info array
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.
bool Bool_t
Definition: External.C:53
void FillClusterHistograms(const TString &triggerclass, double energy, double transversenergy, double eta, double phi, double clustertime, int ncell, TList *triggerpatches)
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.
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 FindPatchesForTrigger(TString triggerclass, const TClonesArray *triggerpatches, TList &foundpatches) const
void SetMinimum(Double_t min)
static TString ClusterContainerNameFactory(Bool_t isAOD)
Get name of the default cluster container.