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