AliPhysics  29d4213 (29d4213)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
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 <TLorentzVector.h>
25 #include <TString.h>
26 
27 #include "AliAnalysisUtils.h"
28 #include "AliEMCALGeometry.h"
29 #include "AliEmcalTriggerPatchInfoAP.h"
30 #include "AliEMCalHistoContainer.h"
31 #include "AliESDEvent.h"
32 #include "AliInputEventHandler.h"
33 #include "AliLog.h"
34 #include "AliVCluster.h"
35 #include "AliVVertex.h"
36 
38 
40 
41 namespace EMCalTriggerPtAnalysis {
42 
46 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef() :
47  AliAnalysisTaskSE(),
48  fAnalysisUtil(NULL),
49  fHistos(NULL),
50  fGeometry(NULL),
51  fClusterContainer(""),
52  fTriggerStringFromPatches(kFALSE)
53 {
54  for(int itrg = 0; itrg < kECRntrig; itrg++){
55  fOfflineEnergyThreshold[itrg] = -1;
56  }
57 }
58 
63 AliAnalysisTaskEmcalClustersRef::AliAnalysisTaskEmcalClustersRef(const char *name) :
64  AliAnalysisTaskSE(name),
65  fAnalysisUtil(),
66  fHistos(NULL),
67  fGeometry(NULL),
68  fClusterContainer(""),
69  fTriggerStringFromPatches(kFALSE)
70 {
71  for(int itrg = 0; itrg < kECRntrig; itrg++){
72  fOfflineEnergyThreshold[itrg] = -1;
73  }
74  DefineOutput(1, TList::Class());
75 }
76 
80 AliAnalysisTaskEmcalClustersRef::~AliAnalysisTaskEmcalClustersRef() {
81 }
82 
86 void AliAnalysisTaskEmcalClustersRef::UserCreateOutputObjects(){
87  fAnalysisUtil = new AliAnalysisUtils;
88 
89  TArrayD energybinning;
90  CreateEnergyBinning(energybinning);
91  TArrayD smbinning(14); CreateLinearBinning(smbinning, 14, -0.5, 13.5);
92  TArrayD etabinning; CreateLinearBinning(etabinning, 100, -0.7, 0.7);
93  fHistos = new AliEMCalHistoContainer("Ref");
94  TString triggers[17] = {
95  "MB", "EMC7",
96  "EJ1", "EJ2", "EG1", "EG2",
97  "EMC7excl","EG1excl", "EG2excl", "EJ1excl", "EJ2excl",
98  "E1combined", "E1Jonly", "E1Gonly", "E2combined", "E2Jonly", "E2Gonly"
99  };
100  Double_t encuts[5] = {1., 2., 5., 10., 20.};
101  for(TString *trg = triggers; trg < triggers + sizeof(triggers)/sizeof(TString); trg++){
102  fHistos->CreateTH1(Form("hEventCount%s", trg->Data()), Form("Event count for trigger class %s", trg->Data()), 1, 0.5, 1.5);
103  fHistos->CreateTH1(Form("hClusterEnergy%s", trg->Data()), Form("Cluster energy for trigger class %s", trg->Data()), energybinning);
104  fHistos->CreateTH1(Form("hClusterET%s", trg->Data()), Form("Cluster transverse energy for trigger class %s", trg->Data()), energybinning);
105  fHistos->CreateTH1(Form("hClusterEnergyFired%s", trg->Data()), Form("Cluster energy for trigger class %s, firing the trigger", trg->Data()), energybinning);
106  fHistos->CreateTH1(Form("hClusterETFired%s", trg->Data()), Form("Cluster transverse energy for trigger class %s, firing the trigger", trg->Data()), energybinning);
107  fHistos->CreateTH2(Form("hClusterEnergySM%s", trg->Data()), Form("Cluster energy versus supermodule for trigger class %s", trg->Data()), smbinning, energybinning);
108  fHistos->CreateTH2(Form("hClusterETSM%s", trg->Data()), Form("Cluster transverse energy versus supermodule for trigger class %s", trg->Data()), smbinning, energybinning);
109  fHistos->CreateTH2(Form("hClusterEnergyFiredSM%s", trg->Data()), Form("Cluster energy versus supermodule for trigger class %s, firing the trigger", trg->Data()), smbinning, energybinning);
110  fHistos->CreateTH2(Form("hClusterETFiredSM%s", trg->Data()), Form("Cluster transverse energy versus supermodule for trigger class %s, firing the trigger", trg->Data()), smbinning, energybinning);
111  fHistos->CreateTH2(Form("hEtaEnergy%s", trg->Data()), Form("Cluster energy vs. eta for trigger class %s", trg->Data()), etabinning, energybinning);
112  fHistos->CreateTH2(Form("hEtaET%s", trg->Data()), Form("Cluster transverse energy vs. eta for trigger class %s", trg->Data()), etabinning, energybinning);
113  fHistos->CreateTH2(Form("hEtaEnergyFired%s", trg->Data()), Form("Cluster energy vs. eta for trigger class %s, firing the trigger", trg->Data()), etabinning, energybinning);
114  fHistos->CreateTH2(Form("hEtaETFired%s", trg->Data()), Form("Cluster transverse energy vs. eta for trigger class %s, firing the trigger", trg->Data()), etabinning, energybinning);
115  for(int ism = 0; ism < 12; ism++){
116  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);
117  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);
118  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);
119  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);
120  }
121  for(int isec = 4; isec < 10; isec++){
122  fHistos->CreateTH2(Form("hEtaEnergySec%d%s", isec, trg->Data()), Form("Cluster energy vs.eta in tracking sector %d for trigger %s", isec, trg->Data()), etabinning, energybinning);
123  fHistos->CreateTH2(Form("hEtaETSec%d%s", isec, trg->Data()), Form("Cluster transverse energy vs.eta in tracking sector %d for trigger %s", isec, trg->Data()), etabinning, energybinning);
124  fHistos->CreateTH2(Form("hEtaEnergyFiredSec%d%s", isec, trg->Data()), Form("Cluster energy vs.eta in tracking sector %d for trigger %s, firing the trigger", isec, trg->Data()), etabinning, energybinning);
125  fHistos->CreateTH2(Form("hEtaETFiredSec%d%s", isec, trg->Data()), Form("Cluster transverse energy vs.eta in tracking sector %d for trigger %s, firing the trigger", isec, trg->Data()), etabinning, energybinning);
126  }
127  for(int ien = 0; ien < 5; ien++){
128  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, 100, 1.4, 3.2);
129  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()), 100, -0.7, 0.7, 100, 1.4, 3.2);
130  }
131  }
132  PostData(1, fHistos->GetListOfHistograms());
133 }
134 
135 
140 void AliAnalysisTaskEmcalClustersRef::UserExec(Option_t *){
141  if(!fGeometry){
142  fGeometry = AliEMCALGeometry::GetInstance();
143  if(!fGeometry)
144  fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
145  }
146  TString triggerstring = "";
147  TClonesArray *triggerpatches = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject("EmcalTriggers"));
148 
149  if(fTriggerStringFromPatches){
150  triggerstring = GetFiredTriggerClassesFromPatches(triggerpatches);
151  } else {
152  triggerstring = fInputEvent->GetFiredTriggerClasses();
153  }
154 
155  UInt_t selectionstatus = fInputHandler->IsEventSelected();
156  std::stringstream triggerdebug;
157  triggerdebug << "Offline bits: " << std::bitset<sizeof(UInt_t) * 8>(selectionstatus);
158  AliDebug(2, triggerdebug.str().c_str());
159  Bool_t isMinBias = selectionstatus & AliVEvent::kINT7,
160  isEJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ1") && IsOfflineSelected(kECREJ1, triggerpatches),
161  isEJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ2") && IsOfflineSelected(kECREJ2, triggerpatches),
162  isEG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG1") && IsOfflineSelected(kECREG1, triggerpatches),
163  isEG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG2") && IsOfflineSelected(kECREG2, triggerpatches),
164  isEMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("CEMC7") && IsOfflineSelected(kECREL0, triggerpatches);
165  if(!(isMinBias || isEMC7 || isEG1 || isEG2 || isEJ1 || isEJ2)) return;
166  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
167  //if(!fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.)) return; // reject pileup event
168  if(vtx->GetNContributors() < 1) return;
169  // Fill reference distribution for the primary vertex before any z-cut
170  if(fInputEvent->IsA() == AliESDEvent::Class() && fAnalysisUtil->IsFirstEventInChunk(fInputEvent)) return;
171  if(!fAnalysisUtil->IsVertexSelected2013pA(fInputEvent)) return; // Apply new vertex cut
172  if(fAnalysisUtil->IsPileUpEvent(fInputEvent)) return; // Apply new vertex cut
173  // Apply vertex z cut
174  if(vtx->GetZ() < -10. || vtx->GetZ() > 10.) return;
175 
176  // Fill Event counter and reference vertex distributions for the different trigger classes
177  if(isMinBias){
178  fHistos->FillTH1("hEventCountMB", 1);
179  }
180  if(isEMC7){
181  fHistos->FillTH1("hEventCountEMC7", 1);
182  if(!isMinBias){
183  fHistos->FillTH1("hEventCountEMC7excl", 1);
184  }
185  }
186  if(isEJ2){
187  fHistos->FillTH1("hEventCountEJ2", 1);
188  // Check for exclusive classes
189  if(!(isMinBias)){
190  fHistos->FillTH1("hEventCountEJ2excl", 1);
191  }
192  if(isEG1 || isEG2){
193  fHistos->FillTH1("hEventCountE2combined", 1);
194  } else {
195  fHistos->FillTH1("hEventCountE2Jonly", 1);
196  }
197 
198  }
199  if(isEJ1){
200  fHistos->FillTH1("hEventCountEJ1", 1);
201  // Check for exclusive classes
202  if(!(isMinBias || isEJ2)){
203  fHistos->FillTH1("hEventCountEJ1excl", 1);
204  }
205  if(isEG1 || isEG2){
206  fHistos->FillTH1("hEventCountE1combined", 1);
207  } else {
208  fHistos->FillTH1("hEventCountE1Jonly", 1);
209  }
210  }
211  if(isEG2){
212  fHistos->FillTH1("hEventCountEG2", 1);
213  // Check for exclusive classes
214  if(!(isMinBias)){
215  fHistos->FillTH1("hEventCountEG2excl", 1);
216  }
217  if(!(isEJ1 || isEJ2)){
218  fHistos->FillTH1("hEventCountE2Gonly", 1);
219  }
220  }
221  if(isEG1){
222  fHistos->FillTH1("hEventCountEG1", 1);
223  // Check for exclusive classes
224  if(!(isMinBias || isEG2)){
225  fHistos->FillTH1("hEventCountEG1excl", 1);
226  }
227  if(!(isEJ1 || isEJ2)){
228  fHistos->FillTH1("hEventCountE1Gonly", 1);
229  }
230  }
231 
232  TClonesArray *clusterArray = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(fClusterContainer.Data()));
233  if(!clusterArray){
234  AliError("Cluster array not found");
235  return;
236  }
237 
238  Double_t vertexpos[3];
239  fInputEvent->GetPrimaryVertex()->GetXYZ(vertexpos);
240 
241  Double_t energy, eta, phi;
242  for(TIter clustIter = TIter(clusterArray).Begin(); clustIter != TIter::End(); ++clustIter){
243  AliVCluster *clust = static_cast<AliVCluster *>(*clustIter);
244  if(!clust->IsEMCAL()) continue;
245 
246  TLorentzVector posvec;
247  energy = clust->E();
248  clust->GetMomentum(posvec, vertexpos);
249  eta = posvec.Eta();
250  phi = posvec.Phi();
251 
252  // fill histograms allEta
253  if(isMinBias){
254  FillClusterHistograms("MB", energy, posvec.Et(), eta, phi, NULL);
255  }
256  if(isEMC7){
257  FillClusterHistograms("EMC7", energy, posvec.Et(), eta, phi, NULL);
258  if(!isMinBias){
259  FillClusterHistograms("EMC7excl", energy, posvec.Et(), eta, phi, NULL);
260  }
261  }
262  if(isEJ2){
263  TList ej2patches;
264  FindPatchesForTrigger("EJ2", triggerpatches, ej2patches);
265  FillClusterHistograms("EJ2", energy, posvec.Et(), eta, phi, &ej2patches);
266  // check for exclusive classes
267  if(!isMinBias){
268  FillClusterHistograms("EJ2excl", energy, posvec.Et(), eta, phi, &ej2patches);
269  }
270  if(isEG1 || isEG2){
271  FillClusterHistograms("E2combined", energy, posvec.Et(), eta, phi, &ej2patches);
272  } else {
273  FillClusterHistograms("E2Jonly", energy, posvec.Et(), eta, phi, &ej2patches);
274  }
275  }
276  if(isEJ1){
277  TList ej1patches;
278  FindPatchesForTrigger("EJ1", triggerpatches, ej1patches);
279  FillClusterHistograms("EJ1", energy, posvec.Et(), eta, phi, &ej1patches);
280  // check for exclusive classes
281  if(!(isMinBias || isEJ2)){
282  FillClusterHistograms("EJ1excl", energy, posvec.Et(), eta, phi, &ej1patches);
283  }
284  if(isEG1 || isEG2) {
285  FillClusterHistograms("E1combined", energy, posvec.Et(), eta, phi, &ej1patches);
286  } else {
287  FillClusterHistograms("E1Jonly", energy, posvec.Et(), eta, phi, &ej1patches);
288  }
289  }
290  if(isEG2){
291  TList eg2patches;
292  FindPatchesForTrigger("EG2", triggerpatches, eg2patches);
293  FillClusterHistograms("EG2", energy, posvec.Et(), eta, phi, &eg2patches);
294  // check for exclusive classes
295  if(!isMinBias){
296  FillClusterHistograms("EG2excl", energy, posvec.Et(), eta, phi, &eg2patches);
297  }
298  if(!(isEJ2 || isEJ1)){
299  FillClusterHistograms("E2Gonly", energy, posvec.Et(), eta, phi, &eg2patches);
300  }
301  }
302  if(isEG1){
303  TList eg1patches;
304  FindPatchesForTrigger("EG1", triggerpatches, eg1patches);
305  FillClusterHistograms("EG1", energy, posvec.Et(), eta, phi, &eg1patches);
306  if(!(isEG2 || isMinBias))
307  FillClusterHistograms("EG1excl", energy, posvec.Et(), eta, phi, &eg1patches);
308  if(!(isEJ1 || isEJ2)){
309  FillClusterHistograms("E1Gonly", energy, posvec.Et(), eta, phi, &eg1patches);
310  }
311  }
312  }
313  PostData(1, fHistos->GetListOfHistograms());
314 }
315 
316 void AliAnalysisTaskEmcalClustersRef::FillClusterHistograms(TString triggerclass, double energy, double transverseenergy, double eta, double phi, TList *triggerpatches){
317  Bool_t hasTriggerPatch = triggerpatches ? CorrelateToTrigger(eta, phi, triggerpatches) : kFALSE;
318  Int_t supermoduleID = -1, sector = -1;
319  fGeometry->SuperModuleNumberFromEtaPhi(eta, phi, supermoduleID);
320  fHistos->FillTH1(Form("hClusterEnergy%s", triggerclass.Data()), energy);
321  fHistos->FillTH1(Form("hClusterET%s", triggerclass.Data()), transverseenergy);
322  fHistos->FillTH2(Form("hEtaEnergy%s", triggerclass.Data()), eta, energy);
323  fHistos->FillTH2(Form("hEtaET%s", triggerclass.Data()), eta, transverseenergy);
324  if(supermoduleID >= 0){
325  fHistos->FillTH2(Form("hClusterEnergySM%s", triggerclass.Data()), supermoduleID, energy);
326  fHistos->FillTH2(Form("hClusterETSM%s", triggerclass.Data()), supermoduleID, transverseenergy);
327  fHistos->FillTH2(Form("hEtaEnergySM%d%s", supermoduleID, triggerclass.Data()), eta, energy);
328  fHistos->FillTH2(Form("hEtaETSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy);
329  sector = 4 + int(supermoduleID/2);
330  fHistos->FillTH2(Form("hEtaEnergySec%d%s", sector, triggerclass.Data()), eta, energy);
331  fHistos->FillTH2(Form("hEtaETSec%d%s", sector, triggerclass.Data()), eta, transverseenergy);
332  }
333  if(hasTriggerPatch){
334  fHistos->FillTH1(Form("hClusterEnergyFired%s", triggerclass.Data()), energy);
335  fHistos->FillTH1(Form("hClusterETFired%s", triggerclass.Data()), energy);
336  fHistos->FillTH2(Form("hEtaEnergyFired%s", triggerclass.Data()), eta, energy);
337  fHistos->FillTH2(Form("hEtaETFired%s", triggerclass.Data()), eta, energy);
338  if(supermoduleID >= 0){
339  fHistos->FillTH2(Form("hClusterEnergyFiredSM%s", triggerclass.Data()), supermoduleID, energy);
340  fHistos->FillTH2(Form("hClusterETFiredSM%s", triggerclass.Data()), supermoduleID, transverseenergy);
341  fHistos->FillTH2(Form("hEtaEnergyFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, energy);
342  fHistos->FillTH2(Form("hEtaETFiredSM%d%s", supermoduleID, triggerclass.Data()), eta, transverseenergy);
343  fHistos->FillTH2(Form("hEtaEnergyFiredSec%d%s", sector, triggerclass.Data()), eta, energy);
344  fHistos->FillTH2(Form("hEtaETFiredSec%d%s", sector, triggerclass.Data()), eta, transverseenergy);
345  }
346  }
347  Double_t encuts[5] = {1., 2., 5., 10., 20.};
348  for(int ien = 0; ien < 5; ien++){
349  if(energy > encuts[ien]){
350  fHistos->FillTH2(Form("hEtaPhi%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi);
351  if(hasTriggerPatch){
352  fHistos->FillTH2(Form("hEtaPhiFired%dG%s", static_cast<int>(encuts[ien]), triggerclass.Data()), eta, phi);
353  }
354  }
355  }
356 }
357 
362 void AliAnalysisTaskEmcalClustersRef::CreateEnergyBinning(TArrayD& binning) const {
363  std::vector<double> mybinning;
364  std::map<double,double> definitions;
365  definitions.insert(std::pair<double, double>(1, 0.05));
366  definitions.insert(std::pair<double, double>(2, 0.1));
367  definitions.insert(std::pair<double, double>(4, 0.2));
368  definitions.insert(std::pair<double, double>(7, 0.5));
369  definitions.insert(std::pair<double, double>(16, 1));
370  definitions.insert(std::pair<double, double>(32, 2));
371  definitions.insert(std::pair<double, double>(40, 4));
372  definitions.insert(std::pair<double, double>(50, 5));
373  definitions.insert(std::pair<double, double>(100, 10));
374  definitions.insert(std::pair<double, double>(200, 20));
375  double currentval = 0.;
376  mybinning.push_back(currentval);
377  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
378  double limit = id->first, binwidth = id->second;
379  while(currentval < limit){
380  currentval += binwidth;
381  mybinning.push_back(currentval);
382  }
383  }
384  binning.Set(mybinning.size());
385  int ib = 0;
386  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
387  binning[ib++] = *it;
388 }
389 
397 void AliAnalysisTaskEmcalClustersRef::CreateLinearBinning(TArrayD& binning, int nbins, double min, double max) const {
398  double binwidth = (max-min)/static_cast<double>(nbins);
399  binning.Set(nbins+1);
400  binning[0] = min;
401  double currentlimit = min + binwidth;
402  for(int ibin = 0; ibin < nbins; ibin++){
403  binning[ibin+1] = currentlimit;
404  currentlimit += binwidth;
405  }
406 }
407 
415 Bool_t AliAnalysisTaskEmcalClustersRef::CorrelateToTrigger(Double_t etaclust, Double_t phiclust, TList *triggerpatches) const {
416  Bool_t hasfound = kFALSE;
417  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
418  AliEmcalTriggerPatchInfo *mypatch = static_cast<AliEmcalTriggerPatchInfo *>(*patchIter);
419  Double_t etamin = TMath::Min(mypatch->GetEtaMin(), mypatch->GetEtaMax()),
420  etamax = TMath::Max(mypatch->GetEtaMin(), mypatch->GetEtaMax()),
421  phimin = TMath::Min(mypatch->GetPhiMin(), mypatch->GetPhiMax()),
422  phimax = TMath::Max(mypatch->GetPhiMin(), mypatch->GetPhiMax());
423  if(etaclust > etamin && etaclust < etamax && phiclust > phimin && phiclust < phimax){
424  hasfound = kTRUE;
425  break;
426  }
427  }
428  return hasfound;
429 }
430 
439 void AliAnalysisTaskEmcalClustersRef::FindPatchesForTrigger(TString triggerclass, const TClonesArray * triggerpatches, TList &foundtriggers) const {
440  foundtriggers.Clear();
441  if(!triggerpatches) return;
442  EmcalTriggerClass myclass = kECREL0;
443  if(triggerclass == "EG1") myclass = kECREG1;
444  if(triggerclass == "EG2") myclass = kECREG2;
445  if(triggerclass == "EJ1") myclass = kECREJ1;
446  if(triggerclass == "EJ2") myclass = kECREJ2;
447  bool isSingleShower = ((myclass == kECREG1) || (triggerclass == kECREG2) || (myclass == kECREL0));
448  AliEmcalTriggerPatchInfo *mypatch = NULL;
449  for(TIter patchiter = TIter(triggerpatches).Begin(); patchiter != TIter::End(); ++patchiter){
450  mypatch = dynamic_cast<AliEmcalTriggerPatchInfo *>(*patchiter);
451  if(!mypatch->IsOfflineSimple()) continue;
452  if(isSingleShower){
453  if(!mypatch->IsGammaLowSimple()) continue;
454  } else {
455  if(!mypatch->IsJetLowSimple()) continue;
456  }
457  if(mypatch->GetPatchE() > fOfflineEnergyThreshold[myclass]) foundtriggers.Add(mypatch);
458  }
459 }
460 
469 Bool_t AliAnalysisTaskEmcalClustersRef::IsOfflineSelected(EmcalTriggerClass trgcls, const TClonesArray * const triggerpatches) const {
470  if(fOfflineEnergyThreshold[trgcls] < 0) return true;
471  bool isSingleShower = ((trgcls == kECREL0) || (trgcls == kECREG1) || (trgcls == kECREG2));
472  int nfound = 0;
473  AliEmcalTriggerPatchInfo *patch = NULL;
474  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
475  patch = static_cast<AliEmcalTriggerPatchInfo *>(*patchIter);
476  if(!patch->IsOfflineSimple()) continue;
477  if(isSingleShower){
478  if(!patch->IsGammaLowSimple()) continue;
479  } else {
480  if(!patch->IsJetLowSimple()) continue;
481  }
482  if(patch->GetPatchE() > fOfflineEnergyThreshold[trgcls]) nfound++;
483  }
484  return nfound > 0;
485 }
486 
492 TString AliAnalysisTaskEmcalClustersRef::GetFiredTriggerClassesFromPatches(const TClonesArray* triggerpatches) const {
493  TString triggerstring = "";
494  if(!triggerpatches) return triggerstring;
495  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0;
496  double minADC_EJ1 = 260.,
497  minADC_EJ2 = 127.,
498  minADC_EG1 = 140.,
499  minADC_EG2 = 89.;
500  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
501  AliEmcalTriggerPatchInfo *patch = dynamic_cast<AliEmcalTriggerPatchInfo *>(*patchIter);
502  if(!patch->IsOfflineSimple()) continue;
503  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_EJ1) nEJ1++;
504  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_EJ2) nEJ2++;
505  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_EG1) nEG1++;
506  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_EG2) nEG2++;
507  }
508  if(nEJ1) triggerstring += "EJ1";
509  if(nEJ2){
510  if(triggerstring.Length()) triggerstring += ",";
511  triggerstring += "EJ2";
512  }
513  if(nEG1){
514  if(triggerstring.Length()) triggerstring += ",";
515  triggerstring += "EG1";
516  }
517  if(nEG2){
518  if(triggerstring.Length()) triggerstring += ",";
519  triggerstring += "EG2";
520  }
521  return triggerstring;
522 }
523 
524 
525 } /* namespace EMCalTriggerPtAnalysis */
ClassImp(EMCalTriggerPtAnalysis::AliAnalysisTaskEmcalClustersRef) namespace EMCalTriggerPtAnalysis
const Double_t etamin
Declarartion of class AliEMCalHistoContainer.
energy
const Double_t etamax
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
const Int_t nbins
const Double_t phimin