AliPhysics  c923f52 (c923f52)
 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 <sstream>
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 "AliAnalysisUtils.h"
34 #include "AliCentrality.h"
35 #include "AliClusterContainer.h"
36 #include "AliEMCALGeometry.h"
37 #include "AliEMCALTriggerPatchInfo.h"
39 #include "AliESDEvent.h"
40 #include "AliInputEventHandler.h"
41 #include "AliLog.h"
42 #include "AliOADBContainer.h"
43 #include "AliVCluster.h"
44 #include "AliVVertex.h"
45 #include "AliMultSelection.h"
46 #include "AliMultEstimator.h"
47 
49 
53 
54 namespace EMCalTriggerPtAnalysis {
55 
59 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
61  fTriggerSelection(nullptr),
62  fHistos(nullptr),
63  fAcceptTriggers(),
64  fNameClusterContainer(""),
65  fRequestAnalysisUtil(kTRUE),
66  fTriggerStringFromPatches(kFALSE),
67  fCentralityRange(-999., 999.),
68  fVertexRange(-999., 999.),
69  fRequestCentrality(false),
70  fNameDownscaleOADB(""),
71  fDownscaleOADB(nullptr),
72  fDownscaleFactors(nullptr)
73 {
74  SetNeedEmcalGeom(true);
75  SetCaloTriggerPatchInfoName("EmcalTriggers");
76 }
77 
83  AliAnalysisTaskEmcal(name, kTRUE),
84  fTriggerSelection(nullptr),
85  fHistos(nullptr),
86  fAcceptTriggers(),
87  fNameClusterContainer(""),
88  fRequestAnalysisUtil(kTRUE),
89  fTriggerStringFromPatches(kFALSE),
90  fCentralityRange(-999., 999.),
91  fVertexRange(-999., 999.),
92  fRequestCentrality(false),
93  fNameDownscaleOADB(""),
94  fDownscaleOADB(nullptr),
95  fDownscaleFactors(nullptr)
96 {
97  SetNeedEmcalGeom(true);
98  SetCaloTriggerPatchInfoName("EmcalTriggers");
99 }
100 
106 }
107 
113 
115  AliInfoStream() << "Creating histograms for task " << GetName() << std::endl;
116  fAliAnalysisUtils = new AliAnalysisUtils;
117  }
118 
119  EnergyBinning energybinning;
120  TLinearBinning smbinning(21, -0.5, 20.5), etabinning(100, -0.7, 0.7);
121 
122  fHistos = new THistManager("Ref");
123  /*
124  * Exclusive classes are defined as triggered events
125  * in a class without lower threshold classes firing.
126  * This is needed to make the triggers statistically
127  * independent.
128  */
129  std::array<TString, 21> triggers = {
130  "MB", "EMC7", "DMC7",
131  "EJ1", "EJ2", "EG1", "EG2", "DJ1", "DJ2", "DG1", "DG2",
132  "EMC7excl", "DMC7excl", "EG2excl", "EJ2excl", "DG2excl", "DJ2excl",
133  "EJ1excl", "DJ1excl", "EG1excl", "DG1excl"
134  };
135  std::array<Double_t, 5> encuts = {1., 2., 5., 10., 20.};
136  Int_t sectorsWithEMCAL[10] = {4, 5, 6, 7, 8, 9, 13, 14, 15, 16};
137  for(auto trg : triggers){
138  fHistos->CreateTH1(Form("hEventCount%s", trg.Data()), Form("Event count for trigger class %s", trg.Data()), 1, 0.5, 1.5);
139  fHistos->CreateTH1(Form("hEventCentrality%s", trg.Data()), Form("Event centrality for trigger class %s", trg.Data()), 103, -2., 101.);
140  fHistos->CreateTH1(Form("hVertexZ%s", trg.Data()), Form("z-position of the primary vertex for trigger class %s", trg.Data()), 200, -40., 40.);
141  fHistos->CreateTH1(Form("hClusterEnergy%s", trg.Data()), Form("Cluster energy for trigger class %s", trg.Data()), energybinning);
142  fHistos->CreateTH1(Form("hClusterET%s", trg.Data()), Form("Cluster transverse energy for trigger class %s", trg.Data()), energybinning);
143  fHistos->CreateTH1(Form("hClusterEnergyFired%s", trg.Data()), Form("Cluster energy for trigger class %s, firing the trigger", trg.Data()), energybinning);
144  fHistos->CreateTH1(Form("hClusterETFired%s", trg.Data()), Form("Cluster transverse energy for trigger class %s, firing the trigger", trg.Data()), energybinning);
145  fHistos->CreateTH2(Form("hClusterEnergySM%s", trg.Data()), Form("Cluster energy versus supermodule for trigger class %s", trg.Data()), smbinning, energybinning);
146  fHistos->CreateTH2(Form("hClusterETSM%s", trg.Data()), Form("Cluster transverse energy versus supermodule for trigger class %s", trg.Data()), smbinning, energybinning);
147  fHistos->CreateTH2(Form("hClusterEnergyFiredSM%s", trg.Data()), Form("Cluster energy versus supermodule for trigger class %s, firing the trigger", trg.Data()), smbinning, energybinning);
148  fHistos->CreateTH2(Form("hClusterETFiredSM%s", trg.Data()), Form("Cluster transverse energy versus supermodule for trigger class %s, firing the trigger", trg.Data()), smbinning, energybinning);
149  fHistos->CreateTH2(Form("hEtaEnergy%s", trg.Data()), Form("Cluster energy vs. eta for trigger class %s", trg.Data()), etabinning, energybinning);
150  fHistos->CreateTH2(Form("hEtaET%s", trg.Data()), Form("Cluster transverse energy vs. eta for trigger class %s", trg.Data()), etabinning, energybinning);
151  fHistos->CreateTH2(Form("hEtaEnergyFired%s", trg.Data()), Form("Cluster energy vs. eta for trigger class %s, firing the trigger", trg.Data()), etabinning, energybinning);
152  fHistos->CreateTH2(Form("hEtaETFired%s", trg.Data()), Form("Cluster transverse energy vs. eta for trigger class %s, firing the trigger", trg.Data()), etabinning, energybinning);
153  for(int ism = 0; ism < 20; ism++){
154  fHistos->CreateTH2(Form("hEtaEnergySM%d%s", ism, trg.Data()), Form("Cluster energy vs. eta in Supermodule %d for trigger %s", ism, trg.Data()), etabinning, energybinning);
155  fHistos->CreateTH2(Form("hEtaETSM%d%s", ism, trg.Data()), Form("Cluster transverse energy vs. eta in Supermodule %d for trigger %s", ism, trg.Data()), etabinning, energybinning);
156  fHistos->CreateTH2(Form("hEtaEnergyFiredSM%d%s", ism, trg.Data()), Form("Cluster energy vs. eta in Supermodule %d for trigger %s, firing the trigger", ism, trg.Data()), etabinning, energybinning);
157  fHistos->CreateTH2(Form("hEtaETFiredSM%d%s", ism, trg.Data()), Form("Cluster transverse energy vs. eta in Supermodule %d for trigger %s, firing the trigger", ism, trg.Data()), etabinning, energybinning);
158  }
159  for(int isec = 0; isec < 10; isec++){
160  fHistos->CreateTH2(Form("hEtaEnergySec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form("Cluster energy vs.eta in tracking sector %d for trigger %s", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning);
161  fHistos->CreateTH2(Form("hEtaETSec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form("Cluster transverse energy vs.eta in tracking sector %d for trigger %s", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning);
162  fHistos->CreateTH2(Form("hEtaEnergyFiredSec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form("Cluster energy vs.eta in tracking sector %d for trigger %s, firing the trigger", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning);
163  fHistos->CreateTH2(Form("hEtaETFiredSec%d%s", sectorsWithEMCAL[isec], trg.Data()), Form("Cluster transverse energy vs.eta in tracking sector %d for trigger %s, firing the trigger", sectorsWithEMCAL[isec], trg.Data()), etabinning, energybinning);
164  }
165  for(auto ien : encuts){
166  fHistos->CreateTH2(Form("hEtaPhi%dG%s", static_cast<int>(ien), trg.Data()), Form("cluster #eta-#phi map for clusters with energy larger than %f GeV/c for trigger class %s", ien, trg.Data()), 100, -0.7, 0.7, 200, 0, 2*TMath::Pi());
167  fHistos->CreateTH2(Form("hEtaPhiFired%dG%s", static_cast<int>(ien), trg.Data()), Form("cluster #eta-#phi map for clusters fired the trigger with energy larger than %f GeV/c for trigger class %s", ien, trg.Data()), 200, -0.7, 0.7, 200, 0, 2*TMath::Pi());
168  }
169  }
170  for(auto h : *(fHistos->GetListOfHistograms())) fOutput->Add(h);
171  PostData(1, fOutput);
172  AliDebugStream(1) << "End creating histograms" << std::endl;
173 }
174 
176  fAcceptTriggers.clear();
177  UInt_t selectionstatus = fInputHandler->IsEventSelected();
178  std::stringstream triggerdebug;
179  triggerdebug << "Offline bits: " << std::bitset<sizeof(UInt_t) * 8>(selectionstatus);
180  AliDebug(2, triggerdebug.str().c_str());
181  TString triggerstring = "";
184  } else {
185  triggerstring = fInputEvent->GetFiredTriggerClasses();
186  }
187  Bool_t isMinBias = selectionstatus & AliVEvent::kINT7,
188  isEJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ1"),
189  isEJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ2"),
190  isEG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG1"),
191  isEG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG2"),
192  isEMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("EMC7"),
193  isDJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("DJ1"),
194  isDJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("DJ2"),
195  isDG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("DG1"),
196  isDG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("DG2"),
197  isDMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("DMC7");
209  }
210  if(!(isMinBias || isEMC7 || isEG1 || isEG2 || isEJ1 || isEJ2 || isDMC7 || isDG1 || isDG2 || isDJ1 || isDJ2)){
211  AliDebugStream(1) << GetName() << ": Reject trigger" << std::endl;
212  return false;
213  }
214 
215  double centrality = -1;
216  AliDebugStream(1) << "Event selected" << std::endl;
217  if(fRequestCentrality){
218  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
219  if(!mult){
220  AliErrorStream() << GetName() << ": Centrality selection enabled but no centrality estimator found" << std::endl;
221  return false;
222  }
223  if(mult->IsEventSelected()) return false;
224  centrality = mult->GetEstimator("V0M")->GetPercentile();
225  AliDebugStream(1) << GetName() << ": Centrality " << centrality << std::endl;
226  if(!fCentralityRange.IsInRange(centrality)){
227  AliDebugStream(1) << GetName() << ": reject centrality: " << centrality << std::endl;
228  return false;
229  } else {
230  AliDebugStream(1) << GetName() << ": select centrality " << centrality << std::endl;
231  }
232  } else {
233  AliDebugStream(1) << GetName() << ": No centrality selection applied" << std::endl;
234  }
235  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
236  if(!vtx) vtx = fInputEvent->GetPrimaryVertexSPD();
237  //if(!fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.)) return; // reject pileup event
238  if(vtx->GetNContributors() < 1){
239  AliDebug(1, Form("%s: Reject contributors\n", GetName()));
240  return false;
241  }
242  // Fill reference distribution for the primary vertex before any z-cut
244  AliDebugStream(1) << GetName() << " : Reject analysis util" << std::endl;
245  if(fInputEvent->IsA() == AliESDEvent::Class() && fAliAnalysisUtils->IsFirstEventInChunk(fInputEvent)) return false;
246  if(!fAliAnalysisUtils->IsVertexSelected2013pA(fInputEvent)) return false; // Apply new vertex cut
247  if(fAliAnalysisUtils->IsPileUpEvent(fInputEvent)) return false; // Apply new vertex cut
248  }
249  // Apply vertex z cut
250  if(!fVertexRange.IsInRange(vtx->GetZ())){
251  AliDebugStream(1) << GetName() << ": Reject z[" << vtx->GetZ() << "]" << std::endl;
252  return false;
253  }
254 
255  // Do MC outlier cut
256  if(fIsPythia){
257  if(!CheckMCOutliers()){
258  AliDebugStream(1) << GetName() << ": Reject MC outliers" << std::endl;
259  return false;
260  }
261  }
262 
263  AliDebugStream(1) << GetName() << ": Event Selected" << std::endl;
264 
265  // Store trigger decision
266  if(isMinBias) fAcceptTriggers.push_back("MB");
267  if(isEMC7){
268  fAcceptTriggers.push_back("EMC7");
269  if(!isMinBias) fAcceptTriggers.push_back("EMC7excl");
270  }
271  if(isDMC7){
272  fAcceptTriggers.push_back("DMC7");
273  if(!isMinBias) fAcceptTriggers.push_back("DMC7excl");
274  }
275  if(isEG2){
276  fAcceptTriggers.push_back("EG2");
277  if(!(isMinBias || isEMC7)) fAcceptTriggers.push_back("EG2excl");
278  }
279  if(isEG1){
280  fAcceptTriggers.push_back("EG1");
281  if(!(isMinBias || isEMC7 || isEG2)) fAcceptTriggers.push_back("EG1excl");
282  }
283  if(isDG2){
284  fAcceptTriggers.push_back("DG2");
285  if(!(isMinBias || isDMC7)) fAcceptTriggers.push_back("DG2excl");
286  }
287  if(isDG1){
288  fAcceptTriggers.push_back("DG1");
289  if(!(isMinBias || isDMC7 || isDG2)) fAcceptTriggers.push_back("DG1excl");
290  }
291  if(isEJ2){
292  fAcceptTriggers.push_back("EJ2");
293  if(!(isMinBias || isEMC7)) fAcceptTriggers.push_back("EJ2excl");
294  }
295  if(isEJ1){
296  fAcceptTriggers.push_back("EJ1");
297  if(!(isMinBias || isEMC7 || isEJ2)) fAcceptTriggers.push_back("EJ1excl");
298  }
299  if(isDJ2){
300  fAcceptTriggers.push_back("DJ2");
301  if(!(isMinBias || isDMC7)) fAcceptTriggers.push_back("DJ2excl");
302  }
303  if(isDJ1){
304  fAcceptTriggers.push_back("DJ1");
305  if(!(isMinBias || isDMC7 || isDJ2)) fAcceptTriggers.push_back("DJ1excl");
306  }
307 
308  return true;
309 }
310 
311 
317  AliDebugStream(1) << GetName() << ": UserExec start" << std::endl;
318 
319  double centrality = -1;
320  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
321  if(mult && mult->IsEventSelected()) centrality = mult->GetEstimator("V0M")->GetPercentile();
322 
323 
324  // Fill Event counter and reference vertex distributions for the different trigger classes
325  for(const auto &trg : fAcceptTriggers) FillEventHistograms(trg.c_str(), centrality, fVertex[2]);
326 
327 
328  /*
329  TList *objects = fInputEvent->GetList();
330  for(TIter objiter = TIter(objects).Begin(); objiter != TIter::End(); ++ objiter){
331  printf("Object %s\n", (*objiter)->GetName());
332  }
333  */
334 
335  TList ej1patches, dj1patches, ej2patches, dj2patches, eg1patches, dg1patches, eg2patches, dg2patches;
336  FindPatchesForTrigger("EJ2", fTriggerPatchInfo, ej2patches);
337  FindPatchesForTrigger("DJ2", fTriggerPatchInfo, dj2patches);
338  FindPatchesForTrigger("EJ1", fTriggerPatchInfo, ej1patches);
339  FindPatchesForTrigger("DJ1", fTriggerPatchInfo, dj1patches);
340  FindPatchesForTrigger("EG2", fTriggerPatchInfo, eg2patches);
341  FindPatchesForTrigger("DG2", fTriggerPatchInfo, dg2patches);
342  FindPatchesForTrigger("EG1", fTriggerPatchInfo, eg1patches);
343  FindPatchesForTrigger("DG1", fTriggerPatchInfo, dg1patches);
344 
345 
346  Double_t energy, et, eta, phi;
347  TList *selpatches(nullptr);
348  for(auto clust : GetClusterContainer(fNameClusterContainer.Data())->all()){
349  //AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
350  if(!clust->IsEMCAL()) continue;
351  if(clust->GetIsExotic()) continue;
352 
353  TLorentzVector posvec;
354  energy = clust->GetNonLinCorrEnergy();
355  et = posvec.Et();
356  clust->GetMomentum(posvec, fVertex);
357  eta = posvec.Eta();
358  phi = posvec.Phi();
359 
360  // fill histograms allEta
361  for(const auto & trg : fAcceptTriggers){
362  selpatches = nullptr;
363  if(trg.find("EJ2") != std::string::npos) selpatches = &ej2patches;
364  if(trg.find("DJ2") != std::string::npos) selpatches = &dj2patches;
365  if(trg.find("EJ1") != std::string::npos) selpatches = &ej1patches;
366  if(trg.find("DJ1") != std::string::npos) selpatches = &dj1patches;
367  if(trg.find("EG2") != std::string::npos) selpatches = &eg2patches;
368  if(trg.find("DG2") != std::string::npos) selpatches = &dg2patches;
369  if(trg.find("EG1") != std::string::npos) selpatches = &eg1patches;
370  if(trg.find("DG1") != std::string::npos) selpatches = &dg1patches;
371  FillClusterHistograms(trg.c_str(), energy, et, eta, phi, nullptr);
372  }
373  }
374  return true;
375 }
376 
379  if(!fLocalInitialized) return;
380 
381  // Handle OADB container with downscaling factors
382  if(fNameDownscaleOADB.Length()){
383  if(fNameDownscaleOADB.Contains("alien://") && ! gGrid) TGrid::Connect("alien://");
384  fDownscaleOADB = new AliOADBContainer("AliEmcalDownscaleFactors");
385  fDownscaleOADB->InitFromFile(fNameDownscaleOADB.Data(), "AliEmcalDownscaleFactors");
386  }
387 }
388 
390  if(fDownscaleOADB){
391  fDownscaleFactors = static_cast<TObjArray *>(fDownscaleOADB->GetObject(runnumber));
392  }
393 }
394 
404  if(fDownscaleFactors){
405  TParameter<double> *result(nullptr);
406  // Downscaling only done on MB, L0 and the low threshold triggers
407  if(triggerclass.Contains("MB")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("INT7"));
408  else if(triggerclass.Contains("EMC7")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EMC7"));
409  else if(triggerclass.Contains("EJ2")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EJ2"));
410  else if(triggerclass.Contains("EG2")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EG2"));
411  if(result) return 1./result->GetVal();
412  }
413  return 1.;
414 }
415 
416 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(const TString &triggerclass, double energy, double transverseenergy, double eta, double phi, TList *fTriggerPatches){
417  Bool_t hasTriggerPatch = fTriggerPatches ? CorrelateToTrigger(eta, phi, fTriggerPatches) : kFALSE;
418  Int_t supermoduleID = -1, sector = -1;
419  Double_t weight = GetTriggerWeight(triggerclass);
420  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << std::endl;
421 
422  fGeom->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
423  fHistos->FillTH1(Form("hClusterEnergy%s", triggerclass.Data()), energy, weight);
424  fHistos->FillTH1(Form("hClusterET%s", triggerclass.Data()), transverseenergy, weight);
425  fHistos->FillTH2(Form("hEtaEnergy%s", triggerclass.Data()), eta, energy, weight);
426  fHistos->FillTH2(Form("hEtaET%s", triggerclass.Data()), eta, transverseenergy, weight);
427  if(supermoduleID >= 0){
428  fHistos->FillTH2(Form("hClusterEnergySM%s", triggerclass.Data()), supermoduleID, energy, weight);
429  fHistos->FillTH2(Form("hClusterETSM%s", triggerclass.Data()), supermoduleID, transverseenergy, weight);
430  fHistos->FillTH2(Form("hEtaEnergySM%d%s", supermoduleID, triggerclass.Data()), eta, energy, weight);
431  fHistos->FillTH2(Form("hEtaETSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy, weight);
432  if(supermoduleID < 12)
433  sector = 4 + int(supermoduleID/2); // EMCAL
434  else
435  sector = 13 + int((supermoduleID-12)/2); // DCAL
436  fHistos->FillTH2(Form("hEtaEnergySec%d%s", sector, triggerclass.Data()), eta, energy, weight);
437  fHistos->FillTH2(Form("hEtaETSec%d%s", sector, triggerclass.Data()), eta, transverseenergy, weight);
438  }
439  if(hasTriggerPatch){
440  fHistos->FillTH1(Form("hClusterEnergyFired%s", triggerclass.Data()), energy, weight);
441  fHistos->FillTH1(Form("hClusterETFired%s", triggerclass.Data()), energy, weight);
442  fHistos->FillTH2(Form("hEtaEnergyFired%s", triggerclass.Data()), eta, energy, weight);
443  fHistos->FillTH2(Form("hEtaETFired%s", triggerclass.Data()), eta, energy, weight);
444  if(supermoduleID >= 0){
445  fHistos->FillTH2(Form("hClusterEnergyFiredSM%s", triggerclass.Data()), supermoduleID, energy, weight);
446  fHistos->FillTH2(Form("hClusterETFiredSM%s", triggerclass.Data()), supermoduleID, transverseenergy, weight);
447  fHistos->FillTH2(Form("hEtaEnergyFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, energy,weight);
448  fHistos->FillTH2(Form("hEtaETFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy, weight);
449  fHistos->FillTH2(Form("hEtaEnergyFiredSec%d%s", sector, triggerclass.Data()), eta, energy, weight);
450  fHistos->FillTH2(Form("hEtaETFiredSec%d%s", sector, triggerclass.Data()), eta, transverseenergy, weight);
451  }
452  }
453  Double_t encuts[5] = {1., 2., 5., 10., 20.};
454  for(int ien = 0; ien < 5; ien++){
455  if(energy > encuts[ien]){
456  fHistos->FillTH2(Form("hEtaPhi%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi, weight);
457  if(hasTriggerPatch){
458  fHistos->FillTH2(Form("hEtaPhiFired%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi, weight);
459  }
460  }
461  }
462 }
463 
475 void AliAnalysisTaskEmcalClustersRef::FillEventHistograms(const TString &triggerclass, double centrality, double vertexz){
476  Double_t weight = GetTriggerWeight(triggerclass);
477  fHistos->FillTH1(Form("hEventCount%s", triggerclass.Data()), 1, weight);
478  fHistos->FillTH1(Form("hEventCentrality%s", triggerclass.Data()), centrality, weight);
479  fHistos->FillTH1(Form("hVertexZ%s", triggerclass.Data()), vertexz, weight);
480 }
481 
490  Bool_t hasfound = kFALSE;
491  for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
492  Double_t boundaries[4];
493  GetPatchBoundaries(*patchIter, boundaries);
494  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
495  etamax = TMath::Max(boundaries[0], boundaries[1]),
496  phimin = TMath::Min(boundaries[2], boundaries[3]),
497  phimax = TMath::Max(boundaries[2], boundaries[3]);
498  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
499  hasfound = kTRUE;
500  break;
501  }
502  }
503  return hasfound;
504 }
505 
514 void AliAnalysisTaskEmcalClustersRef::FindPatchesForTrigger(TString triggerclass, const TClonesArray * fTriggerPatches, TList &foundtriggers) const {
515  foundtriggers.Clear();
516  if(!fTriggerPatches) return;
518  if(triggerclass == "EG1") myclass = AliEmcalTriggerOfflineSelection::kTrgEG1;
519  if(triggerclass == "EG2") myclass = AliEmcalTriggerOfflineSelection::kTrgEG2;
520  if(triggerclass == "EJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ1;
521  if(triggerclass == "EJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ2;
522  if(triggerclass == "DMC7") myclass = AliEmcalTriggerOfflineSelection::kTrgDL0;
523  if(triggerclass == "DG1") myclass = AliEmcalTriggerOfflineSelection::kTrgDG1;
524  if(triggerclass == "DG2") myclass = AliEmcalTriggerOfflineSelection::kTrgDG2;
525  if(triggerclass == "DJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ1;
526  if(triggerclass == "DJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ2;
527  for(TIter patchiter = TIter(fTriggerPatches).Begin(); patchiter != TIter::End(); ++patchiter){
528  if(!IsOfflineSimplePatch(*patchiter)) continue;
530  if(!SelectDCALPatch(*patchiter)) continue;
531  } else {
532  if(SelectDCALPatch(*patchiter)) continue;
533  }
535  if(!SelectSingleShowerPatch(*patchiter)) continue;
536  } else {
537  if(!SelectJetPatch(*patchiter)) continue;
538  }
539  double threshold = fTriggerSelection ? fTriggerSelection->GetThresholdForTrigger(myclass) : -1;
540  if(GetPatchEnergy(*patchiter) > threshold) foundtriggers.Add(*patchiter);
541  }
542 }
543 
550  TString triggerstring = "";
551  if(!fTriggerPatches) return triggerstring;
552  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0, nDJ1 = 0, nDJ2 = 0, nDG1 = 0, nDG2 = 0;
553  double minADC_J1 = 260.,
554  minADC_J2 = 127.,
555  minADC_G1 = 140.,
556  minADC_G2 = 89.;
557  for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
558  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
559  if(!patch->IsOfflineSimple()) continue;
560  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_J1){
561  if(patch->IsDCalPHOS()) nDJ1++;
562  else nEJ1++;
563  }
564  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_J2){
565  if(patch->IsDCalPHOS()) nDJ2++;
566  else nEJ2++;
567  }
568  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_G1){
569  if(patch->IsDCalPHOS()) nDG1++;
570  else nEG1++;
571  }
572  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_G2){
573  if(patch->IsDCalPHOS()) nDG2++;
574  else nEG2++;
575  }
576  }
577  if(nEJ1) triggerstring += "EJ1";
578  if(nEJ2){
579  if(triggerstring.Length()) triggerstring += ",";
580  triggerstring += "EJ2";
581  }
582  if(nEG1){
583  if(triggerstring.Length()) triggerstring += ",";
584  triggerstring += "EG1";
585  }
586  if(nEG2){
587  if(triggerstring.Length()) triggerstring += ",";
588  triggerstring += "EG2";
589  }
590  if(nDJ1){
591  if(triggerstring.Length()) triggerstring += ",";
592  triggerstring += "DJ1";
593  }
594  if(nDJ2){
595  if(triggerstring.Length()) triggerstring += ",";
596  triggerstring += "DJ2";
597  }
598  if(nDG1){
599  if(triggerstring.Length()) triggerstring += ",";
600  triggerstring += "DG1";
601  }
602  if(nDG2){
603  if(triggerstring.Length()) triggerstring += ",";
604  triggerstring += "DG2";
605  }
606  return triggerstring;
607 }
608 
610  AliEMCALTriggerPatchInfo *patch= dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
611  boundaries[0] = patch->GetEtaMin();
612  boundaries[1] = patch->GetEtaMax();
613  boundaries[2] = patch->GetPhiMin();
614  boundaries[3] = patch->GetPhiMax();
615 }
616 
618  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
619  return patch->IsOfflineSimple();
620 }
621 
623  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
624  return patch->GetRowStart() >= 64;
625 }
626 
628  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
629  return patch->IsGammaLowSimple();
630 }
631 
633  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
634  if(!patch->IsOfflineSimple()) return false;
635  return patch->IsJetLowSimple();
636 }
637 
639  double energy = 0.;
640  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
641  energy = patch->GetPatchE();
642  return energy;
643 }
644 
650 {
651  this->SetMinimum(0.);
652  this->AddStep(1, 0.05);
653  this->AddStep(2, 0.1);
654  this->AddStep(4, 0.2);
655  this->AddStep(7, 0.5);
656  this->AddStep(16, 1);
657  this->AddStep(32, 2);
658  this->AddStep(40, 4);
659  this->AddStep(50, 5);
660  this->AddStep(100, 10);
661  this->AddStep(200, 20);
662 }
663 
664 
665 } /* namespace EMCalTriggerPtAnalysis */
void GetPatchBoundaries(TObject *o, Double_t *boundaries) const
Bool_t fIsPythia
trigger, if it is a PYTHIA production
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
Base task in the EMCAL framework.
Bool_t fLocalInitialized
whether or not the task has been already initialized
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
centrality
Bool_t fRequestCentrality
Swich on request for centrality range.
static Bool_t IsDCAL(EmcalTriggerClass cls)
void FillEventHistograms(const TString &triggerclass, double centrality, double vertexz)
void AddStep(Double_t max, Double_t binwidth)
std::vector< std::string > fAcceptTriggers
! Temporary container with list of selected triggers
void FillClusterHistograms(const TString &triggerclass, double energy, double transversenergy, double eta, double phi, TList *triggerpatches)
AliEmcalTriggerOfflineSelection * fTriggerSelection
EMCAL offline trigger selection tool.
void SetCaloTriggerPatchInfoName(const char *n)
const Double_t etamin
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
int Int_t
Definition: External.C:63
TString fNameClusterContainer
Name of the cluster container in the event.
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
AliEMCALGeometry * fGeom
!emcal geometry
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
Bool_t fTriggerStringFromPatches
Build trigger string from trigger patches.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Helper class creating user defined custom binning.
AliOADBContainer * fDownscaleOADB
! Container with downscale factors for different triggers
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
energy
Bool_t IsOfflineSelected(EmcalTriggerClass trgcls, const TClonesArray *const triggerpatches) const
AliEmcalList * fOutput
!output list
Double_t fVertex[3]
!event vertex
AliCutValueRange< double > fCentralityRange
Selected centrality range.
const Double_t etamax
TClonesArray * fTriggerPatchInfo
!trigger patch info array
TString GetFiredTriggerClassesFromPatches(const TClonesArray *triggerpatches) const
void SetNeedEmcalGeom(Bool_t n)
AliCutValueRange< double > fVertexRange
Selected vertex range.
Container class for histograms for the high- charged particle analysis.
Definition: THistManager.h:43
Bool_t fRequestAnalysisUtil
Switch on request for event selection using analysis utils.
bool Bool_t
Definition: External.C:53
TString fNameDownscaleOADB
Name of the downscale OADB container.
static Bool_t IsSingleShower(EmcalTriggerClass cls)
ClassImp(AliAnalysisTaskCascadeTester) AliAnalysisTaskCascadeTester
const Double_t phimin
void FindPatchesForTrigger(TString triggerclass, const TClonesArray *triggerpatches, TList &foundpatches) const
void SetMinimum(Double_t min)