ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CaloTowerBuilderTool Class Reference

#include <CaloTowerBuilderTool.h>

Inheritance diagram for CaloTowerBuilderTool:
Collaboration diagram for CaloTowerBuilderTool:

Public Member Functions

 CaloTowerBuilderTool (const CaloTowerBuilderTool &)=delete
 
CaloTowerBuilderTooloperator= (const CaloTowerBuilderTool &)=delete
 
 CaloTowerBuilderTool (const std::string &name, const std::string &type, const IInterface *parent)
 AlgTool constructor. More...
 
virtual ~CaloTowerBuilderTool ()
 
virtual StatusCode execute (const EventContext &ctx, CaloTowerContainer *theContainer, const CaloCellContainer *theCell=0, const CaloTowerSeg::SubSeg *subseg=0) const override
 Run tower building and add results to the tower container. More...
 
virtual StatusCode execute (const EventContext &ctx, CaloTowerContainer *theContainer) override
 Run tower building and add results to the tower container. More...
 
virtual void setCalos (const std::vector< CaloCell_ID::SUBCALO > &v)
 
virtual StatusCode initializeTool () override
 
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override
 common initialization More...
 
virtual void setTowerSeg (const CaloTowerSeg &theTowerSeg) override
 
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 sysInitialize () override
 Perform system initialization for an algorithm. 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
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

virtual std::vector< CaloCell_ID::SUBCALOparseCalos (const std::vector< std::string > &includedCalos) const
 Convert calorimeter strings to enums. More...
 
const CaloTowerSegtowerSeg () const
 Return the tower segmentation. More...
 
const CaloCellContainergetCells () const
 Retrieve cells from StoreGate. More...
 
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...
 

Protected Attributes

SG::ReadHandleKey< CaloCellContainerm_cellContainerName
 
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this,"CaloDetDescrManager","CaloDetDescrManager"}
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

virtual StatusCode checkSetup (MsgStream &log)
 
void iterateFull (CaloTowerContainer *towers, const ElementLink< CaloCellContainer > &cellsEL) const
 
void iterateSubSeg (CaloTowerContainer *towers, const ElementLink< CaloCellContainer > &cellsEL, const CaloTowerSeg::SubSeg *subseg) const
 
StatusCode rebuildLookup (const EventContext &ctx)
 Rebuild the cell lookup table. 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...
 

Static Private Member Functions

static void addTower (const CaloTowerStore::tower_iterator tower_it, const ElementLink< CaloCellContainer > &cellsEL, CaloTower *tower)
 

Private Attributes

std::vector< std::string > m_includedCalos
 
std::vector< CaloCell_ID::SUBCALOm_caloIndices
 
CaloTowerStore m_cellStore
 
std::mutex m_cellStoreMutex
 
std::atomic_bool m_cellStoreInit {false}
 
CaloTowerSeg m_theTowerSeg
 
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 33 of file CaloTowerBuilderTool.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

◆ CaloTowerBuilderTool() [1/2]

CaloTowerBuilderTool::CaloTowerBuilderTool ( const CaloTowerBuilderTool )
delete

◆ CaloTowerBuilderTool() [2/2]

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

AlgTool constructor.

Definition at line 28 of file CaloTowerBuilderTool.cxx.

32  // , m_errorCounter(0)
33 {
34  declareInterface<ICaloTowerBuilderToolBase>(this);
35  m_includedCalos.resize(4);
36  m_includedCalos[0] = "LAREM";
37  m_includedCalos[1] = "LARHEC";
38  m_includedCalos[2] = "LARFCAL";
39  m_includedCalos[3] = "TILE";
40  // common properties
41  declareProperty("IncludedCalos",m_includedCalos);
42 }

◆ ~CaloTowerBuilderTool()

CaloTowerBuilderTool::~CaloTowerBuilderTool ( )
virtualdefault

Member Function Documentation

◆ addTower()

void CaloTowerBuilderTool::addTower ( const CaloTowerStore::tower_iterator  tower_it,
const ElementLink< CaloCellContainer > &  cellsEL,
CaloTower tower 
)
inlinestaticprivate

Definition at line 64 of file CaloTowerBuilderTool.cxx.

67 {
68  CaloTowerStore::cell_iterator firstC = tower_it.firstCell();
69  CaloTowerStore::cell_iterator lastC = tower_it.lastCell();
70  int ts = tower_it.size();
71  double wsumE = tower->getBasicEnergy(); // this is not 0 since some towers already have cells from other calos.
72  const CaloCellContainer* cells = cellsEL.getDataPtr();
73  for (; firstC != lastC; ++firstC) {
74 
75  unsigned int ci = firstC.hash();
76  double weightC = firstC.weight();
77  int cndx = cells->findIndex(ci);
78  const CaloCell* cellPtr = nullptr;
79  if (cndx >= 0)
80  cellPtr = (*cells)[cndx];
81  // get weights
82  if (cellPtr) {
83  wsumE += weightC * cellPtr->e(); // Summ up weighted energies .
84  tower->addUniqueCellNoKine(cellsEL, cndx, weightC, ts); // add cells to tower.
85  }
86  /* for debugging em+hec
87  if (t==5214) std::cout<<"N14\tc:"<<ci<<"\tw:"<<weightC<<"\te:"<<cellPtr->e()<<"\teta:"<<cellPtr->eta()<<"\td:"<<cellPtr->caloDDE()<<std::endl;
88  if (t==5279) std::cout<<"N79\tc:"<<ci<<"\tw:"<<weightC<<"\te:"<<cellPtr->e()<<"\teta:"<<cellPtr->eta()<<"\td:"<<cellPtr->caloDDE()<<std::endl;
89  */
90 
91  }
92  tower->setE(wsumE); // update tower kinematics.
93 }

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode initialize CaloTowerBuilderToolBase::ATLAS_NOT_THREAD_SAFE ( )
overridevirtualinherited

common initialization

Implements ICaloTowerBuilderToolBase.

◆ checkSetup()

StatusCode CaloTowerBuilderTool::checkSetup ( MsgStream &  log)
privatevirtual

Definition at line 244 of file CaloTowerBuilderTool.cxx.

244  {
245  // any calos registered
246  if (m_caloIndices.empty()) {
247  ATH_MSG_ERROR("no match in requested calorimeter ranges ("
248  << m_includedCalos.size() << " requested)");
249  // print out requested keys
250  for (unsigned int iCalos = 0; iCalos < m_includedCalos.size(); iCalos++) {
251  if (iCalos == 0) {
252  msg(MSG::ERROR) << "requested key(s): " << m_includedCalos[iCalos];
253  } else if (iCalos == m_includedCalos.size() - 1) {
254  ATH_MSG_ERROR("," << m_includedCalos[iCalos] << " all not known!");
255  } else {
256  msg(MSG::ERROR) << "," << m_includedCalos[iCalos];
257  }
258  }
259  return StatusCode::FAILURE;
260  }
261  return StatusCode::SUCCESS;
262 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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() [1/2]

StatusCode CaloTowerBuilderTool::execute ( const EventContext &  ctx,
CaloTowerContainer theContainer 
)
overridevirtual

Run tower building and add results to the tower container.

Parameters
ctxThe current event context.
theContainerThe tower container to fill.

If the segmentation hasn't been set, take it from the tower container. This is for use by converters.

Implements CaloTowerBuilderToolBase.

Definition at line 227 of file CaloTowerBuilderTool.cxx.

229 {
230  if (m_cellStore.size() == 0) {
231  setTowerSeg (theContainer->towerseg());
232  ATH_CHECK( rebuildLookup(ctx) );
233  }
234 
235  return execute (ctx, theContainer, nullptr, nullptr);
236 }

◆ execute() [2/2]

StatusCode CaloTowerBuilderTool::execute ( const EventContext &  ctx,
CaloTowerContainer theTowers,
const CaloCellContainer theCells = 0,
const CaloTowerSeg::SubSeg subseg = 0 
) const
overridevirtual

Run tower building and add results to the tower container.

If a cell container is provided, use that; otherwise, fetch from SG (the key is given by a job property). If subseg is provided, then we do the building only within the rectangular region that it describes. The segmentation of the tower container must match the region over which we're running the tower building.

Parameters
ctxThe current event context.
theContainerThe tower container to fill.
theCellThe cell container to read. If null, we fetch from SG.
subsegIf provided, run tower building only within this window. The tower container segmentation must match.

Implements CaloTowerBuilderToolBase.

Definition at line 165 of file CaloTowerBuilderTool.cxx.

169 {
170 
171 
172  //Init internal structure m_cellStore on first invocation
173  //Alignment updates are not taken into account!
174  if (!m_cellStoreInit.load()) {
175  //Aquire mutex before writing to m_cellStore
176  std::scoped_lock guard(m_cellStoreMutex);
177  //cast alway const-ness, acceptable since this is protected by a mutex
178  CaloTowerBuilderTool* thisNC ATLAS_THREAD_SAFE = const_cast<CaloTowerBuilderTool*>(this);
179  ATH_CHECK( thisNC->rebuildLookup(ctx) );
180  m_cellStoreInit.store(true);
181  }
182 
183  // CaloCellContainer
184  if (!theCells) {
185  theCells = getCells();
186  if (!theCells) {
187  return StatusCode::SUCCESS;
188  }
189  }
190 
191  const ElementLink<CaloCellContainer> cellsEL (*theCells, 0, ctx);
192  if (subseg)
193  iterateSubSeg (theTowers, cellsEL, subseg);
194  else
195  iterateFull (theTowers, cellsEL);
196 
197  for (unsigned int i = 0; i < m_caloIndices.size(); i++) {
198  theTowers->setCalo(m_caloIndices[i]);
199  }
200 
201  ATH_MSG_DEBUG("Number of Towers in CaloTowerContainer: "<< theTowers->size());
202 
203  /* for debug purposes
204  double summ=0;
205  std::cout << " Number of Towers in CaloTowerContainer: "<< theTowers->size() << std::endl;
206  for ( unsigned int t=0; t<theTowers->size(); ++t ) { // TOWER Loop
207  CaloTower* aTower = theTowers->getTower(t); // get tower
208  double E=aTower->getBasicEnergy();
209  summ+=E;
210  std::cout<<"Tower: "<<t<<"\te:"<<E<<std::endl;
211  }
212  std::cout<<"================ SUMM\t"<<summ<<std::endl;
213  */
214 
215  return StatusCode::SUCCESS;
216 }

◆ 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

◆ getCells()

const CaloCellContainer * CaloTowerBuilderToolBase::getCells ( ) const
protectedinherited

Retrieve cells from StoreGate.

Definition at line 59 of file CaloTowerBuilderToolBase.cxx.

60 {
61  const CaloCellContainer* cells = nullptr;
62  if (!m_cellContainerName.key().empty()) {
64  if (!cells) {
65  ATH_MSG_WARNING("no CaloCellContainer with key <"
66  << m_cellContainerName.key() << "> found, skip tool!");
67 
68  }
69  }
70  return cells;
71 }

◆ initializeTool()

StatusCode CaloTowerBuilderTool::initializeTool ( )
overridevirtual

Implements CaloTowerBuilderToolBase.

Definition at line 52 of file CaloTowerBuilderTool.cxx.

52  {
54  return this->checkSetup(msg());
55 }

◆ 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()

static const InterfaceID& ICaloTowerBuilderToolBase::interfaceID ( )
inlinestaticinherited

Definition at line 71 of file ICaloTowerBuilderToolBase.h.

71  {
72  static const InterfaceID IID("ICaloTowerBuilderToolBase", 1 , 0);
73  return IID;
74  }

◆ iterateFull()

void CaloTowerBuilderTool::iterateFull ( CaloTowerContainer towers,
const ElementLink< CaloCellContainer > &  cellsEL 
) const
inlineprivate

Definition at line 98 of file CaloTowerBuilderTool.cxx.

100 {
101  size_t sz = towers->size();
102  assert(m_cellStore.size() == sz);
104 
105  for (unsigned int t = 0; t < sz; ++t, ++tower_it) {
106  CaloTower* aTower = towers->getTower(t);
107  addTower (tower_it, cellsEL, aTower);
108  }
109 }

◆ iterateSubSeg()

void CaloTowerBuilderTool::iterateSubSeg ( CaloTowerContainer towers,
const ElementLink< CaloCellContainer > &  cellsEL,
const CaloTowerSeg::SubSeg subseg 
) const
inlineprivate

Definition at line 114 of file CaloTowerBuilderTool.cxx.

117 {
118  size_t sz = towers->size();
119  assert(subseg->size() == sz);
121 
122 #if 0
123  for (unsigned int t = 0; t < sz; ++t, ++tower_it) {
124  CaloTower* aTower = towers->getTower(tower_it.itower());
125  addTower (tower_it, cellsEL, aTower);
126  }
127 #endif
128  // This loop was originally written as above. However, if we increment
129  // tower_it at the end of the iteration, then it will end up doing
130  // an out-of-bounds read (in tower_iterator::operator+=).
131  // Best to just avoid incrementing it if we don't need to;
132  // that also saves a bit of useless work.
133  unsigned int t = 0;
134  while (true) {
135  CaloTower* aTower = towers->getTower(tower_it.itower());
136  addTower (tower_it, cellsEL, aTower);
137  ++t;
138  if (t >= sz) break;
139  ++tower_it;
140  }
141 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::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< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

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

◆ operator=()

CaloTowerBuilderTool& CaloTowerBuilderTool::operator= ( const CaloTowerBuilderTool )
delete

◆ 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.

◆ parseCalos()

std::vector< CaloCell_ID::SUBCALO > CaloTowerBuilderTool::parseCalos ( const std::vector< std::string > &  includedCalos) const
protectedvirtual

Convert calorimeter strings to enums.

Parameters
includedCalosProperty with calorimeter strings.

Reimplemented in LArTowerBuilderTool, and TileTowerBuilderTool.

Definition at line 282 of file CaloTowerBuilderTool.cxx.

284 {
285  // convert to enumerators
286  std::vector<CaloCell_ID::SUBCALO> indices;
287 
288  for (const std::string& s : includedCalos) {
289  if (s == "LAREM") {
290  indices.push_back(CaloCell_ID::LAREM);
291  } else if (s == "LARHEC") {
292  indices.push_back(CaloCell_ID::LARHEC);
293  } else if (s == "LARFCAL") {
294  indices.push_back(CaloCell_ID::LARFCAL);
295  } else if (s == "TILE") {
296  indices.push_back(CaloCell_ID::TILE);
297  }
298  }
299 
300  return indices;
301 }

◆ rebuildLookup()

StatusCode CaloTowerBuilderTool::rebuildLookup ( const EventContext &  ctx)
private

Rebuild the cell lookup table.

Definition at line 307 of file CaloTowerBuilderTool.cxx.

307  {
308  if (towerSeg().neta() != 0 && towerSeg().nphi() != 0) {
309  ATH_MSG_DEBUG("Building lookup table");
311  const CaloDetDescrManager* caloDDM=*caloMgrHandle;
312  if (m_cellStore.buildLookUp(*caloDDM, towerSeg(), m_caloIndices)) {
313  return StatusCode::SUCCESS;
314  }
315  }
316  return StatusCode::FAILURE;
317 }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ setCalos()

void CaloTowerBuilderTool::setCalos ( const std::vector< CaloCell_ID::SUBCALO > &  v)
virtual

Definition at line 264 of file CaloTowerBuilderTool.cxx.

265 {
266  if (m_caloIndices != v) {
267  if (m_cellStore.size() > 0) {
268  if (rebuildLookup(Gaudi::Hive::currentContext()).isFailure()) {
269  ATH_MSG_ERROR("rebuildLookup failed.");
270  }
271  }
272  m_caloIndices = v;
273  }
274 }

◆ setTowerSeg()

void CaloTowerBuilderToolBase::setTowerSeg ( const CaloTowerSeg theTowerSeg)
overridevirtualinherited

Implements ICaloTowerBuilderToolBase.

Definition at line 37 of file CaloTowerBuilderToolBase.cxx.

37  {
38 
39  ATH_MSG_DEBUG(" in CaloTowerBuilderToolBase::setTowerSeg ");
40  m_theTowerSeg = theTowerSeg;
41  ATH_MSG_DEBUG(" neta,nphi,etamin,etamax " << theTowerSeg.neta()
42  << " " << theTowerSeg.nphi() << " " << theTowerSeg.etamin()
43  << " " << theTowerSeg.etamax());
44 }

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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.

◆ towerSeg()

const CaloTowerSeg & CaloTowerBuilderToolBase::towerSeg ( ) const
protectedinherited

Return the tower segmentation.

Definition at line 50 of file CaloTowerBuilderToolBase.cxx.

51 {
52  return m_theTowerSeg;
53 }

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_caloIndices

std::vector<CaloCell_ID::SUBCALO> CaloTowerBuilderTool::m_caloIndices
private

Definition at line 104 of file CaloTowerBuilderTool.h.

◆ m_caloMgrKey

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

Definition at line 95 of file CaloTowerBuilderToolBase.h.

◆ m_cellContainerName

SG::ReadHandleKey<CaloCellContainer> CaloTowerBuilderToolBase::m_cellContainerName
protectedinherited

Definition at line 92 of file CaloTowerBuilderToolBase.h.

◆ m_cellStore

CaloTowerStore CaloTowerBuilderTool::m_cellStore
private

Definition at line 110 of file CaloTowerBuilderTool.h.

◆ m_cellStoreInit

std::atomic_bool CaloTowerBuilderTool::m_cellStoreInit {false}
mutableprivate

Definition at line 112 of file CaloTowerBuilderTool.h.

◆ m_cellStoreMutex

std::mutex CaloTowerBuilderTool::m_cellStoreMutex
mutableprivate

Definition at line 111 of file CaloTowerBuilderTool.h.

◆ 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_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_includedCalos

std::vector<std::string> CaloTowerBuilderTool::m_includedCalos
private

Definition at line 98 of file CaloTowerBuilderTool.h.

◆ m_theTowerSeg

CaloTowerSeg CaloTowerBuilderToolBase::m_theTowerSeg
privateinherited

Definition at line 99 of file CaloTowerBuilderToolBase.h.

◆ 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:
CaloTowerSeg::SubSegIterator
Iterator over a rectangular window of towers.
Definition: CaloTowerSeg.h:337
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
fitman.sz
sz
Definition: fitman.py:527
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
CaloTowerBuilderToolBase::m_theTowerSeg
CaloTowerSeg m_theTowerSeg
Definition: CaloTowerBuilderToolBase.h:99
CaloTowerStore::cell_iterator::hash
unsigned int hash()
Definition: CaloTowerStore.h:252
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
CaloTowerBuilderTool::parseCalos
virtual std::vector< CaloCell_ID::SUBCALO > parseCalos(const std::vector< std::string > &includedCalos) const
Convert calorimeter strings to enums.
Definition: CaloTowerBuilderTool.cxx:283
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition: CaloCell.h:317
CaloTowerSeg::neta
index_t neta() const
Retrieve number of bins.
Definition: CaloTowerSeg.h:423
CaloTowerBuilderToolBase::getCells
const CaloCellContainer * getCells() const
Retrieve cells from StoreGate.
Definition: CaloTowerBuilderToolBase.cxx:59
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
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
CaloEnergyCluster::addUniqueCellNoKine
void addUniqueCellNoKine(const CaloCellContainer *theContainer, index_type theIndex, double weight, size_t size_hint=0)
Add a cell (very fast)
Definition: CaloEnergyCluster.cxx:125
CaloTowerBuilderTool::m_cellStoreInit
std::atomic_bool m_cellStoreInit
Definition: CaloTowerBuilderTool.h:112
CaloTowerSeg::nphi
index_t nphi() const
Retrieve number of bins.
Definition: CaloTowerSeg.h:428
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
CaloTowerStore::tower_iterator::firstCell
cell_iterator firstCell() const
Definition: CaloTowerStore.h:301
CaloTowerStore::cell_iterator
Definition: CaloTowerStore.h:227
CaloTowerBuilderTool::rebuildLookup
StatusCode rebuildLookup(const EventContext &ctx)
Rebuild the cell lookup table.
Definition: CaloTowerBuilderTool.cxx:307
CaloTowerBuilderTool::addTower
static void addTower(const CaloTowerStore::tower_iterator tower_it, const ElementLink< CaloCellContainer > &cellsEL, CaloTower *tower)
Definition: CaloTowerBuilderTool.cxx:64
CaloTowerBuilderTool::checkSetup
virtual StatusCode checkSetup(MsgStream &log)
Definition: CaloTowerBuilderTool.cxx:244
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloTowerBuilderToolBase::towerSeg
const CaloTowerSeg & towerSeg() const
Return the tower segmentation.
Definition: CaloTowerBuilderToolBase.cxx:50
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloTowerSeg::SubSegIterator::itower
size_t itower() const
The tower index to which the iterator is referring.
Definition: CaloTowerSeg.h:710
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CaloTowerBuilderTool::execute
virtual StatusCode execute(const EventContext &ctx, CaloTowerContainer *theContainer, const CaloCellContainer *theCell=0, const CaloTowerSeg::SubSeg *subseg=0) const override
Run tower building and add results to the tower container.
Definition: CaloTowerBuilderTool.cxx:165
CaloTowerBuilderTool::m_cellStore
CaloTowerStore m_cellStore
Definition: CaloTowerBuilderTool.h:110
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
CaloTower
Data class for calorimeter cell towers.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloTower.h:55
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
CaloTowerStore::tower_iterator::lastCell
cell_iterator lastCell() const
Definition: CaloTowerStore.h:304
CaloTowerSeg::etamax
double etamax() const
Retrieve upper boundary value range.
Definition: CaloTowerSeg.h:448
CaloTowerContainer::towerseg
const CaloTowerSeg & towerseg() const
Return a copy of the attached CaloTowerSeg.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloTowerContainer.h:591
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
CaloTowerBuilderToolBase::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: CaloTowerBuilderToolBase.h:95
CaloTowerStore::tower_iterator
Definition: CaloTowerStore.h:292
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloTowerBuilderTool::iterateSubSeg
void iterateSubSeg(CaloTowerContainer *towers, const ElementLink< CaloCellContainer > &cellsEL, const CaloTowerSeg::SubSeg *subseg) const
Definition: CaloTowerBuilderTool.cxx:114
CaloTowerSeg::etamin
double etamin() const
Retrieve lower boundary value range.
Definition: CaloTowerSeg.h:443
python.PyAthena.v
v
Definition: PyAthena.py:157
CaloTowerBuilderTool::m_cellStoreMutex
std::mutex m_cellStoreMutex
Definition: CaloTowerBuilderTool.h:111
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
RunTileMonitoring.towers
towers
Definition: RunTileMonitoring.py:133
CaloTowerBuilderTool::m_includedCalos
std::vector< std::string > m_includedCalos
Definition: CaloTowerBuilderTool.h:98
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloTowerBuilderToolBase::m_cellContainerName
SG::ReadHandleKey< CaloCellContainer > m_cellContainerName
Definition: CaloTowerBuilderToolBase.h:92
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
P4EEtaPhiM::setE
virtual void setE(double theE)
set energy data member
Definition: P4EEtaPhiM.h:114
CaloTowerStore::towers
tower_iterator towers() const
Definition: CaloTowerStore.h:329
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
CaloTowerBuilderToolBase::CaloTowerBuilderToolBase
CaloTowerBuilderToolBase(const std::string &name, const std::string &type, const IInterface *parent)
AlgTool constructor.
Definition: CaloTowerBuilderToolBase.cxx:14
CaloTowerSeg::SubSeg::size
size_t size() const
The number of towers in this window.
Definition: CaloTowerSeg.h:591
CaloTowerStore::size
size_t size() const
Definition: CaloTowerStore.h:354
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
CaloTowerBuilderTool::iterateFull
void iterateFull(CaloTowerContainer *towers, const ElementLink< CaloCellContainer > &cellsEL) const
Definition: CaloTowerBuilderTool.cxx:98
python.CaloScaleNoiseConfig.ts
ts
Definition: CaloScaleNoiseConfig.py:86
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
SG::get
const T * get(const ReadHandleKey< T > &key)
Convenience function to retrieve an object given a ReadHandleKey.
CaloTowerStore::buildLookUp
bool buildLookUp(const CaloDetDescrManager &theManager, const CaloTowerSeg &theTowerSeg, const std::vector< CaloCell_ID::SUBCALO > &theCalos)
setup trigger
Definition: CaloTowerStore.cxx:74
CaloTowerBuilderTool
Definition: CaloTowerBuilderTool.h:34
CaloTowerContainer::setCalo
void setCalo(const CaloCell_ID::SUBCALO &nCalo)
Adds a calorimeter index to the tower.
Definition: CaloTowerContainer.cxx:169
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
CaloTowerStore::tower_iterator::size
size_t size() const
Definition: CaloTowerStore.h:306
CaloTowerBuilderTool::m_caloIndices
std::vector< CaloCell_ID::SUBCALO > m_caloIndices
Definition: CaloTowerBuilderTool.h:104
CaloTowerBuilderToolBase::setTowerSeg
virtual void setTowerSeg(const CaloTowerSeg &theTowerSeg) override
Definition: CaloTowerBuilderToolBase.cxx:37
fitman.k
k
Definition: fitman.py:528
CaloTowerStore::cell_iterator::weight
double weight() const
Definition: CaloTowerStore.h:261
CaloTower::getBasicEnergy
virtual double getBasicEnergy() const override
Basic signal getter.
Definition: CaloTower.cxx:51