AliPhysics  6bc8652 (6bc8652)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
26 
27 namespace EMCalTriggerPtAnalysis {
28 
32 AliEMCalTriggerAnaTriggerDecision::AliEMCalTriggerAnaTriggerDecision() :
33  fDoDebug(kFALSE)
34 {
35  Reset();
36 }
37 
46  Reset();
48  MakeDecisionFromString(data->GetRecEvent()->GetFiredTriggerClasses());
49 }
50 
55  for(int itrg = 0; itrg < 4; itrg++){
56  fDecisionFromPatches[itrg] = kFALSE;
57  fDecisionFromString[itrg] = kFALSE;
58  }
59 }
60 
68  if(triggerstring.Contains("EJ1") || triggerstring.Contains("EJE")) fDecisionFromString[kTAEMCJHigh] = kTRUE;
69  if(triggerstring.Contains("EJ2")) fDecisionFromString[kTAEMCJLow] = kTRUE;
70  if(triggerstring.Contains("EG1") || triggerstring.Contains("EGA")) fDecisionFromString[kTAEMCGHigh] = kTRUE;
71  if(triggerstring.Contains("EG2")) fDecisionFromString[kTAEMCGLow] = kTRUE;
72 }
73 
80  bool result = true;
81  for(int icls = 0; icls < 4; icls++){
82  if(fDecisionFromString[icls] != fDecisionFromPatches[icls]) result = false;
83  }
84  return result;
85 }
86 
93 void AliEMCalTriggerAnaTriggerDecision::MakeDecisionFromPatches(const TClonesArray& listOfPatches) {
94  TIter patchIter(&listOfPatches);
95  AliEMCALTriggerPatchInfo *mypatch(NULL);
96  if(fDoDebug){
97  std::cout << "Generating trigger decision from found patches: " << listOfPatches.GetEntries() << std::endl;
98  if(fConfiguration.IsUsingOfflinePatches()) std::cout << "Using offline patches\n";
99  else std::cout << "Using online patches\n";
100  }
101  int foundpatches[4] = {0,0,0,0};
102  int index = -1;
103  while((mypatch = dynamic_cast<AliEMCALTriggerPatchInfo *>(patchIter()))){
104  if(fDoDebug) std::cout << "Next patch: " << (mypatch->IsOfflineSimple() ? "offline" : "online:") << std::endl;
105  for(int icase = 0; icase < 4; icase++){
106  if(SelectTriggerPatch(ETATriggerType(icase), mypatch)){
107  fDecisionFromPatches[icase] = kTRUE;
108  foundpatches[icase]++;
109  }
110  }
111  }
112  if(fDoDebug){
113  std::cout << "Found patches:" << std::endl;
114  std::cout << "Jet high: " << foundpatches[kTAEMCJHigh] << std::endl;
115  std::cout << "Jet low: " << foundpatches[kTAEMCJLow] << std::endl;
116  std::cout << "Gamma high: " << foundpatches[kTAEMCGHigh] << std::endl;
117  std::cout << "Gamma low: " << foundpatches[kTAEMCGLow] << std::endl;
118  }
119 }
120 
131 Bool_t AliEMCalTriggerAnaTriggerDecision::SelectTriggerPatch(ETATriggerType trigger, const AliEMCALTriggerPatchInfo* const recpatch) const {
132  bool swapThresholds = fConfiguration.IsSwapThresholds();
133  bool selectPatchType = kFALSE;
135  if(!recpatch->IsOfflineSimple()) return kFALSE;
136  switch(trigger){
137  case kTAEMCJHigh: selectPatchType = swapThresholds ? recpatch->IsJetLowSimple() : recpatch->IsJetHighSimple(); break;
138  case kTAEMCJLow: selectPatchType = swapThresholds ? recpatch->IsJetHighSimple() : recpatch->IsJetLowSimple(); break;
139  case kTAEMCGHigh: selectPatchType = swapThresholds ? recpatch->IsGammaLowSimple() : recpatch->IsGammaHighSimple(); break;
140  case kTAEMCGLow: selectPatchType = swapThresholds ? recpatch->IsGammaHighSimple() : recpatch->IsGammaLowSimple(); break;
141  case kTAUndef: 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  case kTAUndef: 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::string triggertitles[4] = {"Jet High", "Jet Low", "Gamma High", "Gamma Low"};
188  for(int icase = 0; icase < 4; icase++){
189  std::cout << triggertitles[icase] << ": String[" << (fDecisionFromString[icase] ? "yes" : "no")
190  << "], Patches[" << (fDecisionFromPatches[icase] ? "yes" : "no") << "]" << std::endl;
191  }
192 }
193 
194 } /* namespace EMCalTriggerPtAnalysis */
195 
Class performing the selection of triggered events.
Online energy, estimated from L0 time sums.
Declaration of class AliEMCalTriggerAnaTriggerDecision, a container for trigger decision in EMCAL-tri...
double Double_t
Definition: External.C:58
Gamma trigger, low threshold.
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.
energy
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliEMCalTriggerAnaTriggerDecisionConfig fConfiguration
Configuration for the trigger decision handler.
Double_t GetPatchEnergy(EPatchEnergyType_t energytype, const AliEMCALTriggerPatchInfo *const patch) const
Simple event container within the high- track analysis.
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
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.
Bool_t SelectTriggerPatch(ETATriggerType trigger, const AliEMCALTriggerPatchInfo *const recpatch) const
Gamma trigger, high threshold.