AliPhysics  a9863a5 (a9863a5)
 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 <bitset>
16 #include <iostream>
17 #include <map>
18 #include <sstream>
19 #include <vector>
20 
21 #include <TArrayD.h>
22 #include <TClonesArray.h>
23 #include <THashList.h>
24 #include <THistManager.h>
25 #include <TLorentzVector.h>
26 #include <TMath.h>
27 #include <TString.h>
28 
29 #include "AliAnalysisUtils.h"
30 #include "AliCentrality.h"
31 #include "AliEMCALGeometry.h"
32 #include "AliEMCALTriggerPatchInfo.h"
34 #include "AliESDEvent.h"
35 #include "AliInputEventHandler.h"
36 #include "AliLog.h"
37 #include "AliVCluster.h"
38 #include "AliVVertex.h"
39 #include "AliMultSelection.h"
40 #include "AliMultEstimator.h"
41 
43 
45 
46 namespace EMCalTriggerPtAnalysis {
47 
51 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
52  AliAnalysisTaskSE(),
53  fAnalysisUtil(NULL),
54  fTriggerSelection(NULL),
55  fHistos(NULL),
56  fGeometry(NULL),
57  fClusterContainer(""),
58  fRequestAnalysisUtil(kTRUE),
59  fTriggerStringFromPatches(kFALSE),
60  fCentralityRange(-999., 999.),
61  fVertexRange(-999., 999.)
62 {
63 }
64 
69 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef(const char *name) :
70  AliAnalysisTaskSE(name),
71  fAnalysisUtil(),
72  fTriggerSelection(NULL),
73  fHistos(NULL),
74  fGeometry(NULL),
75  fClusterContainer(""),
76  fRequestAnalysisUtil(kTRUE),
77  fTriggerStringFromPatches(kFALSE),
78  fCentralityRange(-999., 999.),
79  fVertexRange(-999., 999.)
80 {
81  DefineOutput(1, TList::Class());
82 }
83 
87 AliAnalysisTaskEmcalClustersRef::~AliAnalysisTaskEmcalClustersRef() {
88  if(fTriggerSelection) delete fTriggerSelection;
89 }
90 
94 void AliAnalysisTaskEmcalClustersRef::UserCreateOutputObjects(){
95  AliInfo(Form("Creating histograms for task %s\n", GetName()));
96  fAnalysisUtil = new AliAnalysisUtils;
97 
98  TArrayD energybinning;
99  CreateEnergyBinning(energybinning);
100  TArrayD smbinning(14); CreateLinearBinning(smbinning, 21, -0.5, 20.5);
101  TArrayD etabinning; CreateLinearBinning(etabinning, 100, -0.7, 0.7);
102  fHistos = new THistManager("Ref");
103  TString triggers[18] = {
104  "MB", "EMC7", "DMC7",
105  "EJ1", "EJ2", "EG1", "EG2", "DJ1", "DJ2", "DG1", "DG2",
106  "MBexcl", "EMC7excl", "DMC7excl", "EG2excl", "EJ2excl", "DG2excl", "DJ2excl"
107  };
108  Double_t encuts[5] = {1., 2., 5., 10., 20.};
109  Int_t sectorsWithEMCAL[10] = {4, 5, 6, 7, 8, 9, 13, 14, 15, 16};
110  for(TString *trg = triggers; trg < triggers + sizeof(triggers)/sizeof(TString); trg++){
111  fHistos->CreateTH1(Form("hEventCount%s", trg->Data()), Form("Event count for trigger class %s", trg->Data()), 1, 0.5, 1.5);
112  fHistos->CreateTH1(Form("hClusterEnergy%s", trg->Data()), Form("Cluster energy for trigger class %s", trg->Data()), energybinning);
113  fHistos->CreateTH1(Form("hClusterET%s", trg->Data()), Form("Cluster transverse energy for trigger class %s", trg->Data()), energybinning);
114  fHistos->CreateTH1(Form("hClusterEnergyFired%s", trg->Data()), Form("Cluster energy for trigger class %s, firing the trigger", trg->Data()), energybinning);
115  fHistos->CreateTH1(Form("hClusterETFired%s", trg->Data()), Form("Cluster transverse energy for trigger class %s, firing the trigger", trg->Data()), energybinning);
116  fHistos->CreateTH2(Form("hClusterEnergySM%s", trg->Data()), Form("Cluster energy versus supermodule for trigger class %s", trg->Data()), smbinning, energybinning);
117  fHistos->CreateTH2(Form("hClusterETSM%s", trg->Data()), Form("Cluster transverse energy versus supermodule for trigger class %s", trg->Data()), smbinning, energybinning);
118  fHistos->CreateTH2(Form("hClusterEnergyFiredSM%s", trg->Data()), Form("Cluster energy versus supermodule for trigger class %s, firing the trigger", trg->Data()), smbinning, energybinning);
119  fHistos->CreateTH2(Form("hClusterETFiredSM%s", trg->Data()), Form("Cluster transverse energy versus supermodule for trigger class %s, firing the trigger", trg->Data()), smbinning, energybinning);
120  fHistos->CreateTH2(Form("hEtaEnergy%s", trg->Data()), Form("Cluster energy vs. eta for trigger class %s", trg->Data()), etabinning, energybinning);
121  fHistos->CreateTH2(Form("hEtaET%s", trg->Data()), Form("Cluster transverse energy vs. eta for trigger class %s", trg->Data()), etabinning, energybinning);
122  fHistos->CreateTH2(Form("hEtaEnergyFired%s", trg->Data()), Form("Cluster energy vs. eta for trigger class %s, firing the trigger", trg->Data()), etabinning, energybinning);
123  fHistos->CreateTH2(Form("hEtaETFired%s", trg->Data()), Form("Cluster transverse energy vs. eta for trigger class %s, firing the trigger", trg->Data()), etabinning, energybinning);
124  for(int ism = 0; ism < 20; ism++){
125  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);
126  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);
127  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);
128  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);
129  }
130  for(int isec = 0; isec < 10; isec++){
131  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);
132  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);
133  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);
134  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);
135  }
136  for(int ien = 0; ien < 5; ien++){
137  fHistos->CreateTH2(Form("hEtaPhi%dG%s", static_cast<int>(encuts[ien]), trg->Data()), Form("cluster #eta-#phi map for clusters with energy larger than %f GeV/c for trigger class %s", encuts[ien], trg->Data()), 100, -0.7, 0.7, 200, 0, 2*TMath::Pi());
138  fHistos->CreateTH2(Form("hEtaPhiFired%dG%s", static_cast<int>(encuts[ien]), trg->Data()), Form("cluster #eta-#phi map for clusters fired the trigger with energy larger than %f GeV/c for trigger class %s", encuts[ien], trg->Data()), 200, -0.7, 0.7, 200, 0, 2*TMath::Pi());
139  }
140  }
141  PostData(1, fHistos->GetListOfHistograms());
142  AliDebug(1, "End creating histograms");
143 }
144 
145 
150 void AliAnalysisTaskEmcalClustersRef::UserExec(Option_t *){
151  AliDebug(1, Form("%s: UserExec start\n", GetName()));
152  if(!fGeometry){
153  fGeometry = AliEMCALGeometry::GetInstance();
154  if(!fGeometry)
155  fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
156  }
157  TString triggerstring = "";
158  TClonesArray *triggerpatches = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject("EmcalTriggers"));
159 
160  if(fTriggerStringFromPatches){
161  triggerstring = GetFiredTriggerClassesFromPatches(triggerpatches);
162  } else {
163  triggerstring = fInputEvent->GetFiredTriggerClasses();
164  }
165 
166  UInt_t selectionstatus = fInputHandler->IsEventSelected();
167  std::stringstream triggerdebug;
168  triggerdebug << "Offline bits: " << std::bitset<sizeof(UInt_t) * 8>(selectionstatus);
169  AliDebug(2, triggerdebug.str().c_str());
170  Bool_t isMinBias = selectionstatus & AliVEvent::kINT7,
171  isEJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ1"),
172  isEJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ2"),
173  isEG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG1"),
174  isEG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG2"),
175  isEMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("EMC7"),
176  isDJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("DJ1"),
177  isDJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("DJ2"),
178  isDG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("DG1"),
179  isDG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("DG2"),
180  isDMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("DMC7");
181  if(triggerpatches && fTriggerSelection){
182  isEJ1 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEJ1, triggerpatches);
183  isEJ2 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEJ2, triggerpatches);
184  isEG1 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEG1, triggerpatches);
185  isEG2 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEG2, triggerpatches);
186  isEMC7 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEL0, triggerpatches);
187  isDJ1 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgDJ1, triggerpatches);
188  isDJ2 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgDJ2, triggerpatches);
189  isDG1 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgDG1, triggerpatches);
190  isDG2 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgDG2, triggerpatches);
191  isDMC7 &= fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgDL0, triggerpatches);
192  }
193  if(!(isMinBias || isEMC7 || isEG1 || isEG2 || isEJ1 || isEJ2 || isDMC7 || isDG1 || isDG2 || isDJ1 || isDJ2)){
194  AliDebug(1, Form("%s: Reject trigger\n", GetName()));
195  return;
196  }
197  AliMultSelection *mult = dynamic_cast<AliMultSelection *>(InputEvent()->FindListObject("MultSelection"));
198  double centrality = mult ? mult->GetEstimator("V0M")->GetPercentile() : -1;
199  AliDebug(1, Form("%s: Centrality %f\n", GetName(), centrality));
200  if(!fCentralityRange.IsInRange(centrality)){
201  AliDebug(1, Form("%s: reject centrality\n", GetName()));
202  return;
203  }
204  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
205  if(!vtx) vtx = fInputEvent->GetPrimaryVertexSPD();
206  //if(!fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.)) return; // reject pileup event
207  if(vtx->GetNContributors() < 1){
208  AliDebug(1, Form("%s: Reject contributors\n", GetName()));
209  return;
210  }
211  // Fill reference distribution for the primary vertex before any z-cut
212  if(fRequestAnalysisUtil){
213  AliDebug(1, Form("%s: Reject analysis util\n", GetName()));
214  if(fInputEvent->IsA() == AliESDEvent::Class() && fAnalysisUtil->IsFirstEventInChunk(fInputEvent)) return;
215  if(!fAnalysisUtil->IsVertexSelected2013pA(fInputEvent)) return; // Apply new vertex cut
216  if(fAnalysisUtil->IsPileUpEvent(fInputEvent)) return; // Apply new vertex cut
217  }
218  // Apply vertex z cut
219  if(!fVertexRange.IsInRange(vtx->GetZ())){
220  AliDebug(1, Form("%s: Reject z", GetName()));
221  return;
222  }
223  AliDebug(1, Form("%s: Event Selected\n", GetName()));
224 
225  // Fill Event counter and reference vertex distributions for the different trigger classes
226  if(isMinBias){
227  fHistos->FillTH1("hEventCountMB", 1);
228  if(!(isEMC7 || isDMC7 || isEJ1 || isEJ2 || isEG1 || isEG2 || isDJ1 || isDJ2 || isDG1 || isDG2)){
229  fHistos->FillTH1("hEventCountMBexcl", 1);
230  }
231  }
232 
233  if(isEMC7){
234  fHistos->FillTH1("hEventCountEMC7", 1);
235  if(!(isEJ1 || isEJ2 || isEG1 || isEG2)){
236  fHistos->FillTH1("hEventCountEMC7excl", 1);
237  }
238  }
239  if(isDMC7){
240  fHistos->FillTH1("hEventCountDMC7", 1);
241  if(!(isDJ1 || isDJ2 || isDG1 || isDG2)){
242  fHistos->FillTH1("hEventCountEMC7excl", 1);
243  }
244  }
245 
246  if(isEJ2){
247  fHistos->FillTH1("hEventCountEJ2", 1);
248  // Check for exclusive classes
249  if(!isEJ1){
250  fHistos->FillTH1("hEventCountEJ2excl", 1);
251  }
252  }
253  if(isDJ2){
254  fHistos->FillTH1("hEventCountDJ2", 1);
255  // Check for exclusive classes
256  if(!isDJ1){
257  fHistos->FillTH1("hEventCountDJ2excl", 1);
258  }
259  }
260 
261  if(isEJ1){
262  fHistos->FillTH1("hEventCountEJ1", 1);
263  }
264  if(isDJ1){
265  fHistos->FillTH1("hEventCountDJ1", 1);
266  }
267 
268  if(isEG2){
269  fHistos->FillTH1("hEventCountEG2", 1);
270  // Check for exclusive classes
271  if(!(isEG1)){
272  fHistos->FillTH1("hEventCountEG2excl", 1);
273  }
274  }
275  if(isDG2){
276  fHistos->FillTH1("hEventCountDG2", 1);
277  // Check for exclusive classes
278  if(!(isDG1)){
279  fHistos->FillTH1("hEventCountDG2excl", 1);
280  }
281  }
282 
283  if(isEG1){
284  fHistos->FillTH1("hEventCountEG1", 1);
285  }
286  if(isDG1){
287  fHistos->FillTH1("hEventCountDG1", 1);
288  }
289 
290  /*
291  TList *objects = fInputEvent->GetList();
292  for(TIter objiter = TIter(objects).Begin(); objiter != TIter::End(); ++ objiter){
293  printf("Object %s\n", (*objiter)->GetName());
294  }
295  */
296 
297  TObjArray clusterEvent(1000);
298 
299  TCollection *clusterArray = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(fClusterContainer.Data()));
300  if(!clusterArray){
301  AliError(Form("Cluster array with name %s not found in the event", fClusterContainer.Data()));
302  for(int icl = 0; icl < fInputEvent->GetNumberOfCaloClusters(); icl++){
303  clusterEvent.Add(fInputEvent->GetCaloCluster(icl));
304  }
305  clusterArray = &clusterEvent;
306  }
307 
308  Double_t vertexpos[3];
309  fInputEvent->GetPrimaryVertex()->GetXYZ(vertexpos);
310 
311  Double_t energy, eta, phi;
312  for(TIter clustIter = TIter(clusterArray).Begin(); clustIter != TIter::End(); ++clustIter){
313  AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
314  if(!clust->IsEMCAL()) continue;
315  if(clust->GetIsExotic()) continue;
316 
317  TLorentzVector posvec;
318  energy = clust->GetNonLinCorrEnergy();
319  clust->GetMomentum(posvec, vertexpos);
320  eta = posvec.Eta();
321  phi = posvec.Phi();
322 
323  // fill histograms allEta
324  if(isMinBias){
325  FillClusterHistograms("MB", energy, posvec.Et(), eta, phi, NULL);
326  if(!(isEMC7 || isDMC7 || isEJ1 || isEJ2 || isEG1 || isEG2 || isDJ1 || isDJ2 || isDG1 || isDG2)){
327  FillClusterHistograms("MBexcl", energy, posvec.Et(), eta, phi, NULL);
328  }
329  }
330  if(isEMC7){
331  FillClusterHistograms("EMC7", energy, posvec.Et(), eta, phi, NULL);
332  if(!(isEJ1 || isEJ2 || isEG1 || isEG2)){
333  FillClusterHistograms("EMC7excl", energy, posvec.Et(), eta, phi, NULL);
334  }
335  }
336  if(isDMC7){
337  FillClusterHistograms("DMC7", energy, posvec.Et(), eta, phi, NULL);
338  if(!(isDJ1 || isDJ2 || isDG1 || isDG2)){
339  FillClusterHistograms("DMC7excl", energy, posvec.Et(), eta, phi, NULL);
340  }
341  }
342  if(isEJ2){
343  TList ej2patches;
344  FindPatchesForTrigger("EJ2", triggerpatches, ej2patches);
345  FillClusterHistograms("EJ2", energy, posvec.Et(), eta, phi, &ej2patches);
346  // check for exclusive classes
347  if(!isEJ1){
348  FillClusterHistograms("EJ2excl", energy, posvec.Et(), eta, phi, &ej2patches);
349  }
350  }
351  if(isDJ2){
352  TList dj2patches;
353  FindPatchesForTrigger("DJ2", triggerpatches, dj2patches);
354  FillClusterHistograms("DJ2", energy, posvec.Et(), eta, phi, &dj2patches);
355  // check for exclusive classes
356  if(!isDJ1){
357  FillClusterHistograms("DJ2excl", energy, posvec.Et(), eta, phi, &dj2patches);
358  }
359  }
360  if(isEJ1){
361  TList ej1patches;
362  FindPatchesForTrigger("EJ1", triggerpatches, ej1patches);
363  FillClusterHistograms("EJ1", energy, posvec.Et(), eta, phi, &ej1patches);
364  }
365  if(isDJ1){
366  TList dj1patches;
367  FindPatchesForTrigger("DJ1", triggerpatches, dj1patches);
368  FillClusterHistograms("DJ1", energy, posvec.Et(), eta, phi, &dj1patches);
369  }
370  if(isEG2){
371  TList eg2patches;
372  FindPatchesForTrigger("EG2", triggerpatches, eg2patches);
373  FillClusterHistograms("EG2", energy, posvec.Et(), eta, phi, &eg2patches);
374  // check for exclusive classes
375  if(!isEG1){
376  FillClusterHistograms("EG2excl", energy, posvec.Et(), eta, phi, &eg2patches);
377  }
378  }
379  if(isDG2){
380  TList dg2patches;
381  FindPatchesForTrigger("DG2", triggerpatches, dg2patches);
382  FillClusterHistograms("DG2", energy, posvec.Et(), eta, phi, &dg2patches);
383  // check for exclusive classes
384  if(!isDG1){
385  FillClusterHistograms("DG2excl", energy, posvec.Et(), eta, phi, &dg2patches);
386  }
387  }
388  if(isEG1){
389  TList eg1patches;
390  FindPatchesForTrigger("EG1", triggerpatches, eg1patches);
391  FillClusterHistograms("EG1", energy, posvec.Et(), eta, phi, &eg1patches);
392  }
393  if(isDG1){
394  TList dg1patches;
395  FindPatchesForTrigger("DG1", triggerpatches, dg1patches);
396  FillClusterHistograms("DG1", energy, posvec.Et(), eta, phi, &dg1patches);
397  }
398  }
399  PostData(1, fHistos->GetListOfHistograms());
400 }
401 
402 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(TString triggerclass, double energy, double transverseenergy, double eta, double phi, TList *triggerpatches){
403  Bool_t hasTriggerPatch = triggerpatches ? CorrelateToTrigger(eta, phi, triggerpatches) : kFALSE;
404  Int_t supermoduleID = -1, sector = -1;
405  fGeometry->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
406  fHistos->FillTH1(Form("hClusterEnergy%s", triggerclass.Data()), energy);
407  fHistos->FillTH1(Form("hClusterET%s", triggerclass.Data()), transverseenergy);
408  fHistos->FillTH2(Form("hEtaEnergy%s", triggerclass.Data()), eta, energy);
409  fHistos->FillTH2(Form("hEtaET%s", triggerclass.Data()), eta, transverseenergy);
410  if(supermoduleID >= 0){
411  fHistos->FillTH2(Form("hClusterEnergySM%s", triggerclass.Data()), supermoduleID, energy);
412  fHistos->FillTH2(Form("hClusterETSM%s", triggerclass.Data()), supermoduleID, transverseenergy);
413  fHistos->FillTH2(Form("hEtaEnergySM%d%s", supermoduleID, triggerclass.Data()), eta, energy);
414  fHistos->FillTH2(Form("hEtaETSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy);
415  if(supermoduleID < 12)
416  sector = 4 + int(supermoduleID/2); // EMCAL
417  else
418  sector = 13 + int((supermoduleID-12)/2); // DCAL
419  fHistos->FillTH2(Form("hEtaEnergySec%d%s", sector, triggerclass.Data()), eta, energy);
420  fHistos->FillTH2(Form("hEtaETSec%d%s", sector, triggerclass.Data()), eta, transverseenergy);
421  }
422  if(hasTriggerPatch){
423  fHistos->FillTH1(Form("hClusterEnergyFired%s", triggerclass.Data()), energy);
424  fHistos->FillTH1(Form("hClusterETFired%s", triggerclass.Data()), energy);
425  fHistos->FillTH2(Form("hEtaEnergyFired%s", triggerclass.Data()), eta, energy);
426  fHistos->FillTH2(Form("hEtaETFired%s", triggerclass.Data()), eta, energy);
427  if(supermoduleID >= 0){
428  fHistos->FillTH2(Form("hClusterEnergyFiredSM%s", triggerclass.Data()), supermoduleID, energy);
429  fHistos->FillTH2(Form("hClusterETFiredSM%s", triggerclass.Data()), supermoduleID, transverseenergy);
430  fHistos->FillTH2(Form("hEtaEnergyFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, energy);
431  fHistos->FillTH2(Form("hEtaETFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy);
432  fHistos->FillTH2(Form("hEtaEnergyFiredSec%d%s", sector, triggerclass.Data()), eta, energy);
433  fHistos->FillTH2(Form("hEtaETFiredSec%d%s", sector, triggerclass.Data()), eta, transverseenergy);
434  }
435  }
436  Double_t encuts[5] = {1., 2., 5., 10., 20.};
437  for(int ien = 0; ien < 5; ien++){
438  if(energy > encuts[ien]){
439  fHistos->FillTH2(Form("hEtaPhi%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi);
440  if(hasTriggerPatch){
441  fHistos->FillTH2(Form("hEtaPhiFired%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi);
442  }
443  }
444  }
445 }
446 
451 void AliAnalysisTaskEmcalClustersRef::CreateEnergyBinning(TArrayD& binning) const {
452  std::vector<double> mybinning;
453  std::map<double,double> definitions;
454  definitions.insert(std::pair<double, double>(1, 0.05));
455  definitions.insert(std::pair<double, double>(2, 0.1));
456  definitions.insert(std::pair<double, double>(4, 0.2));
457  definitions.insert(std::pair<double, double>(7, 0.5));
458  definitions.insert(std::pair<double, double>(16, 1));
459  definitions.insert(std::pair<double, double>(32, 2));
460  definitions.insert(std::pair<double, double>(40, 4));
461  definitions.insert(std::pair<double, double>(50, 5));
462  definitions.insert(std::pair<double, double>(100, 10));
463  definitions.insert(std::pair<double, double>(200, 20));
464  double currentval = 0.;
465  mybinning.push_back(currentval);
466  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
467  double limit = id->first, binwidth = id->second;
468  while(currentval < limit){
469  currentval += binwidth;
470  mybinning.push_back(currentval);
471  }
472  }
473  binning.Set(mybinning.size());
474  int ib = 0;
475  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
476  binning[ib++] = *it;
477 }
478 
486 void AliAnalysisTaskEmcalClustersRef::CreateLinearBinning(TArrayD& binning, int nbins, double min, double max) const {
487  double binwidth = (max-min)/static_cast<double>(nbins);
488  binning.Set(nbins+1);
489  binning[0] = min;
490  double currentlimit = min + binwidth;
491  for(int ibin = 0; ibin < nbins; ibin++){
492  binning[ibin+1] = currentlimit;
493  currentlimit += binwidth;
494  }
495 }
496 
504 Bool_t AliAnalysisTaskEmcalClustersRef::CorrelateToTrigger(Double_t etaclust, Double_t phiclust, TList *triggerpatches) const {
505  Bool_t hasfound = kFALSE;
506  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
507  Double_t boundaries[4];
508  GetPatchBoundaries(*patchIter, boundaries);
509  Double_t etamin = TMath::Min(boundaries[0], boundaries[1]),
510  etamax = TMath::Max(boundaries[0], boundaries[1]),
511  phimin = TMath::Min(boundaries[2], boundaries[3]),
512  phimax = TMath::Max(boundaries[2], boundaries[3]);
513  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
514  hasfound = kTRUE;
515  break;
516  }
517  }
518  return hasfound;
519 }
520 
529 void AliAnalysisTaskEmcalClustersRef::FindPatchesForTrigger(TString triggerclass, const TClonesArray * triggerpatches, TList &foundtriggers) const {
530  foundtriggers.Clear();
531  if(!triggerpatches) return;
532  AliEmcalTriggerOfflineSelection::EmcalTriggerClass myclass = AliEmcalTriggerOfflineSelection::kTrgEL0;
533  if(triggerclass == "EG1") myclass = AliEmcalTriggerOfflineSelection::kTrgEG1;
534  if(triggerclass == "EG2") myclass = AliEmcalTriggerOfflineSelection::kTrgEG2;
535  if(triggerclass == "EJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ1;
536  if(triggerclass == "EJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgEJ2;
537  if(triggerclass == "DMC7") myclass = AliEmcalTriggerOfflineSelection::kTrgDL0;
538  if(triggerclass == "DG1") myclass = AliEmcalTriggerOfflineSelection::kTrgDG1;
539  if(triggerclass == "DG2") myclass = AliEmcalTriggerOfflineSelection::kTrgDG2;
540  if(triggerclass == "DJ1") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ1;
541  if(triggerclass == "DJ2") myclass = AliEmcalTriggerOfflineSelection::kTrgDJ2;
542  AliEMCALTriggerPatchInfo *mypatch = NULL;
543  for(TIter patchiter = TIter(triggerpatches).Begin(); patchiter != TIter::End(); ++patchiter){
544  if(!IsOfflineSimplePatch(*patchiter)) continue;
545  if(AliEmcalTriggerOfflineSelection::IsDCAL(myclass)){
546  if(!SelectDCALPatch(*patchiter)) continue;
547  } else {
548  if(SelectDCALPatch(*patchiter)) continue;
549  }
550  if(AliEmcalTriggerOfflineSelection::IsSingleShower(myclass)){
551  if(!SelectSingleShowerPatch(*patchiter)) continue;
552  } else {
553  if(!SelectJetPatch(*patchiter)) continue;
554  }
555  double threshold = fTriggerSelection ? fTriggerSelection->GetThresholdForTrigger(myclass) : -1;
556  if(GetPatchEnergy(*patchiter) > threshold) foundtriggers.Add(mypatch);
557  }
558 }
559 
565 TString AliAnalysisTaskEmcalClustersRef::GetFiredTriggerClassesFromPatches(const TClonesArray* triggerpatches) const {
566  TString triggerstring = "";
567  if(!triggerpatches) return triggerstring;
568  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0, nDJ1 = 0, nDJ2 = 0, nDG1 = 0, nDG2 = 0;
569  double minADC_J1 = 260.,
570  minADC_J2 = 127.,
571  minADC_G1 = 140.,
572  minADC_G2 = 89.;
573  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
574  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
575  if(!patch->IsOfflineSimple()) continue;
576  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_J1){
577  if(patch->IsDCalPHOS()) nDJ1++;
578  else nEJ1++;
579  }
580  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_J2){
581  if(patch->IsDCalPHOS()) nDJ2++;
582  else nEJ2++;
583  }
584  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_G1){
585  if(patch->IsDCalPHOS()) nDG1++;
586  else nEG1++;
587  }
588  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_G2){
589  if(patch->IsDCalPHOS()) nDG2++;
590  else nEG2++;
591  }
592  }
593  if(nEJ1) triggerstring += "EJ1";
594  if(nEJ2){
595  if(triggerstring.Length()) triggerstring += ",";
596  triggerstring += "EJ2";
597  }
598  if(nEG1){
599  if(triggerstring.Length()) triggerstring += ",";
600  triggerstring += "EG1";
601  }
602  if(nEG2){
603  if(triggerstring.Length()) triggerstring += ",";
604  triggerstring += "EG2";
605  }
606  if(nDJ1){
607  if(triggerstring.Length()) triggerstring += ",";
608  triggerstring += "DJ1";
609  }
610  if(nDJ2){
611  if(triggerstring.Length()) triggerstring += ",";
612  triggerstring += "DJ2";
613  }
614  if(nDG1){
615  if(triggerstring.Length()) triggerstring += ",";
616  triggerstring += "DG1";
617  }
618  if(nDG2){
619  if(triggerstring.Length()) triggerstring += ",";
620  triggerstring += "DG2";
621  }
622  return triggerstring;
623 }
624 
625 void AliAnalysisTaskEmcalClustersRef::GetPatchBoundaries(TObject *o, Double_t *boundaries) const {
626  AliEMCALTriggerPatchInfo *patch= dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
627  boundaries[0] = patch->GetEtaMin();
628  boundaries[1] = patch->GetEtaMax();
629  boundaries[2] = patch->GetPhiMin();
630  boundaries[3] = patch->GetPhiMax();
631 }
632 
633 bool AliAnalysisTaskEmcalClustersRef::IsOfflineSimplePatch(TObject *o) const {
634  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
635  return patch->IsOfflineSimple();
636 }
637 
638 bool AliAnalysisTaskEmcalClustersRef::SelectDCALPatch(TObject *o) const {
639  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
640  return patch->GetRowStart() >= 64;
641 }
642 
643 bool AliAnalysisTaskEmcalClustersRef::SelectSingleShowerPatch(TObject *o) const{
644  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
645  return patch->IsGammaLowSimple();
646 }
647 
648 bool AliAnalysisTaskEmcalClustersRef::SelectJetPatch(TObject *o) const{
649  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
650  if(!patch->IsOfflineSimple()) return false;
651  return patch->IsJetLowSimple();
652 }
653 
654 double AliAnalysisTaskEmcalClustersRef::GetPatchEnergy(TObject *o) const {
655  double energy = 0.;
656  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(o);
657  energy = patch->GetPatchE();
658  return energy;
659 }
660 
661 } /* namespace EMCalTriggerPtAnalysis */
centrality
ClassImp(EMCalTriggerPtAnalysis::AliAnalysisTaskEmcalClustersRef) namespace EMCalTriggerPtAnalysis
const Double_t etamin
energy
const Double_t etamax
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
const Int_t nbins
const Double_t phimin