AliPhysics  32b88a8 (32b88a8)
 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 "AliEMCALGeometry.h"
36 #include "AliEMCALTriggerPatchInfo.h"
38 #include "AliESDEvent.h"
39 #include "AliInputEventHandler.h"
40 #include "AliLog.h"
41 #include "AliOADBContainer.h"
42 #include "AliVCluster.h"
43 #include "AliVVertex.h"
44 #include "AliMultSelection.h"
45 #include "AliMultEstimator.h"
46 
48 
52 
53 namespace EMCalTriggerPtAnalysis {
54 
58 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
60  fAnalysisUtil(nullptr),
61  fTriggerSelection(nullptr),
62  fHistos(nullptr),
63  fGeometry(nullptr),
64  fTriggerPatches(nullptr),
65  fClusterContainer(""),
66  fRequestAnalysisUtil(kTRUE),
67  fTriggerStringFromPatches(kFALSE),
68  fCentralityRange(-999., 999.),
69  fVertexRange(-999., 999.),
70  fRequestCentrality(false),
71  fNameDownscaleOADB(""),
72  fDownscaleOADB(nullptr),
73  fDownscaleFactors(nullptr),
74  fCurrentRun(-1),
75  fInitialized(false)
76 {
77 }
78 
84  AliAnalysisTaskSE(name),
85  fAnalysisUtil(),
86  fTriggerSelection(nullptr),
87  fHistos(nullptr),
88  fGeometry(nullptr),
89  fTriggerPatches(nullptr),
90  fClusterContainer(""),
91  fRequestAnalysisUtil(kTRUE),
92  fTriggerStringFromPatches(kFALSE),
93  fCentralityRange(-999., 999.),
94  fVertexRange(-999., 999.),
95  fRequestCentrality(false),
96  fNameDownscaleOADB(""),
97  fDownscaleOADB(nullptr),
98  fDownscaleFactors(nullptr),
99  fCurrentRun(-1),
100  fInitialized(false)
101 {
102  DefineOutput(1, TList::Class());
103 }
104 
110 }
111 
116  AliInfoStream() << "Creating histograms for task " << GetName() << std::endl;
117  fAnalysisUtil = new AliAnalysisUtils;
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  PostData(1, fHistos->GetListOfHistograms());
171  AliDebugStream(1) << "End creating histograms" << std::endl;
172 }
173 
174 
180  AliDebugStream(1) << GetName() << ": UserExec start" << std::endl;
181  if(!fInitialized){
182  AliInfoStream() << GetName() << ": Initializing ..." << std::endl;
183  ExecOnce();
184  fInitialized = kTRUE;
185  }
186  if(fCurrentRun != InputEvent()->GetRunNumber()){
187  AliInfoStream() << GetName() << ": Changing run from " << fCurrentRun << " to " << InputEvent()->GetRunNumber() << std::endl;
188  RunChanged(InputEvent()->GetRunNumber());
189  fCurrentRun = InputEvent()->GetRunNumber();
190  }
191 
192  TString triggerstring = "";
195  } else {
196  triggerstring = fInputEvent->GetFiredTriggerClasses();
197  }
198 
199  UInt_t selectionstatus = fInputHandler->IsEventSelected();
200  std::stringstream triggerdebug;
201  triggerdebug << "Offline bits: " << std::bitset<sizeof(UInt_t) * 8>(selectionstatus);
202  AliDebug(2, triggerdebug.str().c_str());
203  Bool_t isMinBias = selectionstatus & AliVEvent::kINT7,
204  isEJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ1"),
205  isEJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ2"),
206  isEG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG1"),
207  isEG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG2"),
208  isEMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("EMC7"),
209  isDJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("DJ1"),
210  isDJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("DJ2"),
211  isDG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("DG1"),
212  isDG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("DG2"),
213  isDMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("DMC7");
225  }
226  if(!(isMinBias || isEMC7 || isEG1 || isEG2 || isEJ1 || isEJ2 || isDMC7 || isDG1 || isDG2 || isDJ1 || isDJ2)){
227  AliDebugStream(1) << GetName() << ": Reject trigger" << std::endl;
228  return;
229  }
230  double centrality = -1;
231  AliDebugStream(1) << "Event selected" << std::endl;
232  if(fRequestCentrality){
233  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
234  if(!mult){
235  AliErrorStream() << GetName() << ": Centrality selection enabled but no centrality estimator found" << std::endl;
236  return;
237  }
238  if(mult->IsEventSelected()) return;
239  centrality = mult->GetEstimator("V0M")->GetPercentile();
240  AliDebugStream(1) << GetName() << ": Centrality " << centrality << std::endl;
241  if(!fCentralityRange.IsInRange(centrality)){
242  AliDebugStream(1) << GetName() << ": reject centrality: " << centrality << std::endl;
243  return;
244  } else {
245  AliDebugStream(1) << GetName() << ": select centrality " << centrality << std::endl;
246  }
247  } else {
248  AliDebugStream(1) << GetName() << ": No centrality selection applied" << std::endl;
249  }
250  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
251  if(!vtx) vtx = fInputEvent->GetPrimaryVertexSPD();
252  //if(!fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.)) return; // reject pileup event
253  if(vtx->GetNContributors() < 1){
254  AliDebug(1, Form("%s: Reject contributors\n", GetName()));
255  return;
256  }
257  // Fill reference distribution for the primary vertex before any z-cut
259  AliDebugStream(1) << GetName() << " : Reject analysis util" << std::endl;
260  if(fInputEvent->IsA() == AliESDEvent::Class() && fAnalysisUtil->IsFirstEventInChunk(fInputEvent)) return;
261  if(!fAnalysisUtil->IsVertexSelected2013pA(fInputEvent)) return; // Apply new vertex cut
262  if(fAnalysisUtil->IsPileUpEvent(fInputEvent)) return; // Apply new vertex cut
263  }
264  // Apply vertex z cut
265  if(!fVertexRange.IsInRange(vtx->GetZ())){
266  AliDebugStream(1) << GetName() << ": Reject z[" << vtx->GetZ() << "]" << std::endl;
267  return;
268  }
269  AliDebugStream(1) << GetName() << ": Event Selected" << std::endl;
270 
271  // Fill Event counter and reference vertex distributions for the different trigger classes
272  if(isMinBias) FillEventHistograms("MB", centrality, vtx->GetZ());
273 
274  if(isEMC7){
275  FillEventHistograms("EMC7", centrality, vtx->GetZ());
276  // Check for exclusive classes
277  if(!(isMinBias)) FillEventHistograms("EMC7excl", centrality, vtx->GetZ());
278  }
279  if(isDMC7){
280  FillEventHistograms("DMC7", centrality, vtx->GetZ());
281  // Check for exclusive classes
282  if(!(isMinBias)) FillEventHistograms("DMC7excl", centrality, vtx->GetZ());
283  }
284 
285  if(isEJ2){
286  FillEventHistograms("EJ2", centrality, vtx->GetZ());
287  // Check for exclusive classes
288  if(!(isMinBias || isEMC7)) FillEventHistograms("EJ2excl", centrality, vtx->GetZ());
289  }
290  if(isDJ2){
291  FillEventHistograms("DJ2", centrality, vtx->GetZ());
292  // Check for exclusive classes
293  if(!(isMinBias || isDMC7)) FillEventHistograms("DJ2excl", centrality, vtx->GetZ());
294  }
295 
296  if(isEJ1){
297  FillEventHistograms("EJ1", centrality, vtx->GetZ());
298  // Check for exclusive classes
299  if(!(isMinBias || isEMC7 || isEJ2)) FillEventHistograms("EJ1excl", centrality, vtx->GetZ());
300  }
301 
302  if(isDJ1){
303  FillEventHistograms("DJ1", centrality, vtx->GetZ());
304  // Check for exclusive classes
305  if(!(isMinBias || isDMC7 || isDJ2)) FillEventHistograms("DJ1excl", centrality, vtx->GetZ());
306  }
307 
308  if(isEG2){
309  FillEventHistograms("EG2", centrality, vtx->GetZ());
310  // Check for exclusive classes
311  if(!(isMinBias || isEMC7)) FillEventHistograms("EG2excl", centrality, vtx->GetZ());
312  }
313  if(isDG2){
314  FillEventHistograms("DG2", centrality, vtx->GetZ());
315  // Check for exclusive classes
316  if(!(isMinBias || isDMC7)) FillEventHistograms("DG2excl", centrality, vtx->GetZ());
317  }
318 
319  if(isEG1){
320  FillEventHistograms("EG1", centrality, vtx->GetZ());
321  // Check for exclusive classes
322  if(!(isMinBias || isEMC7 || isEG1)) FillEventHistograms("EG1excl", centrality, vtx->GetZ());
323  }
324  if(isDG1){
325  FillEventHistograms("DG1", centrality, vtx->GetZ());
326  // Check for exclusive classes
327  if(!(isMinBias || isDMC7 || isDG1)) FillEventHistograms("DG1excl", centrality, vtx->GetZ());
328  }
329 
330  /*
331  TList *objects = fInputEvent->GetList();
332  for(TIter objiter = TIter(objects).Begin(); objiter != TIter::End(); ++ objiter){
333  printf("Object %s\n", (*objiter)->GetName());
334  }
335  */
336 
337  TObjArray clusterEvent(1000);
338 
339  TCollection *clusterArray = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(fClusterContainer.Data()));
340  if(!clusterArray){
341  AliError(Form("Cluster array with name %s not found in the event", fClusterContainer.Data()));
342  for(int icl = 0; icl < fInputEvent->GetNumberOfCaloClusters(); icl++){
343  clusterEvent.Add(fInputEvent->GetCaloCluster(icl));
344  }
345  clusterArray = &clusterEvent;
346  }
347 
348  Double_t vertexpos[3];
349  fInputEvent->GetPrimaryVertex()->GetXYZ(vertexpos);
350 
351  Double_t energy, et, eta, phi;
352  for(TIter clustIter = TIter(clusterArray).Begin(); clustIter != TIter::End(); ++clustIter){
353  AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
354  if(!clust->IsEMCAL()) continue;
355  if(clust->GetIsExotic()) continue;
356 
357  TLorentzVector posvec;
358  energy = clust->GetNonLinCorrEnergy();
359  et = posvec.Et();
360  clust->GetMomentum(posvec, vertexpos);
361  eta = posvec.Eta();
362  phi = posvec.Phi();
363 
364  // fill histograms allEta
365  if(isMinBias){
366  FillClusterHistograms("MB", energy, et, eta, phi, nullptr);
367  }
368  if(isEMC7){
369  FillClusterHistograms("EMC7", energy, et, eta, phi, nullptr);
370  // check for exclusive classes
371  if(!isMinBias){
372  FillClusterHistograms("EMC7excl", energy, et, eta, phi, nullptr);
373  }
374  }
375  if(isDMC7){
376  FillClusterHistograms("DMC7", energy, et, eta, phi, nullptr);
377  // check for exclusive classes
378  if(!isMinBias){
379  FillClusterHistograms("DMC7excl", energy, et, eta, phi, nullptr);
380  }
381  }
382  if(isEJ2){
383  TList ej2patches;
384  FindPatchesForTrigger("EJ2", fTriggerPatches, ej2patches);
385  FillClusterHistograms("EJ2", energy, et, eta, phi, &ej2patches);
386  // check for exclusive classes
387  if(!(isMinBias || isEMC7)){
388  FillClusterHistograms("EJ2excl", energy, et, eta, phi, &ej2patches);
389  }
390  }
391  if(isDJ2){
392  TList dj2patches;
393  FindPatchesForTrigger("DJ2", fTriggerPatches, dj2patches);
394  FillClusterHistograms("DJ2", energy, et, eta, phi, &dj2patches);
395  // check for exclusive classes
396  if(!(isMinBias || isDMC7)){
397  FillClusterHistograms("DJ2excl", energy, et, eta, phi, &dj2patches);
398  }
399  }
400  if(isEJ1){
401  TList ej1patches;
402  FindPatchesForTrigger("EJ1", fTriggerPatches, ej1patches);
403  FillClusterHistograms("EJ1", energy, et, eta, phi, &ej1patches);
404  // check for exclusive classes
405  if(!(isMinBias || isEMC7 || isEJ2)){
406  FillClusterHistograms("EJ1excl", energy, et, eta, phi, &ej1patches);
407  }
408  }
409  if(isDJ1){
410  TList dj1patches;
411  FindPatchesForTrigger("DJ1", fTriggerPatches, dj1patches);
412  FillClusterHistograms("DJ1", energy, et, eta, phi, &dj1patches);
413  // check for exclusive classes
414  if(!(isMinBias || isEMC7 || isDJ2)){
415  FillClusterHistograms("DJ1excl", energy, et, eta, phi, &dj1patches);
416  }
417  }
418  if(isEG2){
419  TList eg2patches;
420  FindPatchesForTrigger("EG2", fTriggerPatches, eg2patches);
421  FillClusterHistograms("EG2", energy, et, eta, phi, &eg2patches);
422  // check for exclusive classes
423  if(!(isMinBias || isEMC7)){
424  FillClusterHistograms("EG2excl", energy, et, eta, phi, &eg2patches);
425  }
426  }
427  if(isDG2){
428  TList dg2patches;
429  FindPatchesForTrigger("DG2", fTriggerPatches, dg2patches);
430  FillClusterHistograms("DG2", energy, et, eta, phi, &dg2patches);
431  // check for exclusive classes
432  if(!(isMinBias || isDMC7)){
433  FillClusterHistograms("DG2excl", energy, et, eta, phi, &dg2patches);
434  }
435  }
436  if(isEG1){
437  TList eg1patches;
438  FindPatchesForTrigger("EG1", fTriggerPatches, eg1patches);
439  FillClusterHistograms("EG1", energy, et, eta, phi, &eg1patches);
440  // check for exclusive classes
441  if(!(isMinBias || isDMC7 || isEG2)){
442  FillClusterHistograms("EG1excl", energy, et, eta, phi, &eg1patches);
443  }
444  }
445  if(isDG1){
446  TList dg1patches;
447  FindPatchesForTrigger("DG1", fTriggerPatches, dg1patches);
448  FillClusterHistograms("DG1", energy, et, eta, phi, &dg1patches);
449  // check for exclusive classes
450  if(!(isMinBias || isDMC7 || isDG2)){
451  FillClusterHistograms("DG1excl", energy, et, eta, phi, &dg1patches);
452  }
453  }
454  }
455  PostData(1, fHistos->GetListOfHistograms());
456 }
457 
459  if(!fGeometry){
460  fGeometry = AliEMCALGeometry::GetInstance();
461  if(!fGeometry)
462  fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
463  }
464  fTriggerPatches = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject("EmcalTriggers"));
465  // Handle OADB container with downscaling factors
466  if(fNameDownscaleOADB.Length()){
467  if(fNameDownscaleOADB.Contains("alien://") && ! gGrid) TGrid::Connect("alien://");
468  fDownscaleOADB = new AliOADBContainer("AliEmcalDownscaleFactors");
469  fDownscaleOADB->InitFromFile(fNameDownscaleOADB.Data(), "AliEmcalDownscaleFactors");
470  }
471 }
472 
474  if(fDownscaleOADB){
475  fDownscaleFactors = static_cast<TObjArray *>(fDownscaleOADB->GetObject(runnumber));
476  }
477 }
478 
488  if(fDownscaleFactors){
489  TParameter<double> *result(nullptr);
490  // Downscaling only done on MB, L0 and the low threshold triggers
491  if(triggerclass.Contains("MB")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("INT7"));
492  else if(triggerclass.Contains("EMC7")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EMC7"));
493  else if(triggerclass.Contains("EJ2")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EJ2"));
494  else if(triggerclass.Contains("EG2")) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EG2"));
495  if(result) return 1./result->GetVal();
496  }
497  return 1.;
498 }
499 
500 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(const TString &triggerclass, double energy, double transverseenergy, double eta, double phi, TList *fTriggerPatches){
501  Bool_t hasTriggerPatch = fTriggerPatches ? CorrelateToTrigger(eta, phi, fTriggerPatches) : kFALSE;
502  Int_t supermoduleID = -1, sector = -1;
503  Double_t weight = GetTriggerWeight(triggerclass);
504  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << std::endl;
505 
506  fGeometry->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
507  fHistos->FillTH1(Form("hClusterEnergy%s", triggerclass.Data()), energy, weight);
508  fHistos->FillTH1(Form("hClusterET%s", triggerclass.Data()), transverseenergy, weight);
509  fHistos->FillTH2(Form("hEtaEnergy%s", triggerclass.Data()), eta, energy, weight);
510  fHistos->FillTH2(Form("hEtaET%s", triggerclass.Data()), eta, transverseenergy, weight);
511  if(supermoduleID >= 0){
512  fHistos->FillTH2(Form("hClusterEnergySM%s", triggerclass.Data()), supermoduleID, energy, weight);
513  fHistos->FillTH2(Form("hClusterETSM%s", triggerclass.Data()), supermoduleID, transverseenergy, weight);
514  fHistos->FillTH2(Form("hEtaEnergySM%d%s", supermoduleID, triggerclass.Data()), eta, energy, weight);
515  fHistos->FillTH2(Form("hEtaETSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy, weight);
516  if(supermoduleID < 12)
517  sector = 4 + int(supermoduleID/2); // EMCAL
518  else
519  sector = 13 + int((supermoduleID-12)/2); // DCAL
520  fHistos->FillTH2(Form("hEtaEnergySec%d%s", sector, triggerclass.Data()), eta, energy, weight);
521  fHistos->FillTH2(Form("hEtaETSec%d%s", sector, triggerclass.Data()), eta, transverseenergy, weight);
522  }
523  if(hasTriggerPatch){
524  fHistos->FillTH1(Form("hClusterEnergyFired%s", triggerclass.Data()), energy, weight);
525  fHistos->FillTH1(Form("hClusterETFired%s", triggerclass.Data()), energy, weight);
526  fHistos->FillTH2(Form("hEtaEnergyFired%s", triggerclass.Data()), eta, energy, weight);
527  fHistos->FillTH2(Form("hEtaETFired%s", triggerclass.Data()), eta, energy, weight);
528  if(supermoduleID >= 0){
529  fHistos->FillTH2(Form("hClusterEnergyFiredSM%s", triggerclass.Data()), supermoduleID, energy, weight);
530  fHistos->FillTH2(Form("hClusterETFiredSM%s", triggerclass.Data()), supermoduleID, transverseenergy, weight);
531  fHistos->FillTH2(Form("hEtaEnergyFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, energy,weight);
532  fHistos->FillTH2(Form("hEtaETFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy, weight);
533  fHistos->FillTH2(Form("hEtaEnergyFiredSec%d%s", sector, triggerclass.Data()), eta, energy, weight);
534  fHistos->FillTH2(Form("hEtaETFiredSec%d%s", sector, triggerclass.Data()), eta, transverseenergy, weight);
535  }
536  }
537  Double_t encuts[5] = {1., 2., 5., 10., 20.};
538  for(int ien = 0; ien < 5; ien++){
539  if(energy > encuts[ien]){
540  fHistos->FillTH2(Form("hEtaPhi%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi, weight);
541  if(hasTriggerPatch){
542  fHistos->FillTH2(Form("hEtaPhiFired%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi, weight);
543  }
544  }
545  }
546 }
547 
559 void AliAnalysisTaskEmcalClustersRef::FillEventHistograms(const TString &triggerclass, double centrality, double vertexz){
560  Double_t weight = GetTriggerWeight(triggerclass);
561  fHistos->FillTH1(Form("hEventCount%s", triggerclass.Data()), 1, weight);
562  fHistos->FillTH1(Form("hEventCentrality%s", triggerclass.Data()), centrality, weight);
563  fHistos->FillTH1(Form("hVertexZ%s", triggerclass.Data()), vertexz, weight);
564 }
565 
574  Bool_t hasfound = kFALSE;
575  for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
576  Double_t boundaries[4];
577  GetPatchBoundaries(*patchIter, boundaries);
578  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
579  etamax = TMath::Max(boundaries[0], boundaries[1]),
580  phimin = TMath::Min(boundaries[2], boundaries[3]),
581  phimax = TMath::Max(boundaries[2], boundaries[3]);
582  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
583  hasfound = kTRUE;
584  break;
585  }
586  }
587  return hasfound;
588 }
589 
598 void AliAnalysisTaskEmcalClustersRef::FindPatchesForTrigger(TString triggerclass, const TClonesArray * fTriggerPatches, TList &foundtriggers) const {
599  foundtriggers.Clear();
600  if(!fTriggerPatches) return;
602  if(triggerclass == "EG1") myclass = AliEmcalTriggerOfflineSelection::kTrgEG1;
603  if(triggerclass == "EG2") myclass = AliEmcalTriggerOfflineSelection::kTrgEG2;
604  if(triggerclass == "EJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ1;
605  if(triggerclass == "EJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ2;
606  if(triggerclass == "DMC7") myclass = AliEmcalTriggerOfflineSelection::kTrgDL0;
607  if(triggerclass == "DG1") myclass = AliEmcalTriggerOfflineSelection::kTrgDG1;
608  if(triggerclass == "DG2") myclass = AliEmcalTriggerOfflineSelection::kTrgDG2;
609  if(triggerclass == "DJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ1;
610  if(triggerclass == "DJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ2;
611  for(TIter patchiter = TIter(fTriggerPatches).Begin(); patchiter != TIter::End(); ++patchiter){
612  if(!IsOfflineSimplePatch(*patchiter)) continue;
614  if(!SelectDCALPatch(*patchiter)) continue;
615  } else {
616  if(SelectDCALPatch(*patchiter)) continue;
617  }
619  if(!SelectSingleShowerPatch(*patchiter)) continue;
620  } else {
621  if(!SelectJetPatch(*patchiter)) continue;
622  }
623  double threshold = fTriggerSelection ? fTriggerSelection->GetThresholdForTrigger(myclass) : -1;
624  if(GetPatchEnergy(*patchiter) > threshold) foundtriggers.Add(*patchiter);
625  }
626 }
627 
634  TString triggerstring = "";
635  if(!fTriggerPatches) return triggerstring;
636  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0, nDJ1 = 0, nDJ2 = 0, nDG1 = 0, nDG2 = 0;
637  double minADC_J1 = 260.,
638  minADC_J2 = 127.,
639  minADC_G1 = 140.,
640  minADC_G2 = 89.;
641  for(TIter patchIter = TIter(fTriggerPatches).Begin(); patchIter != TIter::End(); ++patchIter){
642  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
643  if(!patch->IsOfflineSimple()) continue;
644  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_J1){
645  if(patch->IsDCalPHOS()) nDJ1++;
646  else nEJ1++;
647  }
648  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_J2){
649  if(patch->IsDCalPHOS()) nDJ2++;
650  else nEJ2++;
651  }
652  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_G1){
653  if(patch->IsDCalPHOS()) nDG1++;
654  else nEG1++;
655  }
656  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_G2){
657  if(patch->IsDCalPHOS()) nDG2++;
658  else nEG2++;
659  }
660  }
661  if(nEJ1) triggerstring += "EJ1";
662  if(nEJ2){
663  if(triggerstring.Length()) triggerstring += ",";
664  triggerstring += "EJ2";
665  }
666  if(nEG1){
667  if(triggerstring.Length()) triggerstring += ",";
668  triggerstring += "EG1";
669  }
670  if(nEG2){
671  if(triggerstring.Length()) triggerstring += ",";
672  triggerstring += "EG2";
673  }
674  if(nDJ1){
675  if(triggerstring.Length()) triggerstring += ",";
676  triggerstring += "DJ1";
677  }
678  if(nDJ2){
679  if(triggerstring.Length()) triggerstring += ",";
680  triggerstring += "DJ2";
681  }
682  if(nDG1){
683  if(triggerstring.Length()) triggerstring += ",";
684  triggerstring += "DG1";
685  }
686  if(nDG2){
687  if(triggerstring.Length()) triggerstring += ",";
688  triggerstring += "DG2";
689  }
690  return triggerstring;
691 }
692 
694  AliEMCALTriggerPatchInfo *patch= dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
695  boundaries[0] = patch->GetEtaMin();
696  boundaries[1] = patch->GetEtaMax();
697  boundaries[2] = patch->GetPhiMin();
698  boundaries[3] = patch->GetPhiMax();
699 }
700 
702  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
703  return patch->IsOfflineSimple();
704 }
705 
707  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
708  return patch->GetRowStart() >= 64;
709 }
710 
712  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
713  return patch->IsGammaLowSimple();
714 }
715 
717  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
718  if(!patch->IsOfflineSimple()) return false;
719  return patch->IsJetLowSimple();
720 }
721 
723  double energy = 0.;
724  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
725  energy = patch->GetPatchE();
726  return energy;
727 }
728 
734 {
735  this->SetMinimum(0.);
736  this->AddStep(1, 0.05);
737  this->AddStep(2, 0.1);
738  this->AddStep(4, 0.2);
739  this->AddStep(7, 0.5);
740  this->AddStep(16, 1);
741  this->AddStep(32, 2);
742  this->AddStep(40, 4);
743  this->AddStep(50, 5);
744  this->AddStep(100, 10);
745  this->AddStep(200, 20);
746 }
747 
748 
749 } /* namespace EMCalTriggerPtAnalysis */
void GetPatchBoundaries(TObject *o, Double_t *boundaries) const
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
TClonesArray * fTriggerPatches
! Container with trigger patches
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)
AliAnalysisUtils * fAnalysisUtil
Analysis utils for additional event selection / pileup rejection.
void FillClusterHistograms(const TString &triggerclass, double energy, double transversenergy, double eta, double phi, TList *triggerpatches)
AliEmcalTriggerOfflineSelection * fTriggerSelection
EMCAL offline trigger selection tool.
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
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
TString fClusterContainer
Name of the cluster container in the event.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Bool_t fTriggerStringFromPatches
Build trigger string from trigger patches.
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
Int_t fCurrentRun
Current run number (for RunChange method)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliCutValueRange< double > fCentralityRange
Selected centrality range.
const Double_t etamax
TString GetFiredTriggerClassesFromPatches(const TClonesArray *triggerpatches) const
AliCutValueRange< double > fVertexRange
Selected vertex range.
Container class for histograms for the high- charged particle analysis.
Definition: THistManager.h:43
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
const char Option_t
Definition: External.C:48
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)
const Double_t phimin
void FindPatchesForTrigger(TString triggerclass, const TClonesArray *triggerpatches, TList &foundpatches) const
void SetMinimum(Double_t min)