ATLAS Offline Software
Functions
CaloSuperCellUtils.cxx File Reference
#include "CaloDetDescrUtils/CaloSuperCellUtils.h"
#include "CaloIdentifier/CaloCell_ID.h"
#include "CaloIdentifier/CaloCell_SuperCell_ID.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
#include "CaloDetDescr/CaloDetDescriptor.h"
#include "CaloDetDescr/CaloDetDescrElement.h"
#include "CaloDetDescr/CaloDetectorElements.h"
#include "CaloDetDescr/ICaloSuperCellIDTool.h"
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 }

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

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

◆ 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)
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
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
Definition: IdentifierHash.h:38
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