ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSuperCellUtils.cxx File Reference
Include dependency graph for CaloSuperCellUtils.cxx:

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 (CaloSuperCellDetDescrManager *mgr, const CaloDetDescrManager *cellmgr, const ICaloSuperCellIDTool *scidTool)

Function Documentation

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

◆ updateDescriptors()

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

Definition at line 230 of file CaloSuperCellUtils.cxx.

233{
234 size_t maxdesc = mgr->calo_descriptors_size() + mgr->tile_descriptors_size();
235 std::vector<DescrMinMax> descr_minmax (maxdesc);
236
237 // Loop over cells and record range limits for each descriptor.
238 for (const CaloDetDescrElement* elt : mgr->element_range()) {
239 if (!elt) continue;
240 CaloDetDescriptor* desc = const_cast<CaloDetDescriptor*>(elt->descriptor());
241 int ndx = descr_index (desc, mgr);
242 assert (ndx >= 0 && ndx < (int)descr_minmax.size());
243 DescrMinMax& mm = descr_minmax[ndx];
244
245 int dz_den = desc->is_lar_hec() ? 1 : 2;
246
247 mm.eta.add (std::abs(elt->eta_raw()), elt->deta()/2);
248 mm.phi.add (phi_for_descr (elt->phi_raw()), elt->dphi()/2);
249 mm.r.add (elt->r(), elt->dr()/2);
250 mm.z.add (std::abs(elt->z_raw()), elt->dz()/dz_den);
251 }
252
253 // Loop over each descriptor and update.
254 size_t i = 0;
255 for (CaloDetDescriptor* desc : mgr->calo_descriptors_range_nonconst()) {
256 updateDescriptor (desc, descr_minmax[i], cellmgr, scidTool);
257 ++i;
258 }
259 for (CaloDetDescriptor* desc : mgr->tile_descriptors_range_nonconst()) {
260 updateDescriptor (desc, descr_minmax[i], cellmgr, scidTool);
261 ++i;
262 }
263}
This class groups all DetDescr information related to a CaloCell.

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