AliPhysics  0bb4a45 (0bb4a45)
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"
53 #include "AliESDEvent.h"
54 #include "AliInputEventHandler.h"
55 #include "AliLog.h"
56 #include "AliMultSelection.h"
57 #include "AliMultEstimator.h"
58 #include "AliVCluster.h"
59 #include "AliVEvent.h"
60 #include "AliVEventHandler.h"
61 #include "AliVVertex.h"
62 
64 
68 
69 namespace EMCalTriggerPtAnalysis {
70 
71 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
73  fCentralityRange(-999., 999.),
74  fRequestCentrality(false),
75  fEventCentrality(-1),
76  fCentralityEstimator("V0M"),
77  fBunchCrossingIndex(-1),
78  fEnergyDefinition(kDefaultEnergy),
79  fEnableSumw2(false),
80  fDoFillMultiplicityHistograms(false),
81  fClusterTimeRange(-50e-6, 50e-6)
82 {
83 }
84 
87  fCentralityRange(-999., 999.),
88  fRequestCentrality(false),
89  fEventCentrality(-1),
90  fCentralityEstimator("V0M"),
93  fEnableSumw2(false),
95  fClusterTimeRange(-50e-6, 50e-6)
96 {
97 }
98 
100 }
101 
102 
104 
105  EnergyBinning energybinning;
106  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);
107  TString optionstring = fEnableSumw2 ? "s" : "";
108 
109  /*
110  * Exclusive classes are defined as triggered events
111  * in a class without lower threshold classes firing.
112  * This is needed to make the triggers statistically
113  * independent.
114  */
115  std::array<Double_t, 5> encuts = {1., 2., 5., 10., 20.};
116  Int_t sectorsWithEMCAL[10] = {4, 5, 6, 7, 8, 9, 13, 14, 15, 16};
117 
118  // Binnings for Multiplicity correlation
119  TLinearBinning v0abinning(1000, 0., 1000.), trackletbinning(500, 0., 500.), itsclustbinning(500, 0., 500.), emcclustbinning(100, 0., 100.), emccellbinning(3000, 0., 3000.);
120  const TBinning *multbinning[6] = {&v0abinning, &trackletbinning, &trackletbinning, &itsclustbinning, &emcclustbinning, &emccellbinning};
121  for(auto trg : GetSupportedTriggers()){
122  fHistos->CreateTH1("hEventCount" + trg, "Event count for trigger class " + trg, 1, 0.5, 1.5, optionstring);
123  fHistos->CreateTH1("hEventCentrality" + trg, "Event centrality for trigger class " + trg, 103, -2., 101., optionstring);
124  fHistos->CreateTH1("hVertexZ" + trg, "z-position of the primary vertex for trigger class " + trg, 200, -40., 40., optionstring);
125  if(this->fDoFillMultiplicityHistograms) fHistos->CreateTHnSparse("hMultiplicityCorrelation" + trg, "Multiplicity correlation for trigger" + trg, 6, multbinning);
126  fHistos->CreateTH1("hClusterEnergy" + trg, "Cluster energy for trigger class " + trg, energybinning, optionstring);
127  fHistos->CreateTH1("hClusterET" + trg, "Cluster transverse energy for trigger class " + trg, energybinning, optionstring);
128  fHistos->CreateTH1("hClusterEnergyFired" + trg, "Cluster energy for trigger class " + trg + ", firing the trigger", energybinning, optionstring);
129  fHistos->CreateTH1("hClusterETFired" + trg, "Cluster transverse energy for trigger class " + trg + ", firing the trigger" , energybinning, optionstring);
130  fHistos->CreateTH2("hClusterEnergySM" + trg, "Cluster energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
131  fHistos->CreateTH2("hClusterETSM" + trg, "Cluster transverse energy versus supermodule for trigger class " + trg, smbinning, energybinning, optionstring);
132  fHistos->CreateTH2("hClusterEnergyFiredSM" + trg, "Cluster energy versus supermodule for trigger class " + trg + ", firing the trigger" , smbinning, energybinning, optionstring);
133  fHistos->CreateTH2("hClusterETFiredSM" + trg, "Cluster transverse energy versus supermodule for trigger class " + trg + ", firing the trigger" , smbinning, energybinning, optionstring);
134  fHistos->CreateTH2("hEtaEnergy" + trg, "Cluster energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
135  fHistos->CreateTH2("hEtaET" + trg, "Cluster transverse energy vs. eta for trigger class " + trg, etabinning, energybinning, optionstring);
136  fHistos->CreateTH2("hTimeEnergy" + trg, "Cluster time vs. energy for trigger class " + trg, timebinning, energybinning, optionstring);
137  fHistos->CreateTH2("hNCellEnergy" + trg, "Cluster number of cells vs energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
138  fHistos->CreateTH2("hNCellET" + trg, "Cluster number of cells vs transverse energy for trigger class " + trg, ncellbinning, energybinning, optionstring);
139  fHistos->CreateTH2("hEtaEnergyFired" + trg, "Cluster energy vs. eta for trigger class " + trg + ", firing the trigger", etabinning, energybinning, optionstring);
140  fHistos->CreateTH2("hEtaETFired" + trg, "Cluster transverse energy vs. eta for trigger class " + trg + ", firing the trigger", etabinning, energybinning, optionstring);
141  for(int ism = 0; ism < 20; ism++){
142  fHistos->CreateTH2(TString::Format("hEtaEnergySM%d", ism) + trg, TString::Format("Cluster energy vs. eta in Supermodule %d for trigger ", ism) + trg, etabinning, energybinning, optionstring);
143  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);
144  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);
145  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);
146  }
147  for(int isec = 0; isec < 10; isec++){
148  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);
149  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);
150  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);
151  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);
152  }
153  for(auto ien : encuts){
154  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);
155  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);
156  }
157  }
158 }
159 
161  fEventCentrality = -1;
162  if(fRequestCentrality){
163  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
164  if(!mult){
165  AliErrorStream() << GetName() << ": Centrality selection enabled but no centrality estimator found" << std::endl;
166  return false;
167  }
168  if(mult->IsEventSelected()) return false;
169  fEventCentrality = mult->GetEstimator(fCentralityEstimator)->GetPercentile();
170  AliDebugStream(1) << GetName() << ": Centrality " << fEventCentrality << std::endl;
172  AliDebugStream(1) << GetName() << ": reject centrality: " << fEventCentrality << std::endl;
173  return false;
174  } else {
175  AliDebugStream(1) << GetName() << ": select centrality " << fEventCentrality << std::endl;
176  }
177  } else {
178  AliDebugStream(1) << GetName() << ": No centrality selection applied" << std::endl;
179  }
180 
181  if(fBunchCrossingIndex > -1){
182  int bcindex = fInputEvent->GetHeader()->GetBunchCrossNumber() % 4;
183  if(bcindex != fBunchCrossingIndex) return false;
184  }
185  return true;
186 }
187 
189  AliDebugStream(1) << GetName() << ": UserExec start" << std::endl;
190 
191  TList ej1patches, dj1patches, ej2patches, dj2patches, eg1patches, dg1patches, eg2patches, dg2patches;
192  FindPatchesForTrigger("EJ2", fTriggerPatchInfo, ej2patches);
193  FindPatchesForTrigger("DJ2", fTriggerPatchInfo, dj2patches);
194  FindPatchesForTrigger("EJ1", fTriggerPatchInfo, ej1patches);
195  FindPatchesForTrigger("DJ1", fTriggerPatchInfo, dj1patches);
196  FindPatchesForTrigger("EG2", fTriggerPatchInfo, eg2patches);
197  FindPatchesForTrigger("DG2", fTriggerPatchInfo, dg2patches);
198  FindPatchesForTrigger("EG1", fTriggerPatchInfo, eg1patches);
199  FindPatchesForTrigger("DG1", fTriggerPatchInfo, dg1patches);
200 
201  Double_t energy, et, eta, phi;
202  TList *selpatches(nullptr);
203  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
204  //AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
205  if(!clust->IsEMCAL()) continue;
206  if(clust->GetIsExotic()) continue;
207  if(!fClusterTimeRange.IsInRange(clust->GetTOF())) continue;
208 
209  // Distinguish energy definition
210  switch(fEnergyDefinition){
211  case kDefaultEnergy:
212  AliDebugStream(2) << GetName() << ": Using cluster energy definition: default" << std::endl;
213  energy = clust->E();
214  break;
215  case kNonLinCorrEnergy:
216  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for non-linearity" << std::endl;
217  energy = clust->GetNonLinCorrEnergy();
218  break;
219  case kHadCorrEnergy:
220  AliDebugStream(2) << GetName() << ": Using cluster energy definition: corrected for hadronic contribution" << std::endl;
221  energy = clust->GetHadCorrEnergy();
222  break;
223  };
224 
225  AliDebugStream(2) << GetName() << ": Using energy " << energy << " (def: " << clust->E()
226  << " | NL: " << clust->GetNonLinCorrEnergy()
227  << " | HD: " << clust->GetHadCorrEnergy()
228  << ")" << std::endl;
229 
230  TLorentzVector posvec;
231  clust->GetMomentum(posvec, fVertex);
232  posvec.SetE(energy); // use energy definition as selected in the task
233  et = posvec.Et();
234  eta = posvec.Eta();
235  phi = posvec.Phi();
236 
237  // fill histograms allEta
238  for(const auto & trg : fSelectedTriggers){
239  selpatches = nullptr;
240  if(trg.Contains("EJ2")) selpatches = &ej2patches;
241  if(trg.Contains("DJ2")) selpatches = &dj2patches;
242  if(trg.Contains("EJ1")) selpatches = &ej1patches;
243  if(trg.Contains("DJ1")) selpatches = &dj1patches;
244  if(trg.Contains("EG2")) selpatches = &eg2patches;
245  if(trg.Contains("DG2")) selpatches = &dg2patches;
246  if(trg.Contains("EG1")) selpatches = &eg1patches;
247  if(trg.Contains("DG1")) selpatches = &dg1patches;
248  FillClusterHistograms(trg.Data(), energy, et, eta, phi, clust->GetTOF(), clust->GetNCells(), selpatches);
249  }
250  }
251  return true;
252 }
253 
254 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(const TString &triggerclass, double energy, double transverseenergy, double eta, double phi, double clustertime, int ncell, TList *fTriggerPatches){
255  Bool_t hasTriggerPatch = fTriggerPatches ? CorrelateToTrigger(eta, phi, fTriggerPatches) : kFALSE;
256  Int_t supermoduleID = -1, sector = -1;
257  Double_t weight = GetTriggerWeight(triggerclass);
258  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << std::endl;
259 
260  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
261  fHistos->FillTH1("hClusterEnergy" + triggerclass, energy, weight);
262  fHistos->FillTH1("hClusterET" + triggerclass, transverseenergy, weight);
263  fHistos->FillTH2("hEtaEnergy" + triggerclass, eta, energy, weight);
264  fHistos->FillTH2("hEtaET" + triggerclass, eta, transverseenergy, weight);
265  fHistos->FillTH2("hTimeEnergy" + triggerclass, clustertime, energy, weight);
266  fHistos->FillTH2("hNCellEnergy" + triggerclass, ncell, energy, weight);
267  fHistos->FillTH2("hNCellET" + triggerclass, ncell, transverseenergy, weight);
268  if(supermoduleID >= 0){
269  fHistos->FillTH2("hClusterEnergySM" + triggerclass, supermoduleID, energy, weight);
270  fHistos->FillTH2("hClusterETSM" + triggerclass, supermoduleID, transverseenergy, weight);
271  fHistos->FillTH2(TString::Format("hEtaEnergySM%d", supermoduleID) + triggerclass, eta, energy, weight);
272  fHistos->FillTH2(TString::Format("hEtaETSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
273  if(supermoduleID < 12)
274  sector = 4 + int(supermoduleID/2); // EMCAL
275  else
276  sector = 13 + int((supermoduleID-12)/2); // DCAL
277  fHistos->FillTH2(TString::Format("hEtaEnergySec%d", sector) + triggerclass, eta, energy, weight);
278  fHistos->FillTH2(TString::Format("hEtaETSec%d", sector) + triggerclass, eta, transverseenergy, weight);
279  }
280  if(hasTriggerPatch){
281  fHistos->FillTH1("hClusterEnergyFired" + triggerclass, energy, weight);
282  fHistos->FillTH1("hClusterETFired" + triggerclass, energy, weight);
283  fHistos->FillTH2("hEtaEnergyFired" + triggerclass, eta, energy, weight);
284  fHistos->FillTH2("hEtaETFired" + triggerclass, eta, energy, weight);
285  if(supermoduleID >= 0){
286  fHistos->FillTH2("hClusterEnergyFiredSM" + triggerclass, supermoduleID, energy, weight);
287  fHistos->FillTH2("hClusterETFiredSM" + triggerclass, supermoduleID, transverseenergy, weight);
288  fHistos->FillTH2(TString::Format("hEtaEnergyFiredSM%d", supermoduleID) + triggerclass, eta, energy,weight);
289  fHistos->FillTH2(TString::Format("hEtaETFiredSM%d", supermoduleID) + triggerclass, eta, transverseenergy, weight);
290  fHistos->FillTH2(TString::Format("hEtaEnergyFiredSec%d", sector) + triggerclass, eta, energy, weight);
291  fHistos->FillTH2(TString::Format("hEtaETFiredSec%d", sector) + triggerclass, eta, transverseenergy, weight);
292  }
293  }
294  Double_t encuts[5] = {1., 2., 5., 10., 20.};
295  for(int ien = 0; ien < 5; ien++){
296  if(energy > encuts[ien]){
297  fHistos->FillTH2(TString::Format("hEtaPhi%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
298  if(hasTriggerPatch){
299  fHistos->FillTH2(TString::Format("hEtaPhiFired%dG", static_cast<int>(encuts[ien])) + triggerclass, eta, phi, weight);
300  }
301  }
302  }
303 }
304 
306  double v0amult = fInputEvent->GetVZEROData()->GetMTotV0A(),
307  trackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 0., TMath::TwoPi())),
308  emctrackletmult = static_cast<double>(CountTracklets(-0.8, 0.8, 1.4, TMath::Pi())),
309  itsclustermult = fInputEvent->GetMultiplicity()->GetNumberOfSPDClusters(),
310  emcclustermult = static_cast<double>(CountEmcalClusters(0.5)),
311  emccellocc = static_cast<double>(this->GetEMCALCellOccupancy(0.1));
312  for(const auto &t : fSelectedTriggers){
313  Double_t weight = GetTriggerWeight(t);
314  fHistos->FillTH1("hEventCount" + t, 1, weight);
315  fHistos->FillTH1("hEventCentrality" + t, fEventCentrality, weight);
316  fHistos->FillTH1("hVertexZ" + t, fVertex[2], weight);
317 
318  // Multiplicity correlation (no correction for downscaling)
320  double data[6] = {v0amult, trackletmult, emctrackletmult, itsclustermult, emcclustermult, emccellocc};
321  fHistos->FillTHnSparse("hMultiplicityCorrelation" + t, data);
322  }
323  }
324 }
325 
327  Bool_t hasfound = kFALSE;
328  for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
329  Double_t boundaries[4];
330  GetPatchBoundaries(*patchIter, boundaries);
331  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
332  etamax = TMath::Max(boundaries[0], boundaries[1]),
333  phimin = TMath::Min(boundaries[2], boundaries[3]),
334  phimax = TMath::Max(boundaries[2], boundaries[3]);
335  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
336  hasfound = kTRUE;
337  break;
338  }
339  }
340  return hasfound;
341 }
342 
343 void AliAnalysisTaskEmcalClustersRef::FindPatchesForTrigger(TString triggerclass, const TClonesArray * triggerPatches, TList &foundtriggers) const {
344  foundtriggers.Clear();
345  if(!triggerPatches) return;
347  if(triggerclass == "EG1") myclass = AliEmcalTriggerOfflineSelection::kTrgEG1;
348  if(triggerclass == "EG2") myclass = AliEmcalTriggerOfflineSelection::kTrgEG2;
349  if(triggerclass == "EJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ1;
350  if(triggerclass == "EJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ2;
351  if(triggerclass == "DMC7") myclass = AliEmcalTriggerOfflineSelection::kTrgDL0;
352  if(triggerclass == "DG1") myclass = AliEmcalTriggerOfflineSelection::kTrgDG1;
353  if(triggerclass == "DG2") myclass = AliEmcalTriggerOfflineSelection::kTrgDG2;
354  if(triggerclass == "DJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ1;
355  if(triggerclass == "DJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ2;
356  for(auto patchiter : *triggerPatches){
357  AliEMCALTriggerPatchInfo *mypatch = static_cast<AliEMCALTriggerPatchInfo *>(patchiter);
358  if(!mypatch->IsOfflineSimple()) continue;
360  if(!mypatch->IsDCalPHOS()) continue;
361  } else {
362  if(mypatch->IsDCalPHOS()) continue;
363  }
365  if(!mypatch->IsGammaLowSimple()) continue;
366  } else {
367  if(!mypatch->IsJetLowSimple()) continue;
368  }
369  double threshold = fTriggerSelection ? fTriggerSelection->GetThresholdForTrigger(myclass) : -1;
370  if(mypatch->GetPatchE() > threshold) foundtriggers.Add(patchiter);
371  }
372 }
373 
375  AliEMCALTriggerPatchInfo *patch= dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
376  boundaries[0] = patch->GetEtaMin();
377  boundaries[1] = patch->GetEtaMax();
378  boundaries[2] = patch->GetPhiMin();
379  boundaries[3] = patch->GetPhiMax();
380 }
381 
383  int nclusters = 0;
384  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
385  if(!clust->IsEMCAL()) continue;
386  if(clust->GetIsExotic()) continue;
387  if(clust->E() > ecut) nclusters++;
388  nclusters++;
389  }
390  return nclusters;
391 }
392 
393 int AliAnalysisTaskEmcalClustersRef::CountTracklets(double etamin, double etamax, double phimin, double phimax){
394  int ntracklets = 0;
395  AliVMultiplicity *mult = fInputEvent->GetMultiplicity();
396  for(int itl = 0; itl < mult->GetNumberOfTracklets(); itl++){
397  double eta = mult->GetEta(itl), phi = mult->GetPhi(itl);
398  if(!(eta > etamin && eta < etamax)) continue;
399  if(!(phi > phimin && phi < phimax)) continue;
400  ntracklets++;
401  }
402  return ntracklets;
403 }
404 
406  std::set<int> cellIDs;
407  AliVCaloCells *emccells = fInputEvent->GetEMCALCells();
408  for(short icell = 0; icell < emccells->GetNumberOfCells(); icell++){
409  if(emccells->GetAmplitude(icell) > ecut){
410  int cellID = emccells->GetCellNumber(icell);
411  if(cellIDs.find(cellID) == cellIDs.end()) cellIDs.insert(cellID);
412  }
413  }
414  return cellIDs.size();
415 }
416 
418  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
419 
420  //-------------------------------------------------------
421  // Init the task and do settings
422  //-------------------------------------------------------
423 
424  TString clusName(nclusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nclusters);
425 
426  TString taskname = "emcalClusterQA_" + suffix;
427 
429  task->AddClusterContainer(clusName);
430  task->SetClusterContainer(clusName);
431  mgr->AddTask(task);
432 
433  TString outfile(mgr->GetCommonFileName());
434  outfile += ":ClusterQA_" + TString(suffix);
435  TString containername = "ClusterResults_" + TString(suffix);
436  printf("Outfile: %s, container: %s\n", outfile.Data(), containername.Data());
437 
438  task->ConnectInput(0, mgr->GetCommonInputContainer());
439  mgr->ConnectOutput(task, 1, mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
440 
441  return task;
442 }
443 
445  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
446 
448  mgr->AddTask(task);
449 
450  // Adding cluster container
451  TString clusName(nClusters == "usedefault" ? AliEmcalAnalysisFactory::ClusterContainerNameFactory(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler")) : nClusters);
452  task->AddClusterContainer(clusName.Data());
453  task->SetClusterContainer(clusName);
454 
455  // Set Energy thresholds for additional patch selection:
456  // These are events with offline patches of a given type where the trigger reached already the plateau
457  // These numers are determined as:
458  // EMC7: 3.5 GeV
459  // EG1: 14 GeV
460  // EG2: 8 GeV
461  // EJ1: 22 GeV
462  // EJ2: 12 GeV
465  );
466 
467  TString outfile(mgr->GetCommonFileName());
468  outfile += ":ClusterQA";
469 
470  task->ConnectInput(0, mgr->GetCommonInputContainer());
471  mgr->ConnectOutput(task, 1, mgr->CreateContainer("ClusterResults", AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
472 
473  return task;
474 }
475 
476 
482 {
483  this->SetMinimum(0.);
484  this->AddStep(1, 0.05);
485  this->AddStep(2, 0.1);
486  this->AddStep(4, 0.2);
487  this->AddStep(7, 0.5);
488  this->AddStep(16, 1);
489  this->AddStep(32, 2);
490  this->AddStep(40, 4);
491  this->AddStep(50, 5);
492  this->AddStep(100, 10);
493  this->AddStep(200, 20);
494 }
495 
496 
497 } /* namespace EMCalTriggerPtAnalysis */
AliCutValueRange< double > fClusterTimeRange
Selected range on cluster time.
void GetPatchBoundaries(TObject *o, Double_t *boundaries) const
Get the boundaries of the trigger patch.
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
Check whether cluster is inside a trigger patch which has fired the trigger.
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.
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.
Bool_t fDoFillMultiplicityHistograms
Swich for multiplcity histograms.
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="")
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)
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
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
virtual void CreateUserHistos()
Creating histograms for the distributions monitored by the task.
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.