ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
LVL1::EFexTauAlgorithm Class Reference

#include <EFexTauAlgorithm.h>

Inheritance diagram for LVL1::EFexTauAlgorithm:
Collaboration diagram for LVL1::EFexTauAlgorithm:

Public Member Functions

 EFexTauAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~EFexTauAlgorithm ()
 
StatusCode initialize () override
 
StatusCode execute (const EventContext &ctx) const override
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual bool isClonable () const override
 Specify if the algorithm is clonable. More...
 
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
 
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
virtual bool filterPassed (const EventContext &ctx) const
 
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

float CaloCellET (const CaloCell *const &inputCell, float digitScale, float digitThreshold) const
 member functions More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

SG::ReadHandleKey< CaloCellContainerm_inputCellContainerKey
 input / output More...
 
SG::ReadHandleKey< CaloCellContainerm_inputTileCellContainerKey
 Tile cell input container. More...
 
SG::ReadHandleKey< xAOD::TriggerTowerContainerm_inputTriggerTowerContainerKey
 TriggerTowers (if needed) More...
 
SG::WriteHandleKey< xAOD::EmTauRoIContainerm_outputClusterName
 
bool m_use_tileCells
 properties More...
 
bool m_useProvenanceSkim
 clear up container from bad BC by making a new container (Denis, old way) More...
 
bool m_useProvenance
 clear up container from bad BC by skipping scells More...
 
int m_qualBitMask
 Configurable quality bitmask. More...
 
float m_nominalDigitization
 value of nominal digitisation More...
 
float m_nominalNoise_thresh
 noise threshold More...
 
float m_timeThr
 
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 26 of file EFexTauAlgorithm.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ EFexTauAlgorithm()

LVL1::EFexTauAlgorithm::EFexTauAlgorithm ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 32 of file EFexTauAlgorithm.cxx.

33  : AthReentrantAlgorithm(name, pSvcLocator)
34 {
35  declareProperty("InputSuperCellContainer", m_inputCellContainerKey = "SCell");
36  declareProperty("InputTileCellContainer", m_inputTileCellContainerKey = "AllCalo");
37  declareProperty("InputTriggerTowerContainer", m_inputTriggerTowerContainerKey = "xAODTriggerTowers");
38  declareProperty("OutputClusterName", m_outputClusterName = "SCluster");
39 
40  declareProperty("UseTileCells", m_use_tileCells = false, "Use Tile cells instead of TriggerTowers");
41 
42  declareProperty("CleanCellContainerSkim", m_useProvenanceSkim = false);
43  declareProperty("CleanCellContainer", m_useProvenance = true);
44  declareProperty("QualBitMask", m_qualBitMask = 0x40);
45 
46  declareProperty("NominalDigitizationValue", m_nominalDigitization = 25.);
47  declareProperty("NominalNoiseThreshold", m_nominalNoise_thresh = 100.);
48  declareProperty("TimeThreshold", m_timeThr = 200);
49 }

◆ ~EFexTauAlgorithm()

LVL1::EFexTauAlgorithm::~EFexTauAlgorithm ( )
virtualdefault

Member Function Documentation

◆ CaloCellET()

float LVL1::EFexTauAlgorithm::CaloCellET ( const CaloCell *const inputCell,
float  digitScale,
float  digitThreshold 
) const
private

member functions

calculate the ET of an input cell

Definition at line 65 of file EFexTauAlgorithm.cxx.

66 {
67  if (inputCell == nullptr)
68  return 0.;
69  // Check that timing is correct
70  if (m_useProvenance)
71  {
72  bool correctProv = (inputCell->provenance() & m_qualBitMask);
73  if (!correctProv)
74  return 0.;
75  }
76  // Calculates the ET (before digitization)
77  float inputCell_energy = inputCell->energy();
78  float inputCell_eta = inputCell->eta();
79  float inputCell_ET = cosh(inputCell_eta) ? inputCell_energy / cosh(inputCell_eta) : inputCell_energy;
80  // Check to see if negative ET values are allowed
81  bool allowNegs = false;
82  if (digitScale < 0.)
83  {
84  digitScale = std::abs(digitScale);
85  allowNegs = true;
86  }
87  if (inputCell_ET == 0)
88  return 0.;
89  else if (digitScale == 0)
90  return inputCell_ET;
91  if (allowNegs || inputCell_ET > 0.)
92  {
93  // Split up ET into magnitude & whether it's positive or negative
94  float posOrNeg = inputCell_ET ? inputCell_ET / std::abs(inputCell_ET) : inputCell_ET;
95  inputCell_ET = std::abs(inputCell_ET);
96  // If no digitisation, return ET following noise cut
97  if (digitScale == 0)
98  {
99  if (inputCell_ET > digitThreshold)
100  return inputCell_ET * posOrNeg;
101  else
102  return 0.;
103  }
104  // Apply digitization & then noise cut
105  else
106  {
107  float divET = digitScale ? inputCell_ET / digitScale : inputCell_ET;
108  int roundET = divET;
109  float result = digitScale * roundET;
110  if (digitThreshold == 0)
111  return result * posOrNeg;
112  else if (result >= digitThreshold)
113  return result * posOrNeg;
114  else
115  return 0;
116  }
117  }
118  else
119  return 0.;
120 }

◆ cardinality()

unsigned int AthReentrantAlgorithm::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Override this to return 0 for reentrant algorithms.

Definition at line 55 of file AthReentrantAlgorithm.cxx.

56 {
57  return 0;
58 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode LVL1::EFexTauAlgorithm::execute ( const EventContext &  ctx) const
override

Definition at line 123 of file EFexTauAlgorithm.cxx.

124 {
125 
126  // supercells are used by both methods
127  auto scellsHandle = SG::makeHandle(m_inputCellContainerKey, ctx);
128  if (!scellsHandle.isValid())
129  {
130  ATH_MSG_ERROR("Failed to retrieve " << m_inputCellContainerKey.key());
131  return StatusCode::FAILURE;
132  }
135  {
136  for (const CaloCell *scell : *scellsHandle)
137  if (scell->provenance() & m_qualBitMask)
138  scells.push_back(scell);
139  }
140  else
141  scells.assign(scellsHandle->begin(), scellsHandle->end());
142 
144  const xAOD::TriggerTowerContainer *TTs{nullptr};
145  if (m_use_tileCells)
146  {
147  auto tileCellHandle = SG::makeHandle(m_inputTileCellContainerKey, ctx);
148  if (!tileCellHandle.isValid())
149  {
150  ATH_MSG_ERROR("Failed to retrieve " << m_inputTileCellContainerKey.key());
151  return StatusCode::FAILURE;
152  }
153  tileCellCont.assign(tileCellHandle->begin(), tileCellHandle->end());
154  }
155  else
156  {
157  auto triggerTowerHandle = SG::makeHandle(m_inputTriggerTowerContainerKey, ctx);
158  if (!triggerTowerHandle.isValid())
159  {
160  ATH_MSG_ERROR("Failed to retrieve " << m_inputTriggerTowerContainerKey.key());
161  return StatusCode::FAILURE;
162  }
163  TTs = triggerTowerHandle.cptr();
164  }
165  auto clustersForTau = std::make_unique<xAOD::EmTauRoIContainer>();
166  auto auxClustersForTau = std::make_unique<xAOD::EmTauRoIAuxContainer>();
167  clustersForTau->setStore(auxClustersForTau.get());
168 
169  // prepare all supercells vector in whole ATLAS detector
170  std::vector<const CaloCell *> allSuperCells(scells.begin(), scells.end());
171 
172  // clear all TH2 histograms for supercell map
173  TH2F supercellMapEM0("SupercellMapEM0", "Supercell map of EM0", 98, -4.9, 4.9, 64, 0, 2 * M_PI);
174  TH2F supercellMapEM1("SupercellMapEM1", "Supercell map of EM1", 392, -4.9, 4.9, 64, 0, 2 * M_PI);
175  TH2F supercellMapEM2("SupercellMapEM2", "Supercell map of EM2", 392, -4.9, 4.9, 64, 0, 2 * M_PI);
176  TH2F supercellMapEM1_coarse("SupercellMapEM1_coarse", "Supercell map of EM1 coarse", 196, -4.9, 4.9, 64, 0, 2 * M_PI);
177  TH2F supercellMapEM2_coarse("SupercellMapEM2_coarse", "Supercell map of EM2 coarse", 196, -4.9, 4.9, 64, 0, 2 * M_PI);
178  TH2F supercellMapEM3("SupercellMapEM3", "Supercell map of EM3", 98, -4.9, 4.9, 64, 0, 2 * M_PI);
179  TH2F supercellMapHAD("SupercellMapHAD", "Supercell map of HAD", 98, -4.9, 4.9, 64, 0, 2 * M_PI);
180  TH2F supercellMapTWR("SupercellMapTWR", "Supercell map of TWR", 98, -4.9, 4.9, 64, 0, 2 * M_PI);
181 
182  int currentSampling = 0;
183  float currentEta = 0;
184  float currentPhi = 0;
185  float currentCellEt = 0;
186 
187  // fill energy in all TH2 histograms for supercell map
188  for (auto scell : allSuperCells)
189  {
190  currentSampling = scell->caloDDE()->getSampling();
191  currentEta = scell->eta();
192  currentPhi = TVector2::Phi_0_2pi(scell->phi());
193  currentCellEt = CaloCellET(scell, m_nominalDigitization, m_nominalNoise_thresh);
194 
195  // Store maps per layer
196  if (currentSampling == 0 || currentSampling == 4)
197  {
198  supercellMapEM0.Fill(currentEta, currentPhi, currentCellEt);
199  }
200  else if (currentSampling == 1 || currentSampling == 5)
201  {
202  supercellMapEM1.Fill(currentEta, currentPhi, currentCellEt);
203  supercellMapEM1_coarse.Fill(currentEta, currentPhi, currentCellEt);
204  }
205  else if (currentSampling == 2 || currentSampling == 6)
206  {
207  supercellMapEM2.Fill(currentEta, currentPhi, currentCellEt);
208  supercellMapEM2_coarse.Fill(currentEta, currentPhi, currentCellEt);
209  }
210  else if (currentSampling == 3 || currentSampling == 7)
211  {
212  supercellMapEM3.Fill(currentEta, currentPhi, currentCellEt);
213  }
214  else
215  {
216  supercellMapHAD.Fill(currentEta, currentPhi, currentCellEt);
217  }
218 
219  // Store a map sum of all layers
220  supercellMapTWR.Fill(currentEta, currentPhi, currentCellEt);
221  }
222 
223  // Need to also loop over Run-I towers to get central region hadronic energy
224  for (const xAOD::TriggerTower *tt : *TTs)
225  {
226 
227  // Only use towers within 1.5, and in Tile
228  if (tt->sampling() != 1 || std::abs(tt->eta()) > 1.5)
229  {
230  continue;
231  }
232 
233  // Conversion into ET
234  float cpET = tt->cpET() * 500.; // EM energy scale: 1 unit corresponds to 500 MeV
235  if (cpET < 0.)
236  {
237  cpET = 0;
238  }
239 
240  // Fill hadronic maps
241  supercellMapHAD.Fill(tt->eta(), TVector2::Phi_0_2pi(tt->phi()), cpET);
242  supercellMapTWR.Fill(tt->eta(), TVector2::Phi_0_2pi(tt->phi()), cpET);
243  }
244 
245  // Find local maxima
246  std::vector<TLorentzVector> localMaxima;
247  localMaxima.reserve(200);
248 
249  // X is eta, Y is phi
250  for (int i = 0; i < supercellMapTWR.GetNbinsX(); i++)
251  {
252  for (int j = 0; j < supercellMapTWR.GetNbinsY(); j++)
253  {
254  // Start by filtering out 'useless towers' (ie: anything less than a GeV)
255  double towerET = supercellMapTWR.GetBinContent(i + 1, j + 1);
256  if (towerET < 1000.)
257  continue;
258 
259  // Check if the current tower has the largest ET in this 3x3 window
260 
261  // Need to be careful with wrap-around in phi, unfortunately.
262  std::vector<double> binsAbove;
263  binsAbove.reserve(4);
264  std::vector<double> binsBelow;
265  binsBelow.reserve(4);
266 
267  // Handle wrap-around in phi
268  int aboveInPhi = j + 1;
269  if (j == supercellMapTWR.GetNbinsY() - 1)
270  aboveInPhi = 0;
271  int belowInPhi = j - 1;
272  if (j == 0)
273  belowInPhi = supercellMapTWR.GetNbinsY() - 1;
274 
275  // The convention here is arbitrary, but needs to be mirrored
276  // Take the cells in the next row in phi, and the one cell above in eta
277  binsAbove.push_back(supercellMapTWR.GetBinContent(i, aboveInPhi + 1));
278  binsAbove.push_back(supercellMapTWR.GetBinContent(i + 1, aboveInPhi + 1));
279  binsAbove.push_back(supercellMapTWR.GetBinContent(i + 2, aboveInPhi + 1));
280  binsAbove.push_back(supercellMapTWR.GetBinContent(i + 2, j + 1));
281 
282  // Inversely so for the bins below
283  binsBelow.push_back(supercellMapTWR.GetBinContent(i, belowInPhi + 1));
284  binsBelow.push_back(supercellMapTWR.GetBinContent(i + 1, belowInPhi + 1));
285  binsBelow.push_back(supercellMapTWR.GetBinContent(i + 2, belowInPhi + 1));
286  binsBelow.push_back(supercellMapTWR.GetBinContent(i, j + 1));
287 
288  bool isMax = true;
289 
290  // Check if it is a local maximum
291  for (unsigned int k = 0; k < binsAbove.size(); k++)
292  {
293  if (towerET < binsAbove[k])
294  isMax = false;
295  }
296  for (unsigned int k = 0; k < binsBelow.size(); k++)
297  {
298  if (towerET <= binsBelow[k])
299  isMax = false;
300  }
301 
302  if (isMax)
303  {
304  TLorentzVector myMaximum;
305  myMaximum.SetPtEtaPhiM(towerET, supercellMapTWR.GetXaxis()->GetBinCenter(i + 1), supercellMapTWR.GetYaxis()->GetBinCenter(j + 1), 0);
306  localMaxima.push_back(myMaximum);
307  }
308  }
309  }
310 
311  if (msgLvl(MSG::DEBUG))
312  {
313  for (int i = 1; i < supercellMapEM1_coarse.GetNbinsX() + 1; i++)
314  {
315  for (int j = 1; j < supercellMapEM1_coarse.GetNbinsY() + 1; j++)
316  {
317  ATH_MSG_DEBUG("supercellMapEM1_coarse.GetBinContent(" << i << "," << j << ") " << supercellMapEM1_coarse.GetBinContent(i, j));
318  ATH_MSG_DEBUG("supercellMapEM2_coarse.GetBinContent(" << i << "," << j << ") " << supercellMapEM2_coarse.GetBinContent(i, j));
319  ATH_MSG_DEBUG("supercellMapEM2_coarse.GetXaxis()->GetBinCenter(" << i << ") " << supercellMapEM2_coarse.GetXaxis()->GetBinCenter(i));
320  ATH_MSG_DEBUG("supercellMapEM2_coarse.GetYaxis()->GetBinCenter(" << j << ") " << supercellMapEM2_coarse.GetYaxis()->GetBinCenter(j));
321  }
322  }
323  }
324 
325  // Now loop over local maxima, decide what to do
326  for (auto myMaximum : localMaxima)
327  {
328  // Check eta bounds
329  if (std::abs(myMaximum.Eta()) > 2.5)
330  {
331  continue;
332  }
333  // Cluster coordinates
334  // Get eta coordinate for coarse layers EM0, EM3, HAD, and TWR
335  int i = supercellMapTWR.GetXaxis()->FindFixBin(myMaximum.Eta());
336  // Careful, ROOT conventions are -pi,pi
337  int j = supercellMapTWR.GetYaxis()->FindFixBin(TVector2::Phi_0_2pi(myMaximum.Phi()));
338  // Get eta coordinate for fine layers EM1 and EM2
339  int i_fine_start = ((i - 1) * 4) + 1;
340  int i_offset = 0;
341  double i_max = 0;
342  for (unsigned int i_off_cand = 0; i_off_cand < 4; i_off_cand++)
343  {
344  int i_et = supercellMapEM2.GetBinContent(i_fine_start + i_off_cand, j);
345  if (i_et > i_max)
346  {
347  i_max = i_et;
348  i_offset = i_off_cand;
349  }
350  }
351  int i_fine = i_fine_start + i_offset;
352 
353  // Prepare Phi Wrap-around
354  int aboveInPhi = j + 1;
355  if (j == supercellMapTWR.GetNbinsY())
356  {
357  aboveInPhi = 1;
358  }
359  int belowInPhi = j - 1;
360  if (j == 1)
361  {
362  belowInPhi = supercellMapTWR.GetNbinsY();
363  }
364 
365  // Start calculating total energy
366  // Use Fixed 2x2 cluster, 4 possibilities
367  std::vector<double> allET;
368  allET.reserve(4);
369 
370  double ET;
371  // Up and right
372  ET = supercellMapTWR.GetBinContent(i, j);
373  ET += supercellMapTWR.GetBinContent(i + 1, j);
374  ET += supercellMapTWR.GetBinContent(i, aboveInPhi);
375  ET += supercellMapTWR.GetBinContent(i + 1, aboveInPhi);
376  allET.push_back(ET);
377 
378  // Up and left
379  ET = supercellMapTWR.GetBinContent(i, j);
380  ET += supercellMapTWR.GetBinContent(i - 1, j);
381  ET += supercellMapTWR.GetBinContent(i, aboveInPhi);
382  ET += supercellMapTWR.GetBinContent(i - 1, aboveInPhi);
383  allET.push_back(ET);
384 
385  // Down and left
386  ET = supercellMapTWR.GetBinContent(i, j);
387  ET += supercellMapTWR.GetBinContent(i - 1, j);
388  ET += supercellMapTWR.GetBinContent(i, belowInPhi);
389  ET += supercellMapTWR.GetBinContent(i - 1, belowInPhi);
390  allET.push_back(ET);
391 
392  // Down and right
393  ET = supercellMapTWR.GetBinContent(i, j);
394  ET += supercellMapTWR.GetBinContent(i + 1, j);
395  ET += supercellMapTWR.GetBinContent(i, belowInPhi);
396  ET += supercellMapTWR.GetBinContent(i + 1, belowInPhi);
397  allET.push_back(ET);
398 
399  // Pick largest resulting sum
400  double eFEXOldCluster = 0;
401  for (unsigned int k = 0; k < allET.size(); k++)
402  {
403  if (allET.at(k) > eFEXOldCluster)
404  eFEXOldCluster = allET.at(k);
405  }
406 
407  // Calculate Oregon algorithm reconstructed ET
408  // Determine if the Oregon shapes, which are asymmetric in phi, should be oriented up or down
409  bool sumAboveInPhi = true;
410 
411  // Sum the cells above in phi for EM1 and EM2
412  double abovePhiCellET = supercellMapEM2.GetBinContent(i_fine, aboveInPhi);
413 
414  // Sum the cells below in phi for EM1 and EM2
415  double belowPhiCellET = supercellMapEM2.GetBinContent(i_fine, belowInPhi);
416 
417  // If more energy deposited below in phi, then orient shapes downward
418  if (belowPhiCellET > abovePhiCellET)
419  sumAboveInPhi = false;
420 
421  // Hold the coordinate of the non-central phi row
422  int offPhiCoordinate = sumAboveInPhi ? aboveInPhi : belowInPhi;
423 
424  // Construct 3x2 EM0 Oregon layer energy
425  double em0OregonET = 0;
426  em0OregonET += supercellMapEM0.GetBinContent(i, j);
427  em0OregonET += supercellMapEM0.GetBinContent(i - 1, j);
428  em0OregonET += supercellMapEM0.GetBinContent(i + 1, j);
429  em0OregonET += supercellMapEM0.GetBinContent(i, offPhiCoordinate);
430  em0OregonET += supercellMapEM0.GetBinContent(i - 1, offPhiCoordinate);
431  em0OregonET += supercellMapEM0.GetBinContent(i + 1, offPhiCoordinate);
432 
433  // Construct 5x2 EM1 Oregon layer energy
434  double em1OregonET = 0;
435  em1OregonET += supercellMapEM1.GetBinContent(i_fine, j);
436  em1OregonET += supercellMapEM1.GetBinContent(i_fine - 1, j);
437  em1OregonET += supercellMapEM1.GetBinContent(i_fine - 2, j);
438  em1OregonET += supercellMapEM1.GetBinContent(i_fine + 1, j);
439  em1OregonET += supercellMapEM1.GetBinContent(i_fine + 2, j);
440  em1OregonET += supercellMapEM1.GetBinContent(i_fine, offPhiCoordinate);
441  em1OregonET += supercellMapEM1.GetBinContent(i_fine - 1, offPhiCoordinate);
442  em1OregonET += supercellMapEM1.GetBinContent(i_fine - 2, offPhiCoordinate);
443  em1OregonET += supercellMapEM1.GetBinContent(i_fine + 1, offPhiCoordinate);
444  em1OregonET += supercellMapEM1.GetBinContent(i_fine + 2, offPhiCoordinate);
445 
446  // Construct 5x2 EM2 Oregon layer energy
447  double em2OregonET = 0;
448  em2OregonET += supercellMapEM2.GetBinContent(i_fine, j);
449  em2OregonET += supercellMapEM2.GetBinContent(i_fine - 1, j);
450  em2OregonET += supercellMapEM2.GetBinContent(i_fine - 2, j);
451  em2OregonET += supercellMapEM2.GetBinContent(i_fine + 1, j);
452  em2OregonET += supercellMapEM2.GetBinContent(i_fine + 2, j);
453  em2OregonET += supercellMapEM2.GetBinContent(i_fine, offPhiCoordinate);
454  em2OregonET += supercellMapEM2.GetBinContent(i_fine - 1, offPhiCoordinate);
455  em2OregonET += supercellMapEM2.GetBinContent(i_fine - 2, offPhiCoordinate);
456  em2OregonET += supercellMapEM2.GetBinContent(i_fine + 1, offPhiCoordinate);
457  em2OregonET += supercellMapEM2.GetBinContent(i_fine + 2, offPhiCoordinate);
458 
459  // Construct 3x2 EM3 Oregon layer energy
460  double em3OregonET = 0;
461  em3OregonET += supercellMapEM3.GetBinContent(i, j);
462  em3OregonET += supercellMapEM3.GetBinContent(i - 1, j);
463  em3OregonET += supercellMapEM3.GetBinContent(i + 1, j);
464  em3OregonET += supercellMapEM3.GetBinContent(i, offPhiCoordinate);
465  em3OregonET += supercellMapEM3.GetBinContent(i - 1, offPhiCoordinate);
466  em3OregonET += supercellMapEM3.GetBinContent(i + 1, offPhiCoordinate);
467 
468  // Construct 3x2 HAD Oregon layer energy
469  double hadOregonET = 0;
470  hadOregonET += supercellMapHAD.GetBinContent(i, j);
471  hadOregonET += supercellMapHAD.GetBinContent(i - 1, j);
472  hadOregonET += supercellMapHAD.GetBinContent(i + 1, j);
473  hadOregonET += supercellMapHAD.GetBinContent(i, offPhiCoordinate);
474  hadOregonET += supercellMapHAD.GetBinContent(i - 1, offPhiCoordinate);
475  hadOregonET += supercellMapHAD.GetBinContent(i + 1, offPhiCoordinate);
476 
477  // Add individual layer energies to get the full Oregon reconstructed energy
478  double eFEX_OregonET = em0OregonET + em1OregonET + em2OregonET + em3OregonET + hadOregonET;
479 
480  // Calculate Oregon algorithm isolation value
481  // Construct inner 3x2 energy
482  double oreIsoInnerET = 0;
483  oreIsoInnerET += supercellMapEM2.GetBinContent(i_fine, j);
484  oreIsoInnerET += supercellMapEM2.GetBinContent(i_fine - 1, j);
485  oreIsoInnerET += supercellMapEM2.GetBinContent(i_fine + 1, j);
486  oreIsoInnerET += supercellMapEM2.GetBinContent(i_fine, offPhiCoordinate);
487  oreIsoInnerET += supercellMapEM2.GetBinContent(i_fine - 1, offPhiCoordinate);
488  oreIsoInnerET += supercellMapEM2.GetBinContent(i_fine + 1, offPhiCoordinate);
489 
490  // Construct outer 9x2 energy using inner sum plus extra cells
491  double oreIsoOuterET = oreIsoInnerET;
492  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine - 2, j);
493  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine - 3, j);
494  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine - 4, j);
495  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine + 2, j);
496  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine + 3, j);
497  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine + 4, j);
498  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine - 2, offPhiCoordinate);
499  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine - 3, offPhiCoordinate);
500  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine - 4, offPhiCoordinate);
501  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine + 2, offPhiCoordinate);
502  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine + 3, offPhiCoordinate);
503  oreIsoOuterET += supercellMapEM2.GetBinContent(i_fine + 4, offPhiCoordinate);
504 
505  // Calculate isolation value as the ratio of inner over outer energies
506  double eFEX_OregonIso = oreIsoOuterET ? oreIsoInnerET / oreIsoOuterET : oreIsoInnerET;
507 
508  // Calculation of isolation cut values discussed here
509  // https://indico.cern.ch/event/867020/contributions/3726146/attachments/2003208/3344698/L1CALOJoint03132020.pdf
510 
511  // Set boolean for whether event passes 12 GeV isolation cut, hardcoding isolation threshold for now
512  bool eFEX_OregonIso_12pass = true;
513  if (10000. < eFEX_OregonET && 15000. > eFEX_OregonET && eFEX_OregonIso < 0.69)
514  {
515  eFEX_OregonIso_12pass = false;
516  }
517 
518  // Set boolean for whether event passes 20 GeV isolation cut, hardcoding isolation threshold for now
519  bool eFEX_OregonIso_20pass = true;
520  if (20000. < eFEX_OregonET && 25000. > eFEX_OregonET && eFEX_OregonIso < 0.61)
521  {
522  eFEX_OregonIso_20pass = false;
523  }
524 
525  // Code Oregon cluster later
526  // Will need to write a library of shape summation functions
527  // EM0: 1x2, 4 possibilities
528  // EM1: 5x2
529  // EM2: 5x2
530  // EM3: 3x2
531  // HAD: 3x2
532 
533  //Code TLV bigCluster algorithm
534 
535  //make vectors with EM0/3/HAD energies in each of 3x3 bins
536  //Make a function since this is disgusting but vim does it very fast
537  std::vector<double> E_EM0;
538  E_EM0.reserve(9);
539  E_EM0.push_back(supercellMapEM0.GetBinContent(i, j));
540  E_EM0.push_back(supercellMapEM0.GetBinContent(i - 1, j));
541  E_EM0.push_back(supercellMapEM0.GetBinContent(i - 1, aboveInPhi));
542  E_EM0.push_back(supercellMapEM0.GetBinContent(i, aboveInPhi));
543  E_EM0.push_back(supercellMapEM0.GetBinContent(i + 1, aboveInPhi));
544  E_EM0.push_back(supercellMapEM0.GetBinContent(i + 1, j));
545  E_EM0.push_back(supercellMapEM0.GetBinContent(i + 1, belowInPhi));
546  E_EM0.push_back(supercellMapEM0.GetBinContent(i, belowInPhi));
547  E_EM0.push_back(supercellMapEM0.GetBinContent(i - 1, belowInPhi));
548  std::vector<double> E_EM3;
549  E_EM3.reserve(9);
550  E_EM3.push_back(supercellMapEM3.GetBinContent(i, j));
551  E_EM3.push_back(supercellMapEM3.GetBinContent(i - 1, j));
552  E_EM3.push_back(supercellMapEM3.GetBinContent(i - 1, aboveInPhi));
553  E_EM3.push_back(supercellMapEM3.GetBinContent(i, aboveInPhi));
554  E_EM3.push_back(supercellMapEM3.GetBinContent(i + 1, aboveInPhi));
555  E_EM3.push_back(supercellMapEM3.GetBinContent(i + 1, j));
556  E_EM3.push_back(supercellMapEM3.GetBinContent(i + 1, belowInPhi));
557  E_EM3.push_back(supercellMapEM3.GetBinContent(i, belowInPhi));
558  E_EM3.push_back(supercellMapEM3.GetBinContent(i - 1, belowInPhi));
559  std::vector<double> E_HAD;
560  E_HAD.reserve(9);
561  E_HAD.push_back(supercellMapHAD.GetBinContent(i, j));
562  E_HAD.push_back(supercellMapHAD.GetBinContent(i - 1, j));
563  E_HAD.push_back(supercellMapHAD.GetBinContent(i - 1, aboveInPhi));
564  E_HAD.push_back(supercellMapHAD.GetBinContent(i, aboveInPhi));
565  E_HAD.push_back(supercellMapHAD.GetBinContent(i + 1, aboveInPhi));
566  E_HAD.push_back(supercellMapHAD.GetBinContent(i + 1, j));
567  E_HAD.push_back(supercellMapHAD.GetBinContent(i + 1, belowInPhi));
568  E_HAD.push_back(supercellMapHAD.GetBinContent(i, belowInPhi));
569  E_HAD.push_back(supercellMapHAD.GetBinContent(i - 1, belowInPhi));
570  std::vector<double> E_EM12_central;
571  E_EM12_central.reserve(5);
572  std::vector<double> E_EM12_above;
573  E_EM12_above.reserve(6);
574  std::vector<double> E_EM12_below;
575  E_EM12_below.reserve(6);
576  float seedEta = supercellMapTWR.GetXaxis()->GetBinCenter(i);
577  int EM2seedBin = supercellMapEM2_coarse.GetXaxis()->FindBin(seedEta - 0.025);
578 
579  // Make a vector with the 5 possible energies in the central phi row
580  E_EM12_central.push_back(supercellMapEM2_coarse.GetBinContent(EM2seedBin - 2, j) + supercellMapEM2_coarse.GetBinContent(EM2seedBin - 1, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin - 2, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin - 1, j));
581  E_EM12_central.push_back(supercellMapEM2_coarse.GetBinContent(EM2seedBin - 1, j) + supercellMapEM2_coarse.GetBinContent(EM2seedBin - 0, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin - 1, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin - 0, j));
582  E_EM12_central.push_back(supercellMapEM2_coarse.GetBinContent(EM2seedBin - 0, j) + supercellMapEM2_coarse.GetBinContent(EM2seedBin + 1, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin - 0, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin + 1, j));
583  E_EM12_central.push_back(supercellMapEM2_coarse.GetBinContent(EM2seedBin + 1, j) + supercellMapEM2_coarse.GetBinContent(EM2seedBin + 2, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin + 1, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin + 2, j));
584  E_EM12_central.push_back(supercellMapEM2_coarse.GetBinContent(EM2seedBin + 2, j) + supercellMapEM2_coarse.GetBinContent(EM2seedBin + 3, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin + 2, j) + supercellMapEM1_coarse.GetBinContent(EM2seedBin + 3, j));
585  //For upper and lower phi rows take the bin with highest energy
586  for (int k = -2; k <= 3; k++)
587  {
588  E_EM12_above.push_back(supercellMapEM2_coarse.GetBinContent(EM2seedBin + k, aboveInPhi) + supercellMapEM1_coarse.GetBinContent(EM2seedBin + k, aboveInPhi));
589  E_EM12_below.push_back(supercellMapEM2_coarse.GetBinContent(EM2seedBin + k, belowInPhi) + supercellMapEM1_coarse.GetBinContent(EM2seedBin + k, belowInPhi));
590  }
591 
592  sort(E_EM0.begin(), E_EM0.end());
593  sort(E_EM3.begin(), E_EM3.end());
594  sort(E_HAD.begin(), E_HAD.end());
595  sort(E_EM12_central.begin(), E_EM12_central.end());
596  sort(E_EM12_above.begin(), E_EM12_above.end());
597  sort(E_EM12_below.begin(), E_EM12_below.end());
598 
599  double eFEX_BC = 0;
600 
601  //Three hottest bins in EM0
602  eFEX_BC = E_EM0.at(E_EM0.size() - 1) + E_EM0.at(E_EM0.size() - 2) + E_EM0.at(E_EM0.size() - 3);
603  //Two hottest bins in EM3
604  eFEX_BC += E_EM3.at(E_EM3.size() - 1) + E_EM3.at(E_EM3.size() - 2);
605  //Three hottest bins in HAD
606  eFEX_BC += E_HAD.at(E_HAD.size() - 1) + E_HAD.at(E_HAD.size() - 2) + E_HAD.at(E_HAD.size() - 3);
607  eFEX_BC += E_EM12_central.at(E_EM12_central.size() - 1);
608  eFEX_BC += E_EM12_above.at(E_EM12_above.size() - 1);
609  eFEX_BC += E_EM12_below.at(E_EM12_below.size() - 1);
610 
611  //Bigcluster isolation
612  float nomeFEX_BCiso = 0;
613  nomeFEX_BCiso += E_EM12_central.at(E_EM12_central.size() - 1);
614  nomeFEX_BCiso += E_EM12_above.at(E_EM12_above.size() - 1);
615  nomeFEX_BCiso += E_EM12_below.at(E_EM12_below.size() - 1);
616  nomeFEX_BCiso += E_EM0.at(E_EM0.size() - 1);
617  nomeFEX_BCiso += E_EM0.at(E_EM0.size() - 2);
618  nomeFEX_BCiso += E_EM0.at(E_EM0.size() - 3);
619  nomeFEX_BCiso += E_EM3.at(E_EM3.size() - 1);
620  nomeFEX_BCiso += E_EM3.at(E_EM3.size() - 2);
621 
622  float denBCiso = 0;
623  denBCiso += supercellMapTWR.GetBinContent(i, j);
624  denBCiso += supercellMapTWR.GetBinContent(i - 1, j);
625  denBCiso += supercellMapTWR.GetBinContent(i + 1, j);
626  denBCiso += supercellMapTWR.GetBinContent(i, j + 1);
627  denBCiso += supercellMapTWR.GetBinContent(i - 1, j + 1);
628  denBCiso += supercellMapTWR.GetBinContent(i + 1, j + 1);
629  denBCiso += supercellMapTWR.GetBinContent(i, j - 1);
630  denBCiso += supercellMapTWR.GetBinContent(i - 1, j - 1);
631  denBCiso += supercellMapTWR.GetBinContent(i + 1, j - 1);
632 
633  float eFEX_BCiso = denBCiso ? nomeFEX_BCiso / denBCiso : nomeFEX_BCiso;
634 
635  // Set boolean for whether event passes 12 GeV isolation cut, hardcoding isolation threshold for now
636  bool eFEX_BCiso_12pass = true;
637  if (10000. < eFEX_BC && 15000. > eFEX_BC && eFEX_BCiso < 0.38)
638  {
639  eFEX_BCiso_12pass = false;
640  }
641 
642  // Set boolean for whether event passes 20 GeV isolation cut, hardcoding isolation threshold for now
643  bool eFEX_BCiso_20pass = true;
644  if (20000. < eFEX_BC && 25000. > eFEX_BC && eFEX_BCiso < 0.18)
645  {
646  eFEX_BCiso_20pass = false;
647  }
648 
649  // Calculate an EM2-based isolation
650  // Center in EM2, offset to the right in eta:
651  int em2i = supercellMapEM2.GetXaxis()->FindFixBin(myMaximum.Eta() + 0.05);
652  // Careful, ROOT conventions are -pi,pi
653  int em2j = supercellMapEM2.GetYaxis()->FindFixBin(TVector2::Phi_0_2pi(myMaximum.Phi()));
654 
655  float maximumET = supercellMapEM2.GetBinContent(em2i, em2j);
656  int maximumCell = em2i;
657 
658  // Find maximum in EM2
659  for (int k = -2; k < 2; k++)
660  {
661  float ETvalue = supercellMapEM2.GetBinContent(em2i + k, em2j);
662  if (ETvalue > maximumET)
663  {
664  maximumET = ETvalue;
665  maximumCell = em2i + k;
666  }
667  }
668 
669  // Find highest pT nearest cell, but we don't care which it is
670  // Note that we don't need to worry about phi wrap-around
671  float nextET = supercellMapEM2.GetBinContent(maximumCell + 1, em2j);
672  nextET = ((supercellMapEM2.GetBinContent(maximumCell - 1, em2j) > nextET) ? supercellMapEM2.GetBinContent(maximumCell - 1, em2j) : nextET);
673  nextET = ((supercellMapEM2.GetBinContent(maximumCell, em2j + 1) > nextET) ? supercellMapEM2.GetBinContent(maximumCell, em2j + 1) : nextET);
674  nextET = ((supercellMapEM2.GetBinContent(maximumCell, em2j - 1) > nextET) ? supercellMapEM2.GetBinContent(maximumCell, em2j - 1) : nextET);
675 
676  float numerator = maximumET + nextET;
677 
678  // And now, run the full sum: avoid phi wrapping by converting back and forth
679  float denominator = 0;
680  float phicenter = supercellMapEM2.GetYaxis()->GetBinCenter(em2j);
681  for (int eta = -6; eta < 6; eta++)
682  for (int phi = -1; phi < 2; phi++)
683  denominator += supercellMapEM2.GetBinContent(em2i + eta, supercellMapEM2.GetYaxis()->FindFixBin(TVector2::Phi_0_2pi(phicenter + (phi * 0.1))));
684 
685  // build cluster for tau
686  //xAOD::EmTauRoI_v2* clForTau = new xAOD::EmTauRoI_v2();
687  xAOD::EmTauRoI *clForTau = new xAOD::EmTauRoI();
688  clustersForTau->push_back(clForTau);
689  clForTau->setEta(myMaximum.Eta());
690  clForTau->setPhi(myMaximum.Phi());
691 
692  decR3ClusterET(*clForTau) = eFEXOldCluster;
693  decR3OreClusterET(*clForTau) = eFEX_OregonET;
694  decR3BCClusterET(*clForTau) = eFEX_BC;
695  decR3BCClusterIso(*clForTau) = denBCiso > 0 ? eFEX_BCiso : 0;
696  decR3OreClusterIso(*clForTau) = oreIsoOuterET > 0 ? eFEX_OregonIso : 0;
697 
698  decR3OreIsoPass12(*clForTau) = eFEX_OregonIso_12pass;
699  decR3OreIsoPass20(*clForTau) = eFEX_OregonIso_20pass;
700  decR3BCIsoPass12(*clForTau) = eFEX_BCiso_12pass;
701  decR3BCIsoPass20(*clForTau) = eFEX_BCiso_20pass;
702  decR3ClusterIso(*clForTau) = denominator > 0 ? numerator / denominator : 0;
703  }
704 
705  auto writeHandle = SG::makeHandle(m_outputClusterName, ctx);
706  ATH_CHECK(writeHandle.record(std::move(clustersForTau), std::move(auxClustersForTau)));
707  return StatusCode::SUCCESS;
708 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthReentrantAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 79 of file AthReentrantAlgorithm.cxx.

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ initialize()

StatusCode LVL1::EFexTauAlgorithm::initialize ( )
override

Definition at line 54 of file EFexTauAlgorithm.cxx.

55 {
56  ATH_MSG_DEBUG("initialize");
60 
61  ATH_CHECK(m_outputClusterName.initialize());
62  return StatusCode::SUCCESS;
63 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ msg() [1/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

◆ sysExecute()

StatusCode AthReentrantAlgorithm::sysExecute ( const EventContext &  ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 67 of file AthReentrantAlgorithm.cxx.

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

◆ sysInitialize()

StatusCode AthReentrantAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in InputMakerBase, and HypoBase.

Definition at line 96 of file AthReentrantAlgorithm.cxx.

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 153 of file AthReentrantAlgorithm.h.

◆ m_inputCellContainerKey

SG::ReadHandleKey<CaloCellContainer> LVL1::EFexTauAlgorithm::m_inputCellContainerKey
private

input / output

LAr SuperCell input container

Definition at line 47 of file EFexTauAlgorithm.h.

◆ m_inputTileCellContainerKey

SG::ReadHandleKey<CaloCellContainer> LVL1::EFexTauAlgorithm::m_inputTileCellContainerKey
private

Tile cell input container.

Definition at line 48 of file EFexTauAlgorithm.h.

◆ m_inputTriggerTowerContainerKey

SG::ReadHandleKey<xAOD::TriggerTowerContainer> LVL1::EFexTauAlgorithm::m_inputTriggerTowerContainerKey
private

TriggerTowers (if needed)

Definition at line 49 of file EFexTauAlgorithm.h.

◆ m_nominalDigitization

float LVL1::EFexTauAlgorithm::m_nominalDigitization
private

value of nominal digitisation

Definition at line 61 of file EFexTauAlgorithm.h.

◆ m_nominalNoise_thresh

float LVL1::EFexTauAlgorithm::m_nominalNoise_thresh
private

noise threshold

Definition at line 62 of file EFexTauAlgorithm.h.

◆ m_outputClusterName

SG::WriteHandleKey<xAOD::EmTauRoIContainer> LVL1::EFexTauAlgorithm::m_outputClusterName
private

Definition at line 50 of file EFexTauAlgorithm.h.

◆ m_qualBitMask

int LVL1::EFexTauAlgorithm::m_qualBitMask
private

Configurable quality bitmask.

Definition at line 59 of file EFexTauAlgorithm.h.

◆ m_timeThr

float LVL1::EFexTauAlgorithm::m_timeThr
private

Definition at line 63 of file EFexTauAlgorithm.h.

◆ m_use_tileCells

bool LVL1::EFexTauAlgorithm::m_use_tileCells
private

properties

boolean for using Tile cells instead of Tile TT

Definition at line 55 of file EFexTauAlgorithm.h.

◆ m_useProvenance

bool LVL1::EFexTauAlgorithm::m_useProvenance
private

clear up container from bad BC by skipping scells

Definition at line 58 of file EFexTauAlgorithm.h.

◆ m_useProvenanceSkim

bool LVL1::EFexTauAlgorithm::m_useProvenanceSkim
private

clear up container from bad BC by making a new container (Denis, old way)

Definition at line 57 of file EFexTauAlgorithm.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
test_pyathena.eta
eta
Definition: test_pyathena.py:10
xAOD::EmTauRoI_v2::setEta
void setEta(float v)
Set the pseudorapidity of the em/tau candidate.
LVL1::EFexTauAlgorithm::m_useProvenanceSkim
bool m_useProvenanceSkim
clear up container from bad BC by making a new container (Denis, old way)
Definition: EFexTauAlgorithm.h:57
get_generator_info.result
result
Definition: get_generator_info.py:21
LVL1::EFexTauAlgorithm::m_inputTriggerTowerContainerKey
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_inputTriggerTowerContainerKey
TriggerTowers (if needed)
Definition: EFexTauAlgorithm.h:49
LVL1::EFexTauAlgorithm::m_nominalNoise_thresh
float m_nominalNoise_thresh
noise threshold
Definition: EFexTauAlgorithm.h:62
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
LVL1::EFexTauAlgorithm::m_use_tileCells
bool m_use_tileCells
properties
Definition: EFexTauAlgorithm.h:55
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LVL1::EFexTauAlgorithm::m_useProvenance
bool m_useProvenance
clear up container from bad BC by skipping scells
Definition: EFexTauAlgorithm.h:58
AthCommonDataStore::renounce
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Definition: AthCommonDataStore.h:380
M_PI
#define M_PI
Definition: ActiveFraction.h:11
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
CaloCell::provenance
uint16_t provenance() const
get provenance (data member)
Definition: CaloCell.h:338
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:554
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
xAOD::EmTauRoI
EmTauRoI_v2 EmTauRoI
Definition: EmTauRoI.h:16
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
LVL1::EFexTauAlgorithm::m_inputTileCellContainerKey
SG::ReadHandleKey< CaloCellContainer > m_inputTileCellContainerKey
Tile cell input container.
Definition: EFexTauAlgorithm.h:48
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::EmTauRoI_v2
Class describing a LVL1 em/tau region of interest.
Definition: EmTauRoI_v2.h:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::EFexTauAlgorithm::m_inputCellContainerKey
SG::ReadHandleKey< CaloCellContainer > m_inputCellContainerKey
input / output
Definition: EFexTauAlgorithm.h:47
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ReadTripsProbsFromCool.denominator
denominator
Definition: ReadTripsProbsFromCool.py:96
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
LVL1::EFexTauAlgorithm::m_outputClusterName
SG::WriteHandleKey< xAOD::EmTauRoIContainer > m_outputClusterName
Definition: EFexTauAlgorithm.h:50
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition: CaloConstCellContainer.h:45
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LVL1::EFexTauAlgorithm::m_nominalDigitization
float m_nominalDigitization
value of nominal digitisation
Definition: EFexTauAlgorithm.h:61
DEBUG
#define DEBUG
Definition: page_access.h:11
LVL1::EFexTauAlgorithm::CaloCellET
float CaloCellET(const CaloCell *const &inputCell, float digitScale, float digitThreshold) const
member functions
Definition: EFexTauAlgorithm.cxx:65
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
xAOD::EmTauRoI_v2::setPhi
void setPhi(float v)
Set the azimuthal angle of the em/tau candidate.
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LVL1::EFexTauAlgorithm::m_qualBitMask
int m_qualBitMask
Configurable quality bitmask.
Definition: EFexTauAlgorithm.h:59
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
LVL1::EFexTauAlgorithm::m_timeThr
float m_timeThr
Definition: EFexTauAlgorithm.h:63
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >