AliPhysics  vAN-20150827 (3e81cbb)
 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  };
143  } else {
144  if(recpatch->IsOfflineSimple()) return kFALSE;
145  switch(trigger){
146  case kTAEMCJHigh: selectPatchType = swapThresholds ? recpatch->IsJetLow() : recpatch->IsJetHigh(); break;
147  case kTAEMCJLow: selectPatchType = swapThresholds ? recpatch->IsJetHigh() : recpatch->IsJetLow(); break;
148  case kTAEMCGHigh: selectPatchType = swapThresholds ? recpatch->IsGammaLow() : recpatch->IsGammaHigh(); break;
149  case kTAEMCGLow: selectPatchType = swapThresholds ? recpatch->IsGammaHigh() : recpatch->IsGammaLow(); break;
150  };
151  }
152 
153  if(!selectPatchType) return kFALSE;
154 
155  if(fConfiguration.HasEnergyThreshold(trigger)){
156  // Additional threshold on energy requested to select the patch
158  }
159  return kTRUE;
160 }
168  Double_t energy = 0.;
169  switch(energytype){
170  case kAmplitudeOnline: energy = patch->GetADCAmp(); break;
171  case kAmplitudeOffline: energy = patch->GetADCOfflineAmp(); break;
172  case kEnergyOnline: energy = patch->GetADCAmpGeVRough(); break;
173  case kEnergyOffline: energy = patch->GetPatchE(); break;
174  };
175  return energy;
176 }
177 
184  std::cout << "Trigger decision" << std::endl;
185  std::cout << "===============================" << std::endl;
186  std::string triggertitles[4] = {"Jet High", "Jet Low", "Gamma High", "Gamma Low"};
187  for(int icase = 0; icase < 4; icase++){
188  std::cout << triggertitles[icase] << ": String[" << (fDecisionFromString[icase] ? "yes" : "no")
189  << "], Patches[" << (fDecisionFromPatches[icase] ? "yes" : "no") << "]" << std::endl;
190  }
191 }
192 
193 /*
194  * Resources of class AliEMCalTriggerAnaTriggerDecisionConfig
195  */
196 
201  fSwapThresholds(kFALSE),
202  fUseOfflinePatches(kFALSE),
203  fEnergyType(kAmplitudeOnline)
204 {
205  memset(fEnergyThresholds, 0, sizeof(double) * 4);
206 }
207 
208 
209 } /* namespace EMCalTriggerPtAnalysis */
210 
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.