ATLAS Offline Software
Functions
CaloSuperCellUtils.h File Reference

This is a collection of helper functions for building Calo Super Cell detector manager, and for updating it with alignment corrections. The functions previously existed in two packages: CaloDetMgrDetDescrCnv (now obsolete) and CaloDetDescr. They have been moved over to the CaloDetDescrUtils so that now they can also be used by the CaloSuperCellAlignCondAlg. More...

#include "GaudiKernel/StatusCode.h"
#include "CxxUtils/checker_macros.h"
Include dependency graph for CaloSuperCellUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void createDescriptors (CaloSuperCellDetDescrManager *mgr)
 
void createElements (CaloSuperCellDetDescrManager *mgr)
 
StatusCode updateElements (CaloSuperCellDetDescrManager *mgr, const CaloDetDescrManager *cellmgr, const ICaloSuperCellIDTool *scidTool)
 
void updateDescriptors ATLAS_NOT_CONST_THREAD_SAFE (CaloSuperCellDetDescrManager *mgr, const CaloDetDescrManager *cellmgr, const ICaloSuperCellIDTool *scidTool)
 

Detailed Description

This is a collection of helper functions for building Calo Super Cell detector manager, and for updating it with alignment corrections. The functions previously existed in two packages: CaloDetMgrDetDescrCnv (now obsolete) and CaloDetDescr. They have been moved over to the CaloDetDescrUtils so that now they can also be used by the CaloSuperCellAlignCondAlg.

Definition in file CaloSuperCellUtils.h.

Function Documentation

◆ ATLAS_NOT_CONST_THREAD_SAFE()

void updateDescriptors ATLAS_NOT_CONST_THREAD_SAFE ( CaloSuperCellDetDescrManager mgr,
const CaloDetDescrManager cellmgr,
const ICaloSuperCellIDTool scidTool 
)

◆ createDescriptors()

void createDescriptors ( CaloSuperCellDetDescrManager mgr)

Definition at line 155 of file CaloSuperCellUtils.cxx.

156 {
157  const CaloCell_Base_ID* calo_helper = mgr->getCaloCell_ID();
158  for (Identifier reg_id : calo_helper->reg_range()) {
159  if (! calo_helper->is_tile (reg_id)) {
160  mgr->add (new CaloDetDescriptor (reg_id, nullptr, calo_helper));
161  }
162  else {
163  mgr->add_tile (new CaloDetDescriptor
164  (reg_id, calo_helper->tile_idHelper(), calo_helper,
165  (CaloCell_ID::CaloSample)calo_helper->calo_sample(reg_id), 0));
166  // NB. CaloDetDescrElement::getSampling adds the tile cell sampling
167  // index to the descriptor's sampling, so don't add 2 here
168  // to calo_sample.
169  mgr->add_tile (new CaloDetDescriptor
170  (reg_id, calo_helper->tile_idHelper(), calo_helper,
171  (CaloCell_ID::CaloSample)(calo_helper->calo_sample(reg_id)), 2));
172  }
173  }
174 }

◆ createElements()

void createElements ( CaloSuperCellDetDescrManager mgr)

Definition at line 176 of file CaloSuperCellUtils.cxx.

177 {
178  const CaloCell_Base_ID* calo_helper = mgr->getCaloCell_ID();
179  for (Identifier cell_id : calo_helper->cell_range()) {
180  int subCalo = -1;
181  IdentifierHash subCaloHash =
182  calo_helper->subcalo_cell_hash (cell_id, subCalo);
183 
184  const CaloDetDescriptor* desc = get_cell_descriptor (cell_id, mgr);
185  assert (desc);
186  mgr->add (new CaloSuperCellDetectorElement (subCaloHash, desc));
187  }
188 }

◆ updateElements()

StatusCode updateElements ( CaloSuperCellDetDescrManager mgr,
const CaloDetDescrManager cellmgr,
const ICaloSuperCellIDTool scidTool 
)

Definition at line 190 of file CaloSuperCellUtils.cxx.

193 {
194  // For each supercell, we make a list of the corresponding cells.
195  // Then we pass that list to the supercell's @c update method.
196 
197  for (CaloDetDescrElement* elt : mgr->element_range_nonconst()) {
198  if (!elt) continue;
200  dynamic_cast<CaloSuperCellDetectorElement*> (elt);
201  if (!selt) continue;
202 
203  std::vector<Identifier> ids =
204  scidTool->superCellToOfflineID (elt->identify());
205  assert (!ids.empty());
206 
207  const CaloCell_Base_ID* idhelper = mgr->getCaloCell_ID();
208  const CaloCell_Base_ID* cell_idhelper = cellmgr->getCaloCell_ID();
209 
210  std::vector<const CaloDetDescrElement*> fromelts;
211  fromelts.reserve (ids.size());
212  for (Identifier id : ids) {
213  // For tile tower sums, exclude D-layer cells
214  // (they have a different size).
215  if (cell_idhelper->sub_calo(id) == CaloCell_Base_ID::TILE &&
216  cell_idhelper->sample(id) == 2 &&
217  idhelper->sample(elt->identify()) != 2)
218  continue;
219  const CaloDetDescrElement* fromelt = cellmgr->get_element (id);
220  assert (fromelt != nullptr);
221  fromelts.push_back (fromelt);
222  }
223  if(selt->update(fromelts).isFailure()) {
224  return StatusCode::FAILURE;
225  }
226  }
227  return StatusCode::SUCCESS;
228 }
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
ICaloSuperCellIDTool::superCellToOfflineID
virtual std::vector< Identifier > superCellToOfflineID(const Identifier &id) const =0
Given a supercell identifier, return the list of corresponding offline cell identifiers.
CaloCell_Base_ID::calo_sample
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
Definition: CaloCell_Base_ID.cxx:141
CaloCell_Base_ID::is_tile
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
CaloCell_Base_ID::reg_range
id_range reg_range(void) const
Range over set of region Identifiers (LAr + Tiles)
CaloCondBlobAlgs_fillNoiseFromASCII.desc
desc
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:54
CaloCell_Base_ID::sample
int sample(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloCell_Base_ID::sub_calo
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
CaloCell_Base_ID::subcalo_cell_hash
IdentifierHash subcalo_cell_hash(const Identifier cellId, int &subCalo) const
create hash id from 'global' cell id
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
CaloCell_Base_ID::cell_range
id_range cell_range(void) const
Range over full set of Identifiers (LAr + Tiles)
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
CaloSuperCellDetectorElement
Element to represent a SuperCell.
Definition: CaloDetectorElements.h:423
CaloSuperCellDetectorElement::update
StatusCode update(const std::vector< const CaloDetDescrElement * > &fromelts)
Update this element's geometry from the given list of offline elements.
Definition: CaloDetectorElements.cxx:613
CaloDetDescriptor
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
Definition: CaloDetDescriptor.h:58
CaloDetDescrManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:1590
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:41
CaloCell_Base_ID::tile_idHelper
const Tile_Base_ID * tile_idHelper() const
access to Tile idHelper
Definition: CaloCell_Base_ID.h:355
Identifier
Definition: IdentifierFieldParser.cxx:14