ATLAS Offline Software
Loading...
Searching...
No Matches
Ringer::CaloCornerRingsBuilder Class Reference

#include <CaloCornerRingsBuilder.h>

Inheritance diagram for Ringer::CaloCornerRingsBuilder:
Collaboration diagram for Ringer::CaloCornerRingsBuilder:

Public Member Functions

virtual StatusCode execute (const xAOD::CaloCluster &cluster, ElementLink< xAOD::CaloRingsContainer > &clRings) override
 Tool main methods:
virtual StatusCode execute (const xAOD::IParticle &particle, ElementLink< xAOD::CaloRingsContainer > &clRings) override
 execute method for IParticle
std::size_t nRingSets () const override
const SG::WriteHandleKey< xAOD::CaloRingsContainer > & crContName () const override
const SG::WriteHandleKey< xAOD::RingSetContainer > & rsContName () const override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
CaloCornerRingsBuilder ctors and dtors:
 CaloCornerRingsBuilder (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor.
 ~CaloCornerRingsBuilder ()
 Destructor.
virtual StatusCode initialize () override
 Tool main methods:
virtual StatusCode preExecute (xAOD::CaloRingsContainer *crCont, xAOD::RingSetContainer *rsCont, const std::size_t nReserve=0) override
 method for working on containers
virtual StatusCode finalize () override
 finalize method
const xAOD::RingSetConf::RawConfCollectionrawConf () override
 Extra methods:
bool useShowerShapeBarycenter () override
 Retrieve whether it was set used shower shape barycenter.

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface methods.

Protected Member Functions

virtual StatusCode buildRingSet (const xAOD::RingSetConf::RawConf &rawConf, const AtlasGeoPoint &seed, xAOD::RingSet *rs, const unsigned int offset, const unsigned int nSubRings)
StatusCode getCornerRingsSeeds (const xAOD::RingSetConf::RawConf &rawConf, const AtlasGeoPoint &centralSeed, std::vector< AtlasGeoPoint > &cornerSeeds)
 Get the seeds for the corner rings (top-left, etc).
virtual StatusCode buildRingSet (const xAOD::RingSetConf::RawConf &rawConf, const AtlasGeoPoint &seed, xAOD::RingSet *rs)
 Tool protected methods:
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Protected Attributes

Gaudi::Property< int > m_cornerShift
 Number of cells to shift for corner seeds (top-left, etc).
SG::WriteHandleKey< xAOD::CaloRingsContainerm_crContName
 Tool props (python configurables):
SG::WriteHandleKey< xAOD::RingSetContainerm_rsContName
 Name of RingSetContainer on Event StoreGate.
SG::ReadHandleKey< CaloCellContainerm_cellsContName
 Name of CaloCellContainer.
Gaudi::Property< std::vector< float > > m_etaWidth
 Width of the ring in eta.
Gaudi::Property< std::vector< float > > m_phiWidth
 Width of the ring in phi.
Gaudi::Property< float > m_cellMaxDEtaDist
 Maximum cell distance in eta to seed.
Gaudi::Property< float > m_cellMaxDPhiDist
 Maximum cell distance in phi to seed.
Gaudi::Property< std::vector< unsigned int > > m_nRings
 Number of rings in a ringset.
Gaudi::Property< float > m_minEnergy
 Minimum particle energy to build rings (GeV).
Gaudi::Property< std::vector< int > > m_layers
 Calorimeter layers in each ringset.
Gaudi::Property< std::vector< unsigned int > > m_nLayers
 Number of calorimeter layers in each ringset.
Gaudi::Property< bool > m_useShowShapeBarycenter
 Switch to use shower barycenter seed for each RingSets.
Gaudi::Property< bool > m_doTransverseEnergy
 Switch to use raw cell energy instead ET.
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager"}

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>
template<typename T>
StatusCode executeTemp (const T &input, ElementLink< xAOD::CaloRingsContainer > &crEL)
 Tool private methods:

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared
xAOD::RingSetContainerm_rsCont
 Tool props (non configurables):
xAOD::CaloRingsContainerm_crCont
 Create and hold CaloRingsContainer for each event.
xAOD::RingSetConf::RawConfCollection m_rsRawConfCol
 holds each RingSet configuration (filled at initialize)
AtlasGeoPoint m_lastValidSeed
 last valid RingSet seed
size_t m_nRingSets
 hold the number of RingSets we are building for each CaloRings
static const CaloPhiRange m_phiHelper
 used for phi wrap-around
StatusCode getRingSetSeed (const xAOD::RingSetConf::RawConf &conf, const xAOD::CaloCluster &cluster, AtlasGeoPoint &seed)
 Fill RingSet seed for CaloCluster.
static StatusCode getRingSetSeed (const xAOD::RingSetConf::RawConf &, const xAOD::IParticle &part, AtlasGeoPoint &seed)
 Fill RingSet seed for IParticle.

Detailed Description

Definition at line 15 of file CaloCornerRingsBuilder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CaloCornerRingsBuilder()

Ringer::CaloCornerRingsBuilder::CaloCornerRingsBuilder ( const std::string & type,
const std::string & name,
const IInterface * parent )

Default constructor.

Definition at line 37 of file CaloCornerRingsBuilder.cxx.

40 : CaloRingsBuilder(type, name, parent)
41 {
42
43 declareInterface<ICaloRingsBuilder>(this);
44 }
CaloRingsBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.

◆ ~CaloCornerRingsBuilder()

Ringer::CaloCornerRingsBuilder::~CaloCornerRingsBuilder ( )
default

Destructor.

Member Function Documentation

◆ buildRingSet() [1/2]

Tool protected methods:

main method where the RingSets are built.

Reimplemented from Ringer::CaloRingsBuilder.

Definition at line 118 of file CaloRingsBuilder.cxx.

319 {
320 // Get this RingSet size:
321 const auto nRings = rawConf.nRings;
322
323 // Retrieve CaloCells
324 SG::ReadHandle<CaloCellContainer> cellsCont(m_cellsContName);
325 // check is only used for serial running; remove when MT scheduler used
326 if (!cellsCont.isValid())
327 {
328 ATH_MSG_FATAL("Failed to retrieve " << m_cellsContName.key());
329 return StatusCode::FAILURE;
330 }
331
332 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey};
333 const CaloDetDescrManager *caloMgr = *caloMgrHandle;
334
335 CaloCellList cells(caloMgr, cellsCont.ptr());
336
337 // loop over cells
338 for (const int layer : rawConf.layers)
339 { // We use int here because the
340 // cells.select() method needs int as param
341 cells.select(seed.eta(), seed.phi(), m_cellMaxDEtaDist, m_cellMaxDPhiDist, layer);
342 for (const CaloCell *cell : cells)
343 {
344
345 unsigned int ringNumber(0);
346
347 // calculate the normalised difference in eta
348 const float deltaEta = std::fabs(
349 (cell->eta() - seed.eta())) /
350 rawConf.etaWidth;
351 // calculate the normalised difference in phi
352 const float deltaPhi = std::fabs(
353 CaloPhiRange::diff(cell->phi(), seed.phi())) /
354 rawConf.phiWidth;
355 // The biggest difference indicates the ring number (we are using
356 // squared-shape rings)
357 const float deltaGreater = std::max(deltaEta, deltaPhi);
358
359 // Round to nearest integer:
360 ringNumber = static_cast<unsigned int>(std::floor(deltaGreater + .5));
361 if (ringNumber < nRings)
362 {
364 {
365 rs->at(ringNumber) += cell->energy() / std::cosh(cell->eta());
366 }
367 else
368 {
369 rs->at(ringNumber) += cell->energy();
370 }
371 }
372 }
373 }
374
375 return StatusCode::SUCCESS;
376 }
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_FATAL(x)
static Double_t rs
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
Gaudi::Property< bool > m_doTransverseEnergy
Switch to use raw cell energy instead ET.
Gaudi::Property< float > m_cellMaxDEtaDist
Maximum cell distance in eta to seed.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::ReadHandleKey< CaloCellContainer > m_cellsContName
Name of CaloCellContainer.
Gaudi::Property< float > m_cellMaxDPhiDist
Maximum cell distance in phi to seed.
virtual const xAOD::RingSetConf::RawConfCollection & rawConf()=0
Extra methods:
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition P4Helpers.h:66

◆ buildRingSet() [2/2]

StatusCode Ringer::CaloCornerRingsBuilder::buildRingSet ( const xAOD::RingSetConf::RawConf & rawConf,
const AtlasGeoPoint & seed,
xAOD::RingSet * rs,
const unsigned int offset,
const unsigned int nSubRings )
protectedvirtual

Definition at line 195 of file CaloCornerRingsBuilder.cxx.

201 {
202
203 SG::ReadHandle<CaloCellContainer> cellsCont(m_cellsContName);
204 ATH_CHECK(cellsCont.isValid());
205
206 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey};
207 ATH_CHECK(caloMgrHandle.isValid());
208
209 const CaloDetDescrManager *caloMgr = *caloMgrHandle;
210 CaloCellList cells(caloMgr, cellsCont.ptr());
211
212 for (const int layer : rawConf.layers)
213 {
214
215 ATH_MSG_DEBUG("Selecting cells in layer " << layer);
216
217 cells.select(seed.eta(), seed.phi(), m_cellMaxDEtaDist, m_cellMaxDPhiDist, layer);
218
219 for (const CaloCell *cell : cells)
220 {
221
222 unsigned int ringNumber(0);
223
224 const float deltaEta = std::abs((cell->eta() - seed.eta())) / rawConf.etaWidth;
225 const float deltaPhi = std::abs(CaloPhiRange::diff(cell->phi(), seed.phi())) / rawConf.phiWidth;
226
227 const float deltaGreater = std::max(deltaEta, deltaPhi);
228
229 ringNumber = static_cast<unsigned int>(std::floor(deltaGreater + .5));
230
231 if (ringNumber < nSubRings)
232 {
233 ringNumber += offset;
234
235 float energyToAdd = 0;
236
238 {
239 energyToAdd = cell->energy() / std::cosh(cell->eta());
240 }
241 else
242 {
243 energyToAdd = cell->energy();
244 }
245
246 rs->at(ringNumber) += energyToAdd;
247
248 ATH_MSG_DEBUG("New ring energy=" << rs->at(ringNumber));
249 }
250 }
251 }
252
253 return StatusCode::SUCCESS;
254 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)

◆ crContName()

const SG::WriteHandleKey< xAOD::CaloRingsContainer > & Ringer::CaloRingsBuilder::crContName ( ) const
inlineoverridevirtualinherited

Implements Ringer::ICaloRingsBuilder.

Definition at line 109 of file CaloRingsBuilder.h.

109{ return m_crContName; }
SG::WriteHandleKey< xAOD::CaloRingsContainer > m_crContName
Tool props (python configurables):

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute() [1/2]

StatusCode Ringer::CaloCornerRingsBuilder::execute ( const xAOD::CaloCluster & cluster,
ElementLink< xAOD::CaloRingsContainer > & clRings )
overridevirtual

Tool main methods:

Reimplemented from Ringer::CaloRingsBuilder.

Definition at line 48 of file CaloCornerRingsBuilder.cxx.

50 {
51 double et(0.);
52 const double eta2 = std::fabs(cluster.etaBE(2));
53 const double energy = cluster.e();
54 if (eta2 < 999.)
55 {
56 const double cosheta = std::cosh(eta2);
57 et = (cosheta != 0.) ? energy / cosheta : 0.;
58 }
59 if (et > m_minEnergy)
60 {
61 // This now correctly calls the CaloCornerRingsBuilder::executeTemp
62 return executeTemp(cluster, clRings);
63 }
64 else
65 {
66 ATH_MSG_DEBUG("Skipping cluster with low energy (" << et << " MeV) .");
67 return StatusCode::SUCCESS;
68 }
69 }
float et(const xAOD::jFexSRJetRoI *j)
StatusCode executeTemp(const T &input, ElementLink< xAOD::CaloRingsContainer > &crEL)
Tool private methods:
Gaudi::Property< float > m_minEnergy
Minimum particle energy to build rings (GeV).
virtual double e() const
The total energy of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.

◆ execute() [2/2]

StatusCode Ringer::CaloCornerRingsBuilder::execute ( const xAOD::IParticle & particle,
ElementLink< xAOD::CaloRingsContainer > & clRings )
overridevirtual

execute method for IParticle

Reimplemented from Ringer::CaloRingsBuilder.

Definition at line 71 of file CaloCornerRingsBuilder.cxx.

73 {
74 double et = particle.pt();
75 if (et > m_minEnergy)
76 {
77 // This now correctly calls the CaloCornerRingsBuilder::executeTemp
78 return executeTemp(particle, clRings);
79 }
80 else
81 {
82 ATH_MSG_DEBUG("Skipping particle with low energy (" << et << " MeV) .");
83 return StatusCode::SUCCESS;
84 }
85 }
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ executeTemp()

template<typename T>
StatusCode Ringer::CaloCornerRingsBuilder::executeTemp ( const T & input,
ElementLink< xAOD::CaloRingsContainer > & crEL )
private

Tool private methods:

unique execute method for integrating interface code.

Definition at line 88 of file CaloCornerRingsBuilder.cxx.

91 {
92
93 ATH_MSG_DEBUG("Entering executeTemp with input eta=" << input.eta()
94 << " phi=" << input.phi());
95
96 xAOD::CaloRings *clRings = new xAOD::CaloRings();
97 m_crCont->push_back(clRings);
98
99 clRingsLink.toContainedElement(*m_crCont, clRings);
100
102 {
103 m_lastValidSeed = AtlasGeoPoint(input.eta(), input.phi());
104 ATH_MSG_DEBUG("Using input as seed eta=" << input.eta()
105 << " phi=" << input.phi());
106 }
107
108 for (const xAOD::RingSetConf::RawConf &rawConf : m_rsRawConfCol)
109 {
110
111 xAOD::RingSet *rs = new xAOD::RingSet(rawConf.nRings);
112 m_rsCont->push_back(rs);
113
114 unsigned int nSubRings = rawConf.nRings / 5;
115
116 ATH_MSG_DEBUG("Creating RingSet with total rings=" << rawConf.nRings
117 << " subrings=" << nSubRings);
118
119 std::vector<AtlasGeoPoint> seeds;
120 seeds.reserve(5);
121
122 AtlasGeoPoint centralSeed;
123
124 CHECK(getRingSetSeed(rawConf, input, centralSeed));
125
126 ATH_MSG_DEBUG("Central seed eta=" << centralSeed.eta()
127 << " phi=" << centralSeed.phi());
128
129 seeds.push_back(centralSeed);
130
131 CHECK(getCornerRingsSeeds(rawConf, centralSeed, seeds));
132
133 for (size_t i = 0; i < seeds.size(); ++i)
134 {
135 const AtlasGeoPoint &seed = seeds[i];
136 const unsigned int offset = i * nSubRings;
137
138 CHECK(buildRingSet(rawConf, seed, rs, offset, nSubRings));
139 }
140
142 clRings->addRingSetEL(rsEL);
143 }
144
145 if (msgLevel() <= MSG::DEBUG)
146 {
147 std::ostringstream str;
148 clRings->print(str);
149 ATH_MSG_DEBUG(str.str());
150 }
151
152 return StatusCode::SUCCESS;
153 }
#define CHECK(...)
Evaluate an expression and check for errors.
float eta() const
float phi() const
StatusCode getCornerRingsSeeds(const xAOD::RingSetConf::RawConf &rawConf, const AtlasGeoPoint &centralSeed, std::vector< AtlasGeoPoint > &cornerSeeds)
Get the seeds for the corner rings (top-left, etc).
virtual StatusCode buildRingSet(const xAOD::RingSetConf::RawConf &rawConf, const AtlasGeoPoint &seed, xAOD::RingSet *rs, const unsigned int offset, const unsigned int nSubRings)
xAOD::RingSetConf::RawConfCollection m_rsRawConfCol
holds each RingSet configuration (filled at initialize)
StatusCode getRingSetSeed(const xAOD::RingSetConf::RawConf &conf, const xAOD::CaloCluster &cluster, AtlasGeoPoint &seed)
Fill RingSet seed for CaloCluster.
xAOD::RingSetContainer * m_rsCont
Tool props (non configurables):
xAOD::CaloRingsContainer * m_crCont
Create and hold CaloRingsContainer for each event.
AtlasGeoPoint m_lastValidSeed
last valid RingSet seed
Gaudi::Property< bool > m_useShowShapeBarycenter
Switch to use shower barycenter seed for each RingSets.
void print(std::ostream &stream) const
Print-out methods:
void addRingSetEL(const ElementLink< RingSetContainer_v1 > &rsEL)
Add ElementLink to holden vector.
RingSet_v1 RingSet
Definition of the current "RingSet version".
Definition RingSet.h:15
CaloRings_v1 CaloRings
Definition of the current "CaloRings version".

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ finalize()

StatusCode Ringer::CaloRingsBuilder::finalize ( )
overridevirtualinherited

finalize method

Implements Ringer::ICaloRingsBuilder.

Reimplemented in Ringer::CaloAsymRingsBuilder, and Ringer::CaloStripsRingsBuilder.

Definition at line 127 of file CaloRingsBuilder.cxx.

128 {
129 return StatusCode::SUCCESS;
130 }

◆ getCornerRingsSeeds()

StatusCode Ringer::CaloCornerRingsBuilder::getCornerRingsSeeds ( const xAOD::RingSetConf::RawConf & rawConf,
const AtlasGeoPoint & centralSeed,
std::vector< AtlasGeoPoint > & cornerSeeds )
protected

Get the seeds for the corner rings (top-left, etc).

Definition at line 155 of file CaloCornerRingsBuilder.cxx.

159 {
160
161 const float deltaEta = m_cornerShift * rawConf.etaWidth;
162 const float deltaPhi = m_cornerShift * rawConf.phiWidth;
163
164 ATH_MSG_DEBUG("Corner seed shifts: deltaEta=" << deltaEta
165 << " deltaPhi=" << deltaPhi);
166
167 AtlasGeoPoint top_right, top_left, bottom_right, bottom_left;
168
169 top_right.setEta(seed.eta() + deltaEta);
170 top_right.setPhi(seed.phi() + deltaPhi);
171
172 top_left.setEta(seed.eta() + deltaEta);
173 top_left.setPhi(seed.phi() - deltaPhi);
174
175 bottom_right.setEta(seed.eta() - deltaEta);
176 bottom_right.setPhi(seed.phi() + deltaPhi);
177
178 bottom_left.setEta(seed.eta() - deltaEta);
179 bottom_left.setPhi(seed.phi() - deltaPhi);
180
181 ATH_MSG_DEBUG("Corner seeds:");
182 ATH_MSG_DEBUG("top_right eta=" << top_right.eta() << " phi=" << top_right.phi());
183 ATH_MSG_DEBUG("top_left eta=" << top_left.eta() << " phi=" << top_left.phi());
184 ATH_MSG_DEBUG("bottom_right eta=" << bottom_right.eta() << " phi=" << bottom_right.phi());
185 ATH_MSG_DEBUG("bottom_left eta=" << bottom_left.eta() << " phi=" << bottom_left.phi());
186
187 cornerSeeds.push_back(top_right);
188 cornerSeeds.push_back(top_left);
189 cornerSeeds.push_back(bottom_left);
190 cornerSeeds.push_back(bottom_right);
191
192 return StatusCode::SUCCESS;
193 }
void setEta(const float eta)
void setPhi(const float phi)
Gaudi::Property< int > m_cornerShift
Number of cells to shift for corner seeds (top-left, etc).

◆ getRingSetSeed() [1/2]

StatusCode Ringer::CaloRingsBuilder::getRingSetSeed ( const xAOD::RingSetConf::RawConf & ,
const xAOD::IParticle & part,
AtlasGeoPoint & seed )
staticprotectedinherited

Fill RingSet seed for IParticle.

Definition at line 303 of file CaloRingsBuilder.cxx.

307 {
308
309 seed.setEta(part.eta());
310 seed.setPhi(part.phi());
311
312 return StatusCode::SUCCESS;
313 }

◆ getRingSetSeed() [2/2]

StatusCode Ringer::CaloRingsBuilder::getRingSetSeed ( const xAOD::RingSetConf::RawConf & conf,
const xAOD::CaloCluster & cluster,
AtlasGeoPoint & seed )
protectedinherited

Fill RingSet seed for CaloCluster.

Definition at line 256 of file CaloRingsBuilder.cxx.

260 {
262 {
263
264 seed.setEta(cluster.eta());
265 seed.setPhi(cluster.phi());
266
267 return StatusCode::SUCCESS;
268 }
269 else
270 {
271
272 bool foundValid = false, foundMultipleValid = false;
273
274 for (const auto layer : rawConf.layers)
275 {
276
277 AtlasGeoPoint seedCandidate(
278 cluster.etaSample(layer),
279 cluster.phiSample(layer));
280
281 ATH_MSG_DEBUG("This layer (" << CaloSampling::getSamplingName(layer) << ") seedCandidate is: (" << seedCandidate.eta() << "," << seedCandidate.phi() << ")");
282
283 if (seedCandidate.isValid())
284 {
285 m_lastValidSeed = seedCandidate;
286 if (foundValid)
287 foundMultipleValid = true;
288 foundValid = true;
289 }
290 }
291
292 // If we get here, set it to the last valid seed:
294 if (foundMultipleValid)
295 {
296 ATH_MSG_WARNING("Found multiple valid seeds. Set to last valid candidate.");
297 }
298 return StatusCode::SUCCESS;
299 }
300 }
#define ATH_MSG_WARNING(x)
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
const xAOD::RingSetConf::RawConfCollection & rawConf() override
Extra methods:
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.

◆ initialize()

StatusCode Ringer::CaloRingsBuilder::initialize ( )
overridevirtualinherited

Tool main methods:

initialize method

Implements Ringer::ICaloRingsBuilder.

Reimplemented in Ringer::CaloAsymRingsBuilder, and Ringer::CaloStripsRingsBuilder.

Definition at line 56 of file CaloRingsBuilder.cxx.

57 {
58 ATH_MSG_DEBUG("Initializing " << name());
59
60 m_nRingSets = m_nRings.size();
61
62 // Build RingSets configuration:
63 size_t offset = 0;
64
65 // Build RingSets configuration:
66 for (size_t rsConfIdx = 0; rsConfIdx < m_nRingSets; ++rsConfIdx)
67 {
68 const auto rsNLayers = m_nLayers[rsConfIdx];
69
70 std::vector<CaloSampling::CaloSample> rsLayers;
71 rsLayers.reserve(rsNLayers);
72
73 for (unsigned int s : std::span(m_layers.value().data() + offset, rsNLayers))
74 {
75 rsLayers.push_back(static_cast<CaloSampling::CaloSample>(s));
76 }
77
78 offset += rsNLayers;
79
80 const auto rawConf = xAOD::RingSetConf::RawConf(
81 m_nRings[rsConfIdx],
82 rsLayers,
83 m_etaWidth[rsConfIdx], m_phiWidth[rsConfIdx],
87
88 // Build our raw configuration structure:
89 m_rsRawConfCol.push_back(std::move(rawConf));
90 }
91
92 // We have finished filling the main raw configuration properties, now we add
93 // it bounderies:
94 try
95 {
97 }
98 catch (const std::runtime_error &e)
99 {
100 ATH_MSG_ERROR("Could not add collection bounderies due to: " << e.what());
101 ATH_MSG_ERROR("RawConfCollection is: ");
102 std::ostringstream str;
104 ATH_MSG_ERROR(str.str());
105 return StatusCode::FAILURE;
106 }
107
108 // Print our collection
109 if (msgLevel() <= MSG::DEBUG)
110 {
111 std::ostringstream str;
113 ATH_MSG_DEBUG(str.str());
114 }
115
116 // This will check that the properties were initialized properly
117 // by job configuration.
118 ATH_CHECK(m_crContName.initialize());
119 ATH_CHECK(m_rsContName.initialize());
120 ATH_CHECK(m_cellsContName.initialize());
121 ATH_CHECK(m_caloMgrKey.initialize());
122
123 return StatusCode::SUCCESS;
124 }
#define ATH_MSG_ERROR(x)
SG::WriteHandleKey< xAOD::RingSetContainer > m_rsContName
Name of RingSetContainer on Event StoreGate.
size_t m_nRingSets
hold the number of RingSets we are building for each CaloRings
Gaudi::Property< std::vector< float > > m_etaWidth
Width of the ring in eta.
Gaudi::Property< std::vector< unsigned int > > m_nLayers
Number of calorimeter layers in each ringset.
Gaudi::Property< std::vector< float > > m_phiWidth
Width of the ring in phi.
Gaudi::Property< std::vector< unsigned int > > m_nRings
Number of rings in a ringset.
Gaudi::Property< std::vector< int > > m_layers
Calorimeter layers in each ringset.
static Ringer::CalJointLayer whichLayer(const std::vector< CaloSampling::CaloSample > &layers)
static void print(const RawConf &raw, std::ostream &stream)
Prints rawConf.
static Ringer::CalJointSection whichSection(const std::vector< CaloSampling::CaloSample > &layers)
static void addRawConfColBounderies(RawConfCollection &clRingsConf)
Add to RawConfCollection its JointLayer/JointSection bounderies.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ interfaceID()

const InterfaceID & ICaloRingsBuilder::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 83 of file ICaloRingsBuilder.h.

84{
86}
static const InterfaceID IID_ICaloRingsBuilder("ICaloRingsBuilder", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ nRingSets()

std::size_t Ringer::CaloRingsBuilder::nRingSets ( ) const
inlineoverridevirtualinherited

Implements Ringer::ICaloRingsBuilder.

Definition at line 107 of file CaloRingsBuilder.h.

107{ return m_nRingSets; }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ preExecute()

StatusCode Ringer::CaloRingsBuilder::preExecute ( xAOD::CaloRingsContainer * crCont,
xAOD::RingSetContainer * rsCont,
const std::size_t nReserve = 0 )
overridevirtualinherited

method for working on containers

Implements Ringer::ICaloRingsBuilder.

Definition at line 133 of file CaloRingsBuilder.cxx.

134 {
135 if (crCont && rsCont)
136 {
137 m_crCont = crCont;
138 m_rsCont = rsCont;
139 }
140 else
141 {
142 ATH_MSG_ERROR("Attempted to set CaloRingsContainer and/or RingSetContainer to invalid pointers");
143 return StatusCode::FAILURE;
144 }
145 // Reserve container space if required:
146 if (nReserve)
147 {
148 // Reserve one CaloRings per particle
149 m_crCont->reserve(nReserve);
150 // We need to reserve more space for the RingSet container, there will be
151 // the number of RawConfig available in our raw configuration collection.
152 m_rsCont->reserve(nReserve * m_nRingSets);
153 }
154
155 return StatusCode::SUCCESS;
156 }

◆ rawConf()

const xAOD::RingSetConf::RawConfCollection & Ringer::CaloRingsBuilder::rawConf ( )
inlineoverridevirtualinherited

Extra methods:

Retrieve RawConfiguration Collection

Implements Ringer::ICaloRingsBuilder.

Definition at line 94 of file CaloRingsBuilder.h.

95 {
96 return m_rsRawConfCol;
97 };

◆ 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< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ rsContName()

const SG::WriteHandleKey< xAOD::RingSetContainer > & Ringer::CaloRingsBuilder::rsContName ( ) const
inlineoverridevirtualinherited

Implements Ringer::ICaloRingsBuilder.

Definition at line 110 of file CaloRingsBuilder.h.

110{ return m_rsContName; }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ useShowerShapeBarycenter()

bool Ringer::CaloRingsBuilder::useShowerShapeBarycenter ( )
inlineoverridevirtualinherited

Retrieve whether it was set used shower shape barycenter.

Implements Ringer::ICaloRingsBuilder.

Definition at line 101 of file CaloRingsBuilder.h.

102 {
104 };

Member Data Documentation

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> Ringer::CaloRingsBuilder::m_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager"}
protectedinherited

Definition at line 258 of file CaloRingsBuilder.h.

258{this, "CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_cellMaxDEtaDist

Gaudi::Property<float> Ringer::CaloRingsBuilder::m_cellMaxDEtaDist
protectedinherited
Initial value:
{
this,
"CellMaxDEtaDist", 0,
"Maximum cell distance to the seed in eta."}

Maximum cell distance in eta to seed.

Definition at line 187 of file CaloRingsBuilder.h.

187 {
188 this,
189 "CellMaxDEtaDist", 0,
190 "Maximum cell distance to the seed in eta."};

◆ m_cellMaxDPhiDist

Gaudi::Property<float> Ringer::CaloRingsBuilder::m_cellMaxDPhiDist
protectedinherited
Initial value:
{
this,
"CellMaxDPhiDist", 0,
"Maximum cell distance to the seed in phi."}

Maximum cell distance in phi to seed.

Definition at line 194 of file CaloRingsBuilder.h.

194 {
195 this,
196 "CellMaxDPhiDist", 0,
197 "Maximum cell distance to the seed in phi."};

◆ m_cellsContName

SG::ReadHandleKey<CaloCellContainer> Ringer::CaloRingsBuilder::m_cellsContName
protectedinherited
Initial value:
{
this,
"CellsContainerName",
"AllCalo",
"Key to obtain the cell container"}

Name of CaloCellContainer.

Definition at line 162 of file CaloRingsBuilder.h.

162 {
163 this,
164 "CellsContainerName",
165 "AllCalo",
166 "Key to obtain the cell container"};

◆ m_cornerShift

Gaudi::Property<int> Ringer::CaloCornerRingsBuilder::m_cornerShift
protected
Initial value:
{
this,
"CornerShift",
3,
"Number of cells to shift for corner seeds (top-left, etc)"}

Number of cells to shift for corner seeds (top-left, etc).

Definition at line 72 of file CaloCornerRingsBuilder.h.

72 {
73 this,
74 "CornerShift",
75 3,
76 "Number of cells to shift for corner seeds (top-left, etc)"};

◆ m_crCont

xAOD::CaloRingsContainer* Ringer::CaloRingsBuilder::m_crCont
protectedinherited

Create and hold CaloRingsContainer for each event.

Definition at line 271 of file CaloRingsBuilder.h.

◆ m_crContName

SG::WriteHandleKey<xAOD::CaloRingsContainer> Ringer::CaloRingsBuilder::m_crContName
protectedinherited
Initial value:
{
this,
"CaloRingsContainerName",
"CaloRings",
"Name of the CaloRings container"}

Tool props (python configurables):

Name of CaloRingsContainer on Event StoreGate

electron collection input name

Definition at line 144 of file CaloRingsBuilder.h.

144 {
145 this,
146 "CaloRingsContainerName",
147 "CaloRings",
148 "Name of the CaloRings container"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doTransverseEnergy

Gaudi::Property<bool> Ringer::CaloRingsBuilder::m_doTransverseEnergy
protectedinherited
Initial value:
{
this,
"doTransverseEnergy", false,
"Switch to use raw cell energy, "
"instead of cells ET."}

Switch to use raw cell energy instead ET.

Definition at line 252 of file CaloRingsBuilder.h.

252 {
253 this,
254 "doTransverseEnergy", false,
255 "Switch to use raw cell energy, "
256 "instead of cells ET."};

◆ m_etaWidth

Gaudi::Property<std::vector<float> > Ringer::CaloRingsBuilder::m_etaWidth
protectedinherited
Initial value:
{
this,
"EtaWidth",
{},
"Each RingSet ring eta width."}

Width of the ring in eta.

Definition at line 171 of file CaloRingsBuilder.h.

171 {
172 this,
173 "EtaWidth",
174 {},
175 "Each RingSet ring eta width."};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_lastValidSeed

AtlasGeoPoint Ringer::CaloRingsBuilder::m_lastValidSeed
protectedinherited

last valid RingSet seed

Propagate other layer centroids in case a layer centroid is not valid.

Definition at line 281 of file CaloRingsBuilder.h.

◆ m_layers

Gaudi::Property<std::vector<int > > Ringer::CaloRingsBuilder::m_layers
protectedinherited
Initial value:
{
this,
"Layers",
{},
"Concatenated list of layers which will be used "
"to build the RingSets"}

Calorimeter layers in each ringset.

This property should be read as: std::vector<CaloSampling::CaloSample> m_layersRings;

Definition at line 222 of file CaloRingsBuilder.h.

222 {
223 this,
224 "Layers",
225 {},
226 "Concatenated list of layers which will be used "
227 "to build the RingSets"};

◆ m_minEnergy

Gaudi::Property<float> Ringer::CaloRingsBuilder::m_minEnergy
protectedinherited
Initial value:
{
this,
"MinPartEnergy", std::numeric_limits<float>::lowest(),
"Minimum particle/cluster energy to build rings (GeV)."}

Minimum particle energy to build rings (GeV).

Definition at line 209 of file CaloRingsBuilder.h.

209 {
210 this,
211 "MinPartEnergy", std::numeric_limits<float>::lowest(),
212 "Minimum particle/cluster energy to build rings (GeV)."};

◆ m_nLayers

Gaudi::Property<std::vector<unsigned int> > Ringer::CaloRingsBuilder::m_nLayers
protectedinherited
Initial value:
{
this,
"RingSetNLayers",
{},
"Each RingSet number of layers from the Layers "
"configurable property to use."}

Number of calorimeter layers in each ringset.

Definition at line 231 of file CaloRingsBuilder.h.

231 {
232 this,
233 "RingSetNLayers",
234 {},
235 "Each RingSet number of layers from the Layers "
236 "configurable property to use."};

◆ m_nRings

Gaudi::Property<std::vector<unsigned int> > Ringer::CaloRingsBuilder::m_nRings
protectedinherited
Initial value:
{
this,
"NRings",
{},
"Each RingSet number of rings."}

Number of rings in a ringset.

Definition at line 201 of file CaloRingsBuilder.h.

201 {
202 this,
203 "NRings",
204 {},
205 "Each RingSet number of rings."};

◆ m_nRingSets

size_t Ringer::CaloRingsBuilder::m_nRingSets
protectedinherited

hold the number of RingSets we are building for each CaloRings

Definition at line 289 of file CaloRingsBuilder.h.

◆ m_phiHelper

const CaloPhiRange Ringer::CaloRingsBuilder::m_phiHelper
staticprotectedinherited

used for phi wrap-around

Definition at line 285 of file CaloRingsBuilder.h.

◆ m_phiWidth

Gaudi::Property<std::vector<float> > Ringer::CaloRingsBuilder::m_phiWidth
protectedinherited
Initial value:
{
this,
"PhiWidth",
{},
"Each RingSet ring phi width."}

Width of the ring in phi.

Definition at line 179 of file CaloRingsBuilder.h.

179 {
180 this,
181 "PhiWidth",
182 {},
183 "Each RingSet ring phi width."};

◆ m_rsCont

xAOD::RingSetContainer* Ringer::CaloRingsBuilder::m_rsCont
protectedinherited

Tool props (non configurables):

Create and hold RingSetContainer for each event

Definition at line 267 of file CaloRingsBuilder.h.

◆ m_rsContName

SG::WriteHandleKey<xAOD::RingSetContainer> Ringer::CaloRingsBuilder::m_rsContName
protectedinherited
Initial value:
{
this,
"RingSetContainerName",
"RingSets",
"Name of the RingSets container"}

Name of RingSetContainer on Event StoreGate.

Definition at line 153 of file CaloRingsBuilder.h.

153 {
154 this,
155 "RingSetContainerName",
156 "RingSets",
157 "Name of the RingSets container"};

◆ m_rsRawConfCol

xAOD::RingSetConf::RawConfCollection Ringer::CaloRingsBuilder::m_rsRawConfCol
protectedinherited

holds each RingSet configuration (filled at initialize)

Definition at line 275 of file CaloRingsBuilder.h.

◆ m_useShowShapeBarycenter

Gaudi::Property<bool> Ringer::CaloRingsBuilder::m_useShowShapeBarycenter
protectedinherited
Initial value:
{
this,
"useShowerShapeBarycenter", false,
"Switch to use shower barycenter for each layer, "
"instead of the cluster center."}

Switch to use shower barycenter seed for each RingSets.

This can be set to false if using cluster information to use the cluster center instead of its layer energy baricenter.

Definition at line 243 of file CaloRingsBuilder.h.

243 {
244 this,
245 "useShowerShapeBarycenter", false,
246 "Switch to use shower barycenter for each layer, "
247 "instead of the cluster center."};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: