ATLAS Offline Software
Loading...
Searching...
No Matches
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. 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}
Helper base class for offline cell identifiers.
const Tile_Base_ID * tile_idHelper() const
access to Tile idHelper
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
id_range reg_range() const
Range over set of region Identifiers (LAr + Tiles)
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...

◆ 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}
id_range cell_range() const
Range over full set of Identifiers (LAr + Tiles)
IdentifierHash subcalo_cell_hash(const Identifier cellId, int &subCalo) const
create hash id from 'global' cell id
Element to represent a SuperCell.
This is a "hash" representation of an Identifier.

◆ 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}
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
int sample(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
StatusCode update(const std::vector< const CaloDetDescrElement * > &fromelts)
Update this element's geometry from the given list of offline elements.
virtual std::vector< Identifier > superCellToOfflineID(const Identifier &id) const =0
Given a supercell identifier, return the list of corresponding offline cell identifiers.