AliPhysics  vAN-20150427 (e6e7aad)
 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"
19 #include "AliEmcalTriggerPatchInfo.h"
22 
25 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerAnaTriggerDecisionConfig)
27 
28 namespace EMCalTriggerPtAnalysis {
29 
33 AliEMCalTriggerAnaTriggerDecision::AliEMCalTriggerAnaTriggerDecision() :
34  fIsMinBias(kFALSE),
35  fDoDebug(kFALSE)
36 {
37  Reset();
38 }
39 
48  Reset();
50  MakeDecisionFromString(data->GetRecEvent()->GetFiredTriggerClasses());
51 }
52 
57  for(int itrg = 0; itrg < 4; itrg++){
58  fDecisionFromPatches[itrg] = kFALSE;
59  fDecisionFromString[itrg] = kFALSE;
60  }
61 }
62 
70  if(triggerstring.Contains("EJ1") || triggerstring.Contains("EJE")) fDecisionFromString[kTAEMCJHigh] = kTRUE;
71  if(triggerstring.Contains("EJ2") || triggerstring.Contains("EGA")) fDecisionFromString[kTAEMCJLow] = kTRUE;
72  if(triggerstring.Contains("EG1")) fDecisionFromString[kTAEMCGHigh] = kTRUE;
73  if(triggerstring.Contains("EG2")) fDecisionFromString[kTAEMCGLow] = kTRUE;
74 }
75 
82  bool result = true;
83  for(int icls = 0; icls < 4; icls++){
84  if(fDecisionFromString[icls] != fDecisionFromPatches[icls]) result = false;
85  }
86  return result;
87 }
88 
95 void AliEMCalTriggerAnaTriggerDecision::MakeDecisionFromPatches(const TClonesArray& listOfPatches) {
96  TIter patchIter(&listOfPatches);
97  AliEmcalTriggerPatchInfo *mypatch(NULL);
98  if(fDoDebug){
99  std::cout << "Generating trigger decision from found patches: " << listOfPatches.GetEntries() << std::endl;
100  if(fConfiguration.IsUsingOfflinePatches()) std::cout << "Using offline patches\n";
101  else std::cout << "Using online patches\n";
102  }
103  int foundpatches[4] = {0,0,0,0};
104  int index = -1;
105  while((mypatch = dynamic_cast<AliEmcalTriggerPatchInfo *>(patchIter()))){
106  if(fDoDebug) std::cout << "Next patch: " << (mypatch->IsOfflineSimple() ? "offline" : "online:") << std::endl;
107  for(int icase = 0; icase < 4; icase++){
108  if(SelectTriggerPatch(ETATriggerType(icase), mypatch)){
109  fDecisionFromPatches[icase] = kTRUE;
110  foundpatches[icase]++;
111  }
112  }
113  }
114  if(fDoDebug){
115  std::cout << "Found patches:" << std::endl;
116  std::cout << "Jet high: " << foundpatches[kTAEMCJHigh] << std::endl;
117  std::cout << "Jet low: " << foundpatches[kTAEMCJLow] << std::endl;
118  std::cout << "Gamma high: " << foundpatches[kTAEMCGHigh] << std::endl;
119  std::cout << "Gamma low: " << foundpatches[kTAEMCGLow] << std::endl;
120  }
121 }
122 
133 Bool_t AliEMCalTriggerAnaTriggerDecision::SelectTriggerPatch(ETATriggerType trigger, const AliEmcalTriggerPatchInfo* const recpatch) const {
134  bool swapThresholds = fConfiguration.IsSwapThresholds();
135  bool selectPatchType = kFALSE;
137  if(!recpatch->IsOfflineSimple()) return kFALSE;
138  switch(trigger){
139  case kTAEMCJHigh: selectPatchType = swapThresholds ? recpatch->IsJetLowSimple() : recpatch->IsJetHighSimple(); break;
140  case kTAEMCJLow: selectPatchType = swapThresholds ? recpatch->IsJetHighSimple() : recpatch->IsJetLowSimple(); break;
141  case kTAEMCGHigh: selectPatchType = swapThresholds ? recpatch->IsGammaLowSimple() : recpatch->IsGammaHighSimple(); break;
142  case kTAEMCGLow: selectPatchType = swapThresholds ? recpatch->IsGammaHighSimple() : recpatch->IsGammaLowSimple(); 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  };
152  }
153 
154  if(!selectPatchType) return kFALSE;
155 
156  if(fConfiguration.HasEnergyThreshold(trigger)){
157  // Additional threshold on energy requested to select the patch
159  }
160  return kTRUE;
161 }
168 Double_t AliEMCalTriggerAnaTriggerDecision::GetPatchEnergy(EPatchEnergyType_t energytype, const AliEmcalTriggerPatchInfo *const patch) const {
169  Double_t energy = 0.;
170  switch(energytype){
171  case kAmplitudeOnline: energy = patch->GetADCAmp(); break;
172  case kAmplitudeOffline: energy = patch->GetADCOfflineAmp(); break;
173  case kEnergyOnline: energy = patch->GetADCAmpGeVRough(); break;
174  case kEnergyOffline: energy = patch->GetPatchE(); break;
175  };
176  return energy;
177 }
178 
185  std::cout << "Trigger decision" << std::endl;
186  std::cout << "===============================" << std::endl;
187  std::cout << "MinBias: " << (fIsMinBias ? "yes" : "no") << 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.
Bool_t fDecisionFromPatches[4]
Storage for result from trigger string.
AliEMCalTriggerAnaTriggerDecisionConfig fConfiguration
Configuration for the trigger decision handler.
Double_t fEnergyThresholds[4]
Energy thresholds applied in the analysis.
Bool_t fDecisionFromString[4]
Storage for result from trigger patches.
Offline energy, from cells, calibrated, exluding hot towers.