AliPhysics  vAN-20151012 (2287573)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliEMCalTriggerAnaTriggerDecision.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2014, 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 <iostream>
16 #include <TClonesArray.h>
17 #include <TString.h>
18 #include "AliVEvent.h"
22 
25 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerAnaTriggerDecisionConfig)
27 
28 namespace EMCalTriggerPtAnalysis {
29 
33 AliEMCalTriggerAnaTriggerDecision::AliEMCalTriggerAnaTriggerDecision() :
34  fDoDebug(kFALSE)
35 {
36  Reset();
37 }
38 
47  Reset();
49  MakeDecisionFromString(data->GetRecEvent()->GetFiredTriggerClasses());
50 }
51 
56  for(int itrg = 0; itrg < 4; itrg++){
57  fDecisionFromPatches[itrg] = kFALSE;
58  fDecisionFromString[itrg] = kFALSE;
59  }
60 }
61 
69  if(triggerstring.Contains("EJ1") || triggerstring.Contains("EJE")) fDecisionFromString[kTAEMCJHigh] = kTRUE;
70  if(triggerstring.Contains("EJ2")) fDecisionFromString[kTAEMCJLow] = kTRUE;
71  if(triggerstring.Contains("EG1") || triggerstring.Contains("EGA")) fDecisionFromString[kTAEMCGHigh] = kTRUE;
72  if(triggerstring.Contains("EG2")) fDecisionFromString[kTAEMCGLow] = kTRUE;
73 }
74 
81  bool result = true;
82  for(int icls = 0; icls < 4; icls++){
83  if(fDecisionFromString[icls] != fDecisionFromPatches[icls]) result = false;
84  }
85  return result;
86 }
87 
94 void AliEMCalTriggerAnaTriggerDecision::MakeDecisionFromPatches(const TClonesArray& listOfPatches) {
95  TIter patchIter(&listOfPatches);
96  AliEmcalTriggerPatchInfo *mypatch(NULL);
97  if(fDoDebug){
98  std::cout << "Generating trigger decision from found patches: " << listOfPatches.GetEntries() << std::endl;
99  if(fConfiguration.IsUsingOfflinePatches()) std::cout << "Using offline patches\n";
100  else std::cout << "Using online patches\n";
101  }
102  int foundpatches[4] = {0,0,0,0};
103  int index = -1;
104  while((mypatch = dynamic_cast<AliEmcalTriggerPatchInfo *>(patchIter()))){
105  if(fDoDebug) std::cout << "Next patch: " << (mypatch->IsOfflineSimple() ? "offline" : "online:") << std::endl;
106  for(int icase = 0; icase < 4; icase++){
107  if(SelectTriggerPatch(ETATriggerType(icase), mypatch)){
108  fDecisionFromPatches[icase] = kTRUE;
109  foundpatches[icase]++;
110  }
111  }
112  }
113  if(fDoDebug){
114  std::cout << "Found patches:" << std::endl;
115  std::cout << "Jet high: " << foundpatches[kTAEMCJHigh] << std::endl;
116  std::cout << "Jet low: " << foundpatches[kTAEMCJLow] << std::endl;
117  std::cout << "Gamma high: " << foundpatches[kTAEMCGHigh] << std::endl;
118  std::cout << "Gamma low: " << foundpatches[kTAEMCGLow] << std::endl;
119  }
120 }
121 
133  bool swapThresholds = fConfiguration.IsSwapThresholds();
134  bool selectPatchType = kFALSE;
136  if(!recpatch->IsOfflineSimple()) return kFALSE;
137  switch(trigger){
138  case kTAEMCJHigh: selectPatchType = swapThresholds ? recpatch->IsJetLowSimple() : recpatch->IsJetHighSimple(); break;
139  case kTAEMCJLow: selectPatchType = swapThresholds ? recpatch->IsJetHighSimple() : recpatch->IsJetLowSimple(); break;
140  case kTAEMCGHigh: selectPatchType = swapThresholds ? recpatch->IsGammaLowSimple() : recpatch->IsGammaHighSimple(); break;
141  case kTAEMCGLow: selectPatchType = swapThresholds ? recpatch->IsGammaHighSimple() : recpatch->IsGammaLowSimple(); break;
142  case kTAUndef: break;
143  };
144  } else {
145  if(recpatch->IsOfflineSimple()) return kFALSE;
146  switch(trigger){
147  case kTAEMCJHigh: selectPatchType = swapThresholds ? recpatch->IsJetLow() : recpatch->IsJetHigh(); break;
148  case kTAEMCJLow: selectPatchType = swapThresholds ? recpatch->IsJetHigh() : recpatch->IsJetLow(); break;
149  case kTAEMCGHigh: selectPatchType = swapThresholds ? recpatch->IsGammaLow() : recpatch->IsGammaHigh(); break;
150  case kTAEMCGLow: selectPatchType = swapThresholds ? recpatch->IsGammaHigh() : recpatch->IsGammaLow(); break;
151  case kTAUndef: break;
152  };
153  }
154 
155  if(!selectPatchType) return kFALSE;
156 
157  if(fConfiguration.HasEnergyThreshold(trigger)){
158  // Additional threshold on energy requested to select the patch
160  }
161  return kTRUE;
162 }
170  Double_t energy = 0.;
171  switch(energytype){
172  case kAmplitudeOnline: energy = patch->GetADCAmp(); break;
173  case kAmplitudeOffline: energy = patch->GetADCOfflineAmp(); break;
174  case kEnergyOnline: energy = patch->GetADCAmpGeVRough(); break;
175  case kEnergyOffline: energy = patch->GetPatchE(); break;
176  };
177  return energy;
178 }
179 
186  std::cout << "Trigger decision" << std::endl;
187  std::cout << "===============================" << std::endl;
188  std::string triggertitles[4] = {"Jet High", "Jet Low", "Gamma High", "Gamma Low"};
189  for(int icase = 0; icase < 4; icase++){
190  std::cout << triggertitles[icase] << ": String[" << (fDecisionFromString[icase] ? "yes" : "no")
191  << "], Patches[" << (fDecisionFromPatches[icase] ? "yes" : "no") << "]" << std::endl;
192  }
193 }
194 
195 /*
196  * Resources of class AliEMCalTriggerAnaTriggerDecisionConfig
197  */
198 
203  fSwapThresholds(kFALSE),
204  fUseOfflinePatches(kFALSE),
205  fEnergyType(kAmplitudeOnline)
206 {
207  memset(fEnergyThresholds, 0, sizeof(double) * 4);
208 }
209 
210 
211 } /* namespace EMCalTriggerPtAnalysis */
212 
Bool_t SelectTriggerPatch(ETATriggerType trigger, const AliEmcalTriggerPatchInfo *const recpatch) const
Class performing the selection of triggered events.
Online energy, estimated from L0 time sums.
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Double_t GetPatchEnergy(EPatchEnergyType_t energytype, const AliEmcalTriggerPatchInfo *const patch) const
Declaration of class AliEMCalTriggerAnaTriggerDecision, a container for trigger decision in EMCAL-tri...
Offline amplitude, estimated from EMCAL cells.
Online amplitude of the patch, from L0 time sums.
ETATriggerType
Trigger types defined for this analysis.
Main data structure storing all relevant information of EMCAL/DCAL trigger patches.
Bool_t fDecisionFromPatches[4]
Storage for result from trigger string.
energy
AliEMCalTriggerAnaTriggerDecisionConfig fConfiguration
Configuration for the trigger decision handler.
Double_t fEnergyThresholds[4]
Energy thresholds applied in the analysis.
Class to make array of trigger patch objects in AOD/ESD events.
Simple event container within the high- track analysis.
Bool_t fDecisionFromString[4]
Storage for result from trigger patches.
Offline energy, from cells, calibrated, exluding hot towers.
Event Data used in exchange to the different analysis components.