ATLAS Offline Software
Loading...
Searching...
No Matches
CaloDetDescrBuilder.h File Reference
#include <memory>
Include dependency graph for CaloDetDescrBuilder.h:

Go to the source code of this file.

Namespaces

namespace  CaloRec
 Namespace for helper functions.

Functions

std::unique_ptr< CaloDetDescrManagerbuildCaloDetDescr (ISvcLocator *svcLocator, IMessageSvc *msgSvc, const GeoAlignmentStore *geoAlignStore, const CaloRec::CaloCellPositionShift *cellPosShift)
std::unique_ptr< CaloDetDescrManagerbuildCaloDetDescrNoAlign (ISvcLocator *svcLocator, IMessageSvc *msgSvc)

Function Documentation

◆ buildCaloDetDescr()

std::unique_ptr< CaloDetDescrManager > buildCaloDetDescr ( ISvcLocator * svcLocator,
IMessageSvc * msgSvc,
const GeoAlignmentStore * geoAlignStore,
const CaloRec::CaloCellPositionShift * cellPosShift )

Definition at line 46 of file CaloDetDescrBuilder.cxx.

50{
51 MsgStream log(msgSvc, "buildCaloDetDescr");
52
53 // --- --- Get CaloCell_ID and CaloIdManager helpers --- ---
54 SmartIF<StoreGateSvc> detStore{svcLocator->service("DetectorStore")};
55 if(!detStore)
56 throw std::runtime_error("buildCaloDetDescr failed to acquire a pointer to DetectorStore");
57
58 const CaloCell_ID* cell_id{nullptr};
59 if(detStore->retrieve(cell_id, "CaloCell_ID")!=StatusCode::SUCCESS)
60 throw std::runtime_error("buildCaloDetDescr failed to acquire a pointer to CaloCell_ID helper");
61 log << MSG::DEBUG << "Found the CaloCell_ID helper. " << endmsg;
62
63 const CaloIdManager* caloId_mgr{nullptr};
64 if(detStore->retrieve(caloId_mgr, "CaloIdManager")!=StatusCode::SUCCESS)
65 throw std::runtime_error("buildCaloDetDescr failed to acquire a pointer to CaloIdManager helper");
66 log << MSG::DEBUG << "Found the CaloIdManager helper. " << endmsg;
67 // --- --- Get CaloCell_ID and CaloIdManager helpers --- ---
68
69 // --- --- Create CaloDetDescrManager object --- ---
70 std::unique_ptr<CaloDetDescrManager> caloMgr = std::make_unique<CaloDetDescrManager>();
71
72 // set helpers
73 caloMgr->set_helper(cell_id);
74 caloMgr->set_helper(caloId_mgr);
75
76 caloMgr->initialize();
77 // --- --- Create CaloDetDescrManager object --- ---
78
79 // Cell volumes
80 CaloCellVolumes cellVol(svcLocator, cell_id);
81
82 // geometry layout
83 caloMgr->set_lar_geometry(cellVol.layout());
84
85 const LArEM_ID* em_id = caloId_mgr->getEM_ID();
86 const LArHEC_ID* hec_id = caloId_mgr->getHEC_ID();
87 const LArFCAL_ID* fcal_id = caloId_mgr->getFCAL_ID();
88
89 // Check whether we are working with Test Beam geometry
90 bool isTestBeam = false;
91 const LArDetectorManager* larMgr{nullptr};
92 StatusCode status = detStore->retrieve(larMgr);
93 if(status.isFailure()) {
94 log << MSG::WARNING << "Could not get LArDetectorManager. Assuming TestBeam=false" << endmsg;
95 }
96 else {
97 isTestBeam = larMgr->isTestBeam();
98 }
99
100 // Get minimal value for Hash ID - needed to retrieve sagging information
101 IdentifierHash minHash,maxHash;
102 cell_id->calo_cell_hash_range(CaloCell_ID::LAREM,minHash,maxHash);
103
104 // Two objects needed to pass sagging info to updateAlignment() methods
105 CaloElementPositionShift elementPosShift;
107
108 // ****************************************************************
109 // ** --- --- EMB --- --- **
110 // ****************************************************************
111
112 // --- Retrieve EMB Detector Manager
113 const EMBDetectorManager* embManager{nullptr};
114 status = detStore->retrieve(embManager);
115 if(status.isFailure()) {
116 log << MSG::WARNING << "Could not get the EMBDetectorManager. No Calo Elements will be built for EMB" << endmsg;
117 }
118 else {
119 // --- --- Iterate over EMB regions and cells --- ---
121
122 for (embregIt=embManager->beginDetectorRegion(); embregIt!=embManager->endDetectorRegion(); ++embregIt) {
123 const EMBDetectorRegion *embRegion = *embregIt;
124
125 // _________ Create descriptor for this region _________
126
127 // Build region identifier.
128 // Do some mapping between LArReadoutGeometry and CaloID
129 int barrel_ec = 0;
130 switch(embRegion->getEndcapIndex()) {
132 barrel_ec = -1; // negative side
133 break;
135 barrel_ec = 1; // positive side
136 break;
137 default:
138 throw std::runtime_error("buildCaloDetDescr Wrong Side Index for EMB region " + std::to_string(embRegion->getEndcapIndex()));
139 }
140
141 Identifier regId = em_id->region_id(barrel_ec
142 , embRegion->getSamplingIndex()
143 , embRegion->getRegionIndex());
144
145 EMBDescriptor* embDescr = new EMBDescriptor(regId
146 , static_cast<const AtlasDetectorID *>(cell_id)
147 , cell_id
148 , embRegion
149 , geoAlignStore);
150 caloMgr->add(embDescr);
151
152 double phi_min = 0.;
153 double z_min = 10000.;
154 double z_max = -10000.;
155 double r_min = 10000.;
156 double r_max = -10000.;
157
158 double reg_min = 10000.;
159 double reg_max = -10000.;
160
161 std::vector<double> depth_in;
162 std::vector<double> depth_out;
163 // __________________________________________________________
164
165 // _________ Create EMB detector elements _________
166 for (unsigned int iPhi=embRegion->beginPhiIndex(); iPhi<embRegion->endPhiIndex(); ++iPhi) {
167 for (unsigned int iEta=embRegion->beginEtaIndex(); iEta<embRegion->endEtaIndex(); ++iEta) {
168 EMBCellConstLink cellPtr = embRegion->getEMBCell(iEta,iPhi);
169
170 // build hash identifier for this cell
171 Identifier chanId = em_id->channel_id(barrel_ec
172 , cellPtr->getSamplingIndex()
173 , cellPtr->getRegionIndex()
174 , iEta
175 , iPhi);
176
177 // Create new element and store it
178 if(cellPosShift) {
179 posShiftInd = cell_id->calo_cell_hash(chanId) - minHash;
180 elementPosShift.dx = cellPosShift->deltaX(posShiftInd);
181 elementPosShift.dy = cellPosShift->deltaY(posShiftInd);
182 elementPosShift.dz = cellPosShift->deltaZ(posShiftInd);
183 }
184 EMBDetectorElement* embElement = new EMBDetectorElement(em_id->channel_hash(chanId)
185 , 0
186 , 0
187 , embDescr
188 , cellPtr
189 , embRegion
190 , isTestBeam
191 , geoAlignStore
192 , cellPosShift ? &elementPosShift : nullptr);
193 if(cellPosShift) {
194 if(iPhi==0 && (iEta==0||iEta==1)) {
195 phi_min = embElement->phi() - 0.5*embElement->dphi();
196 }
197 }
198 else {
199 if(iPhi==embRegion->beginPhiIndex()) {
200 phi_min = embElement->phi() - 0.5*embElement->dphi();
201 }
202 }
203
204 // cell volume
205 embElement->set_volume(cellVol.CellVolume(chanId));
206
207 caloMgr->add(embElement);
208
209 if(r_min > embElement->r()-0.5*embElement->dr())
210 r_min = embElement->r()-0.5*embElement->dr();
211 if(r_max < embElement->r()+0.5*embElement->dr())
212 r_max = embElement->r()+0.5*embElement->dr();
213
214 if(z_min > std::abs(embElement->z_raw())-0.5*embElement->dz())
215 z_min = std::abs(embElement->z_raw())-0.5*embElement->dz();
216 if(z_max < std::abs(embElement->z_raw())+0.5*embElement->dz())
217 z_max = std::abs(embElement->z_raw())+0.5*embElement->dz();
218
219 if(reg_min > embElement->eta()-0.5*embElement->deta())
220 reg_min = embElement->eta()-0.5*embElement->deta();
221 if(reg_max < embElement->eta()+0.5*embElement->deta())
222 reg_max = embElement->eta()+0.5*embElement->deta();
223
224 // deal with depth
225 if(iPhi==embRegion->beginPhiIndex()) {
226 depth_in.push_back(cellPtr->getRLocal(EMBCell::FRONT));
227 depth_out.push_back(cellPtr->getRLocal(EMBCell::BACK));
228 }
229 } // Eta loop
230 } // Phi loop
231 // _____________________________________________________________
232
233 double eta_min = (embRegion->getSamplingIndex()==1 && embRegion->getRegionIndex()==0)
234 ? embRegion->getDescriptor()->getEtaBinning().getStart() - embRegion->getDescriptor()->getEtaBinning().getDelta()
235 : embRegion->getDescriptor()->getEtaBinning().getStart();
236
237 double eta_max = (embRegion->getDescriptor()->getEtaBinning()).getEnd();
238 double phi_max = phi_min + std::abs((embRegion->getDescriptor()->getPhiBinning()).getDelta())*embDescr->n_phi();
239
240 // 'ideal' values
241 embDescr->setCaloEtaMin(eta_min);
242 embDescr->setCaloEtaMax(eta_max);
243 embDescr->setCaloPhiMin(phi_min);
244 embDescr->setCaloPhiMax(phi_max);
245 embDescr->setCaloZMin(z_min);
246 embDescr->setCaloZMax(z_max);
247 embDescr->setCaloRMin(r_min);
248 embDescr->setCaloRMax(r_max);
249
250 // depths
251 embDescr->set_n_calo_depth(depth_in.size());
252 embDescr->set_depth_in(depth_in);
253 embDescr->set_depth_out(depth_out);
254
255 // 'alignable' values
256 embDescr->setLArRegMin(reg_min);
257 embDescr->setLArRegMax(reg_max);
258 embDescr->setLArPhiMin(phi_min);
259 if(cellPosShift) {
260 if(embRegion->getEndcapIndex()==EMBDetectorRegion::NEG) {
261 embDescr->setLArEtaMin(-reg_max);
262 }
263 else {
264 embDescr->setLArEtaMin(reg_min);
265 }
266 }
267 else {
268 embDescr->setLArEtaMin(eta_min);
269 }
270 }// Region loop
271 } // if EMB manager has been retrieved
272
273 // ****************************************************************
274 // ** --- --- EMB --- --- **
275 // ****************************************************************
276
277 // ****************************************************************
278 // ** --- --- EMEC --- --- **
279 // ****************************************************************
280
281 // --- Retrieve Emec Detector Manager
282 const EMECDetectorManager* emecManager{nullptr};
283 status = detStore->retrieve(emecManager);
284 if(status.isFailure()) {
285 log << MSG::WARNING << "Could not get the EMECDetectorManager. No Calo Elements will be built for EMEC" << endmsg;
286 }
287 else {
288 // --- --- Iterate over EMEC regions and cells --- ---
290
291 for (emecregIt=emecManager->beginDetectorRegion(); emecregIt!=emecManager->endDetectorRegion(); ++emecregIt) {
292 const EMECDetectorRegion *emecRegion = *emecregIt;
293
294 // _________ Create descriptor for this region _________
295
296 // Build Region identifier.
297 // Do some mapping between LArReadoutGeometry and CaloID
298 EMECDetectorRegion::DetectorSide endcapInd = emecRegion->getEndcapIndex();
299
300 unsigned int radialInd = emecRegion->getRadialIndex();
301 int barrel_ec;
302
303 switch(endcapInd) {
305 barrel_ec = -1; // negative side
306 break;
308 barrel_ec = 1; // positive side
309 break;
310 default:
311 throw std::runtime_error("Wrong Endcap Index for EMEC region " + std::to_string(endcapInd));
312 }// switch(endcapInd)
313
314 switch(radialInd) {
315 case 0:
316 barrel_ec *= 2; // outer wheel
317 break;
318 case 1:
319 barrel_ec *= 3; // inner wheel
320 break;
321 default:
322 throw std::runtime_error("Wrong Radial Index for EMEC region " + std::to_string(radialInd));
323 }// switch(radialInd)
324
325 Identifier regId = em_id->region_id(barrel_ec
326 , emecRegion->getSamplingIndex()
327 , emecRegion->getRegionIndex());
328
329 EMECDescriptor* emecDescr = new EMECDescriptor(regId
330 , static_cast<const AtlasDetectorID *>(cell_id)
331 , cell_id
332 , emecRegion
333 , geoAlignStore);
334 caloMgr->add(emecDescr);
335
336 double phi_min = 0.;
337 double z_min = 10000.;
338 double z_max = -10000.;
339 double r_min = 10000.;
340 double r_max = -10000.;
341
342 double reg_min = 10000.;
343 double reg_max = -10000.;
344
345 std::vector<double> depth_in;
346 std::vector<double> depth_out;
347 // _____________________________________________________________
348
349 // _________ Create EMEC detector elements _________
350 for (unsigned int iPhi=emecRegion->beginPhiIndex(); iPhi<emecRegion->endPhiIndex(); ++iPhi) {
351 for (unsigned int iEta=emecRegion->beginEtaIndex(); iEta<emecRegion->endEtaIndex(); ++iEta) {
352 EMECCellConstLink cellPtr = emecRegion->getEMECCell(iEta,iPhi);
353
354 Identifier chanId = em_id->channel_id(barrel_ec
355 , cellPtr->getSamplingIndex()
356 , cellPtr->getRegionIndex()
357 , iEta
358 , iPhi);
359
360 // Create new element and store it
361 if(cellPosShift) {
362 posShiftInd = cell_id->calo_cell_hash(chanId) - minHash;
363 elementPosShift.dx = cellPosShift->deltaX(posShiftInd);
364 elementPosShift.dy = cellPosShift->deltaY(posShiftInd);
365 elementPosShift.dz = cellPosShift->deltaZ(posShiftInd);
366 }
367 EMECDetectorElement* emecElement = new EMECDetectorElement(em_id->channel_hash(chanId)
368 , 0
369 , 0
370 , emecDescr
371 , cellPtr
372 , emecRegion
373 , isTestBeam
374 , geoAlignStore
375 , cellPosShift ? &elementPosShift : nullptr);
376 if((cellPosShift && iPhi==0)
377 ||(!cellPosShift && iPhi==emecRegion->beginPhiIndex())) {
378 phi_min = emecElement->phi() - 0.5*emecElement->dphi();
379 }
380
381 // cell volume
382 emecElement->set_volume(cellVol.CellVolume(chanId));
383 caloMgr->add(emecElement);
384
385 if(r_min > emecElement->r()-0.5*emecElement->dr())
386 r_min = emecElement->r()-0.5*emecElement->dr();
387 if(r_max < emecElement->r()+0.5*emecElement->dr())
388 r_max = emecElement->r()+0.5*emecElement->dr();
389
390 if(z_min > std::abs(emecElement->z_raw())-0.5*emecElement->dz())
391 z_min = std::abs(emecElement->z_raw())-0.5*emecElement->dz();
392 if(z_max < std::abs(emecElement->z_raw())+0.5*emecElement->dz())
393 z_max = std::abs(emecElement->z_raw())+0.5*emecElement->dz();
394
395 if(reg_min > emecElement->eta()-0.5*emecElement->deta())
396 reg_min = emecElement->eta()-0.5*emecElement->deta();
397 if(reg_max < emecElement->eta()+0.5*emecElement->deta())
398 reg_max = emecElement->eta()+0.5*emecElement->deta();
399
400 // depths
401 if(iPhi==emecRegion->beginPhiIndex()) {
402 depth_in.push_back(std::abs(emecElement->z_raw())-emecElement->dz());
403 depth_out.push_back(std::abs(emecElement->z_raw())+emecElement->dz());
404 }
405 } // Eta loop
406 } // Phi loop
407 // ____________________________________________________________________
408
409 double eta_min = emecRegion->getDescriptor()->getEtaBinning().getStart();
410 double eta_max = emecRegion->getDescriptor()->getEtaBinning().getEnd();
411 double phi_max = phi_min + std::abs(emecRegion->getDescriptor()->getPhiBinning().getDelta())*emecDescr->n_phi();
412
413 // 'ideal' values
414 emecDescr->setCaloEtaMin(eta_min);
415 emecDescr->setCaloEtaMax(eta_max);
416 emecDescr->setCaloPhiMin(phi_min);
417 emecDescr->setCaloPhiMax(phi_max);
418 emecDescr->setCaloZMin(z_min);
419 emecDescr->setCaloZMax(z_max);
420 emecDescr->setCaloRMin(r_min);
421 emecDescr->setCaloRMax(r_max);
422
423 // depths
424 emecDescr->set_n_calo_depth(depth_in.size());
425 emecDescr->set_depth_in(depth_in);
426 emecDescr->set_depth_out(depth_out);
427
428 // 'alignable' values
429 emecDescr->setLArRegMin(reg_min);
430 emecDescr->setLArRegMax(reg_max);
431 emecDescr->setLArPhiMin(phi_min);
432 if(cellPosShift) {
433 if(emecRegion->getEndcapIndex()==EMECDetectorRegion::NEG) {
434 emecDescr->setLArEtaMin(-reg_max);
435 }
436 else {
437 emecDescr->setLArEtaMin(reg_min);
438 }
439 }
440 else {
441 emecDescr->setLArEtaMin(eta_min);
442 }
443 }// Region loop
444 }// if EMEC manager has been retrieved
445
446 // ****************************************************************
447 // ** --- --- EMEC --- --- **
448 // ****************************************************************
449
450
451 // ****************************************************************
452 // ** --- --- HEC --- --- **
453 // ****************************************************************
454
455 // --- Retrieve Hec Detector Manager
456 const HECDetectorManager* hecManager{nullptr};
457 status = detStore->retrieve(hecManager);
458 if(status.isFailure()) {
459 log << MSG::WARNING << "Could not get the HECDetectorManager. No Calo Elements will be built for HEC" << endmsg;
460 }
461 else {
462 // --- --- Iterate over HEC regions and cells --- ---
464
465 for (hecregIt=hecManager->beginDetectorRegion(); hecregIt!=hecManager->endDetectorRegion(); ++hecregIt) {
466 const HECDetectorRegion *hecregion = *hecregIt;
467
468 // _________ Create descriptor for this region _________
469
470 // Build Region identifier.
471 // Do some mapping between LArReadoutGeometry and CaloID
472 HECDetectorRegion::DetectorSide endcapInd = hecregion->getEndcapIndex();
473 int pos_neg = endcapInd==HECDetectorRegion::NEG ? -2 : 2;
474
475 Identifier regId = hec_id->region_id(pos_neg
476 , hecregion->getSamplingIndex()
477 , hecregion->getRegionIndex());
478
479 HECDescriptor* hecDescr = new HECDescriptor(regId
480 , static_cast<const AtlasDetectorID *>(cell_id)
481 , cell_id
482 , hecregion
483 , geoAlignStore);
484 caloMgr->add(hecDescr);
485
486 double phi_min = 0.;
487 float z_min = 10000.f;
488 float z_max = -10000.f;
489 double r_min = 10000.;
490 double r_max = -10000.;
491
492 double reg_min = 10000.;
493 double reg_max = -10000.;
494
495 std::vector<double> depth_in;
496 std::vector<double> depth_out;
497 // _____________________________________________________________
498
499 // _________ Create HEC detector elements _________
500 for (unsigned int iPhi=hecregion->beginPhiIndex(); iPhi<hecregion->endPhiIndex(); ++iPhi) {
501 for (unsigned int iEta=hecregion->beginEtaIndex(); iEta<hecregion->endEtaIndex(); ++iEta) {
502 HECCellConstLink cellPtr = hecregion->getHECCell(iEta,iPhi);
503 // build hash identifier for this cell
504 // Do some mapping between LArReadoutGeometry and CaloID
505
506 if(cellPtr) {
507 Identifier chanId = hec_id->channel_id(pos_neg
508 , cellPtr->getSamplingIndex()
509 , cellPtr->getRegionIndex()
510 , iEta
511 , iPhi);
512
513 // Create the element and store it
514 if(cellPosShift) {
515 posShiftInd = cell_id->calo_cell_hash(chanId) - minHash;
516 elementPosShift.dx = cellPosShift->deltaX(posShiftInd);
517 elementPosShift.dy = cellPosShift->deltaY(posShiftInd);
518 elementPosShift.dz = cellPosShift->deltaZ(posShiftInd);
519 }
520 HECDetectorElement* hecElement = new HECDetectorElement(hec_id->channel_hash(chanId)
521 , 0
522 , 0
523 , hecDescr
524 , cellPtr
525 , hecregion
526 , isTestBeam
527 , geoAlignStore
528 , cellPosShift ? &elementPosShift : nullptr);
529
530 if((cellPosShift && iPhi==0)
531 || (!cellPosShift && iPhi==hecregion->beginPhiIndex())) {
532 phi_min = hecElement->phi() - 0.5*hecElement->dphi();
533 }
534
535 // cell volume
536 hecElement->set_volume(cellVol.CellVolume(chanId));
537
538 caloMgr->add(hecElement);
539
540 if(r_min > cellPtr->getRMinLocalNominal(HECCell::FRONT))
541 r_min = cellPtr->getRMinLocalNominal(HECCell::FRONT);
542 if(r_max < cellPtr->getRMaxLocalNominal(HECCell::FRONT))
543 r_max = cellPtr->getRMaxLocalNominal(HECCell::FRONT);
544
545 if(z_min > std::abs(hecElement->z_raw())-hecElement->dz())
546 z_min = std::abs(hecElement->z_raw())-hecElement->dz();
547 if(z_max < std::abs(hecElement->z_raw())+hecElement->dz())
548 z_max = std::abs(hecElement->z_raw())+hecElement->dz();
549
550 if(reg_min > hecElement->eta()-0.5*hecElement->deta())
551 reg_min = hecElement->eta()-0.5*hecElement->deta();
552 if(reg_max < hecElement->eta()+0.5*hecElement->deta())
553 reg_max = hecElement->eta()+0.5*hecElement->deta();
554
555 if(iPhi==hecregion->beginPhiIndex() && iEta==hecregion->beginEtaIndex()) {
556 depth_in.push_back(std::abs(hecElement->z_raw())-hecElement->dz());
557 depth_out.push_back(std::abs(hecElement->z_raw())+hecElement->dz());
558 }
559
560 }
561 } // Eta loop
562 } // Phi loop
563 // *** *** *** Iterate over cells *** *** ***
564
565 double eta_min = hecregion->getDescriptor()->getEtaBinning().getStart();
566 double eta_max = hecregion->getDescriptor()->getEtaBinning().getEnd();
567 double phi_max = phi_min + std::abs(hecregion->getDescriptor()->getPhiBinning().getDelta())*hecDescr->n_phi();
568
569 // 'ideal' values
570 hecDescr->setCaloEtaMin(eta_min);
571 hecDescr->setCaloEtaMax(eta_max);
572 hecDescr->setCaloPhiMin(phi_min);
573 hecDescr->setCaloPhiMax(phi_max);
574 hecDescr->setCaloZMin(z_min);
575 hecDescr->setCaloZMax(z_max);
576 hecDescr->setCaloRMin(r_min);
577 hecDescr->setCaloRMax(r_max);
578
579 // depths
580 hecDescr->set_n_calo_depth(depth_in.size());
581 hecDescr->set_depth_in(depth_in);
582 hecDescr->set_depth_out(depth_out);
583
584 // 'alignable' values
585 hecDescr->setLArRegMin(reg_min);
586 hecDescr->setLArRegMax(reg_max);
587 hecDescr->setLArPhiMin(phi_min);
588 if(cellPosShift) {
589 if(hecregion->getEndcapIndex()==HECDetectorRegion::NEG) {
590 hecDescr->setLArEtaMin(-reg_max);
591 }
592 else {
593 hecDescr->setLArEtaMin(reg_min);
594 }
595 }
596 else {
597 hecDescr->setLArEtaMin(eta_min);
598 }
599
600 }// Region loop
601 } // if HEC manager has been retrieved
602
603 // ****************************************************************
604 // ** --- --- HEC --- --- **
605 // ****************************************************************
606
607
608 // ****************************************************************
609 // ** --- --- FCAL --- --- **
610 // ****************************************************************
611
612 // --- Retrieve Fcal Detector Manager
613 const FCALDetectorManager* fcalManager{nullptr};
614 status = detStore->retrieve(fcalManager);
615 if(status.isFailure()) {
616 log << MSG::WARNING << "Could not get the FCALDetectorManager. No Calo Elements will be built for FCAL" << endmsg;
617 }
618 else {
619 // --- --- Iterate over FCAL modules and tiles --- ---
621
622 for (fcalmodIt=fcalManager->beginFCAL(); fcalmodIt!=fcalManager->endFCAL(); ++fcalmodIt) {
623 const FCALModule* fcalmodule = *fcalmodIt;
624
625 // _________ Create descriptor for this module _________
626
627 // Build module identifier.
628 // Do some mapping between LArReadoutGeometry and CaloID
629
630 FCALModule::Endcap endcapInd = fcalmodule->getEndcapIndex();
631
632 int pos_neg = endcapInd==FCALModule::NEG ? -2 : 2;
633
634 Identifier regId = fcal_id->module_id(pos_neg,(int)fcalmodule->getModuleIndex());
635
636 FCALDescriptor* fcalDescr = new FCALDescriptor(regId
637 , static_cast<const AtlasDetectorID *>(cell_id)
638 , cell_id
639 , fcalmodule
640 , geoAlignStore);
641 caloMgr->add(fcalDescr);
642
643 double eta_min = 10000.;
644 double eta_max = -10000.;
645 double z_min = 10000.;
646 double z_max = -10000.;
647 double r_min = 10000.;
648 double r_max = -10000.;
649
650 double reg_min = 10000.;
651 double reg_max = -10000.;
652
653 std::vector<double> depth_in;
654 std::vector<double> depth_out;
655 // ___________________________________________________________
656
657 // _________ Create FCAL detector elements _________
658 FCALModule::ConstIterator fcaltileIt;
659 for (fcaltileIt=fcalmodule->beginTiles(); fcaltileIt!=fcalmodule->endTiles(); ++fcaltileIt) {
660 Identifier chanId = fcal_id->channel_id(pos_neg
661 , (int)fcalmodule->getModuleIndex()
662 , fcaltileIt->getIndexJ() // eta
663 , fcaltileIt->getIndexI()); // phi
664
665 if(cellPosShift) {
666 posShiftInd = cell_id->calo_cell_hash(chanId) - minHash;
667 elementPosShift.dx = cellPosShift->deltaX(posShiftInd);
668 elementPosShift.dy = cellPosShift->deltaY(posShiftInd);
669 elementPosShift.dz = cellPosShift->deltaZ(posShiftInd);
670 }
671 FCALDetectorElement* fcalElement = new FCALDetectorElement(fcal_id->channel_hash(chanId)
672 , 0
673 , 0
674 , fcalDescr
675 , &(*fcaltileIt)
676 , fcalmodule
677 , isTestBeam
678 , geoAlignStore
679 , cellPosShift ? &elementPosShift : nullptr);
680 // calculate cell volume
681 double tubeSpacing = cellVol.getFcalTubeSpacing((int)fcalmodule->getModuleIndex());
682 unsigned int numTubes = fcaltileIt->getNumTubes();
683 double dz = fcalmodule->getFullDepthZ(*fcaltileIt);
684 fcalElement->set_volume(.5*sqrt(3)*numTubes*tubeSpacing*tubeSpacing*dz);
685
686 caloMgr->add(fcalElement);
687
688 if(eta_min > std::abs(fcalElement->eta_raw())-0.5*fcalElement->deta())
689 eta_min = std::abs(fcalElement->eta_raw())-0.5*fcalElement->deta();
690 if(eta_max < std::abs(fcalElement->eta_raw())+0.5*fcalElement->deta())
691 eta_max = std::abs(fcalElement->eta_raw())+0.5*fcalElement->deta();
692 if(r_min > fcalElement->r() - 0.5*fcalElement->dr())
693 r_min = fcalElement->r() - 0.5*fcalElement->dr();
694 if(r_max < fcalElement->r() + 0.5*fcalElement->dr())
695 r_max = fcalElement->r() + 0.5*fcalElement->dr();
696 if(z_min > std::abs(fcalElement->z_raw()) - 0.5*fcalElement->dz())
697 z_min = std::abs(fcalElement->z_raw()) - 0.5*fcalElement->dz();
698 if(z_max < std::abs(fcalElement->z_raw()) + 0.5*fcalElement->dz())
699 z_max = std::abs(fcalElement->z_raw()) + 0.5*fcalElement->dz();
700 if(reg_min > fcalElement->eta()-0.5*fcalElement->deta())
701 reg_min = fcalElement->eta()-0.5*fcalElement->deta();
702 if(reg_max < fcalElement->eta()+0.5*fcalElement->deta())
703 reg_max = fcalElement->eta()+0.5*fcalElement->deta();
704
705 if(fcaltileIt==fcalmodule->beginTiles()) {
706 depth_in.push_back(std::abs(fcalElement->z_raw()) - fcalElement->dz());
707 depth_out.push_back(std::abs(fcalElement->z_raw()) + fcalElement->dz());
708 }
709 }
710
711 // These values have no importance for FCAL - hardwire them here.
712 fcalDescr->setCaloPhiMin(0.);
713 fcalDescr->setCaloPhiMax(2*M_PI);
714 fcalDescr->setLArPhiMin(0.);
715
716
717 fcalDescr->setCaloEtaMin(eta_min);
718 fcalDescr->setCaloEtaMax(eta_max);
719 fcalDescr->setCaloZMin(z_min);
720 fcalDescr->setCaloZMax(z_max);
721 fcalDescr->setCaloRMin(r_min);
722 fcalDescr->setCaloRMax(r_max);
723 fcalDescr->setLArRegMin(reg_min);
724 fcalDescr->setLArRegMax(reg_max);
725
726 // depths
727 fcalDescr->set_n_calo_depth(depth_in.size());
728 fcalDescr->set_depth_in(depth_in);
729 fcalDescr->set_depth_out(depth_out);
730
731 if(fcalmodule->getEndcapIndex()==FCALModule::NEG) {
732 fcalDescr->setLArEtaMin(-reg_max);
733 }
734 else {
735 fcalDescr->setLArEtaMin(reg_min);
736 }
737 }// Module loop
738 }// if FCAL manager has been retrieved
739
740 // ****************************************************************
741 // ** --- --- FCAL --- --- **
742 // ****************************************************************
743
744
745 // ****************************************************************
746 // ** --- --- Tile --- --- **
747 // ****************************************************************
748 const TileDetDescrManager* tile_mgr{nullptr};
749 status = detStore->retrieve(tile_mgr);
750 if (status.isFailure()) {
751 log << MSG::WARNING << "Could not get the TileDetectorManager. No Calo Elements will be built for Tile" << endmsg;
752 }
753 else {
754 log << MSG::DEBUG << " Found the TileDetDescrManager " << endmsg;
755 cell_id->calo_cell_hash_range((int)CaloCell_ID::TILE,minHash,maxHash);
756 unsigned idHashMax = maxHash-minHash;
757 for(unsigned int idhash=0; idhash < idHashMax; ++idhash) {
758 CaloDetDescrElement* newelt = tile_mgr->get_cell_element(idhash);
759 if(newelt) {
760 caloMgr->add(newelt);
761 }
762 }
763
764 std::vector<CaloDetDescriptor*>::const_iterator itr = tile_mgr->calo_descriptors_begin();
765 std::vector<CaloDetDescriptor*>::const_iterator end = tile_mgr->calo_descriptors_end();
766
767 for(; itr != end; ++itr) {
768 caloMgr->add_tile(*itr);
769 }
770 }
771 // ****************************************************************
772 // ** --- --- Tile --- --- **
773 // ****************************************************************
774
775 // ****************************************************************
776 // ** --- Additional elements --- **
777 // ****************************************************************
778 if(isTestBeam) {
780 if(detStore->retrieve(cDDEvec) == StatusCode::SUCCESS) {
781 // We have additional elements
782 for (CaloDetDescrElement* elt : *cDDEvec) {
783 caloMgr->add (elt);
784 }
785 }
786 }
787
788 return caloMgr;
789}
#define M_PI
Scalar eta() const
pseudorapidity method
#define endmsg
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
This class groups all DetDescr information related to a CaloCell.
void set_depth_out(std::vector< double > &calo_depth)
set vector of out depths
void setLArRegMin(double reg_min)
Set LAr Region Eta Min.
int n_phi() const
phi granularity
void setLArPhiMin(double phi_min)
Set LAr Region Phi Min.
void setCaloRMin(double r_min)
Set R Min.
void setLArRegMax(double reg_max)
Set LAr Region Eta Max.
void setCaloZMax(double z_max)
Set Z Max.
void set_n_calo_depth(int n_calo_depth)
set number of calo depths
void setCaloZMin(double z_min)
Set Z Min.
void setCaloPhiMin(double phi_min)
Set Phi Min.
void setCaloPhiMax(double phi_max)
Set Phi Max.
void setCaloRMax(double r_max)
Set R Max.
void set_depth_in(std::vector< double > &calo_depth)
set vector of in depths
void setCaloEtaMin(double eta_min)
Set Eta Min.
void setLArEtaMin(double eta_min)
Set LAr Region Phi Max.
void setCaloEtaMax(double eta_max)
Set Eta Max.
This class initializes the Calo (LAr and Tile) offline identifiers.
const LArHEC_ID * getHEC_ID(void) const
const LArFCAL_ID * getFCAL_ID(void) const
const LArEM_ID * getEM_ID(void) const
float deltaX(const size_type &hashID) const
float deltaY(const size_type &hashID) const
float deltaZ(const size_type &hashID) const
@ BACK
Definition EMBCell.h:33
@ FRONT
Definition EMBCell.h:33
LAr EMB Descriptor.
const CellBinning & getPhiBinning() const
The Binning in Phi.
const CellBinning & getEtaBinning() const
The Binning in Eta.
LAr EMB Detector Element.
A manager class providing access to readout geometry information for the electromagnetic barrel calor...
EMBDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constEMBDetectorRegion * >::const_iterator DetectorRegionConstIterator
EMBDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
const EMBDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int beginPhiIndex() const
Returns the first phi index in the region.
EMBCellConstLink getEMBCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
EMBDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
unsigned int getRegionIndex() const
Returns the Region Index.
unsigned int beginEtaIndex() const
Returns the first eta index in the region.
LAr EMEC Descriptor.
const CellBinning & getEtaBinning() const
The Binning in Eta.
const CellBinning & getPhiBinning() const
The Binning in Phi.
LAr EMEC Detector Element.
A manager class providing access to readout geometry information for the electromagnetic endcap calor...
EMECDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
EMECDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constEMECDetectorRegion * >::const_iterator DetectorRegionConstIterator
EMECCellConstLink getEMECCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int beginPhiIndex() const
returns the first phi index in the region.
unsigned int getRadialIndex() const
Returns the Radial (Outer Wheel=0,InnerWheel=1) Index.
unsigned int getRegionIndex() const
Returns the Region Index.
EMECDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
const EMECDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
unsigned int beginEtaIndex() const
returns the first eta index in the region.
LAr FCAL Descriptor.
LAr FCAL Detector Element.
A manager class providing access to readout geometry information for the forward calorimeter.
std::vector< constFCALModule * >::const_iterator ConstIterator
FCALDetectorManager::ConstIterator beginFCAL() const
Iterate over FCAL Modules.
FCALDetectorManager::ConstIterator endFCAL() const
Iterate over FCAL Modules.
FCALModule::Endcap getEndcapIndex() const
Returns the side (O=Negative, 1=Positive)
double getFullDepthZ(const FCALTile &) const
Gets Tile (full) Depth.
std::vector< FCALTile >::const_iterator ConstIterator
Definition FCALModule.h:36
FCALModule::ConstIterator beginTiles() const
Iteration over FCAL Tiles.
FCALModule::Module getModuleIndex() const
Returns the Module (1,2, or 3)
FCALModule::ConstIterator endTiles() const
Iteration over FCAL Tiles.
@ FRONT
Definition HECCell.h:34
LAr HEC Descriptor.
const CellBinning & getPhiBinning() const
The Binning in Phi.
const CellBinning & getEtaBinning() const
The Binning in Eta.
LAr HEC Detector Element.
A manager class providing access to readout geometry information for the hadronic endcap calorimeter.
HECDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
HECDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constHECDetectorRegion * >::const_iterator DetectorRegionConstIterator
Description of a region of homogenous granularity in the hadronic endcap calorimeter.
unsigned int getRegionIndex() const
Returns the Region Index.
HECCellConstLink getHECCell(unsigned int ieta, unsigned int iphi) const
Retrieve a cell with eta index and phi index.
unsigned int beginPhiIndex() const
returns the first phi index in the region.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index (0-3)
const HECDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int beginEtaIndex() const
returns the first eta index in the region.
HECDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
This is a "hash" representation of an Identifier.
Stored in storegate.
void isTestBeam(bool flag)
Set Test Beam flag.
Identifier region_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
Identifier channel_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
IdentifierHash channel_hash(Identifier channelId) const
create hash id from channel id
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
Identifier channel_id(const ExpandedIdentifier &exp_id) const
channel identifier for a channel from ExpandedIdentifier
Identifier region_id(const ExpandedIdentifier &exp_id) const
region identifier for a channel from ExpandedIdentifier
IdentifierHash channel_hash(Identifier channelId) const
create hash id from channel id
Helper class for LArHEC offline identifiers.
Definition LArHEC_ID.h:76
calo_descr_const_iterator calo_descriptors_end() const
CaloDetDescrElement * get_cell_element(unsigned int cell_hash) const
calo_descr_const_iterator calo_descriptors_begin() const
int r
Definition globals.cxx:22
@ iPhi
Definition ParamDefs.h:47
status
Definition merge.py:16
setScale setgFexType iEta
dx,dy,dz displacement of the calorimeter cell caused by sagging

◆ buildCaloDetDescrNoAlign()

std::unique_ptr< CaloDetDescrManager > buildCaloDetDescrNoAlign ( ISvcLocator * svcLocator,
IMessageSvc * msgSvc )

Definition at line 791 of file CaloDetDescrBuilder.cxx.

793{
794 return buildCaloDetDescr(svcLocator,msgSvc,nullptr,nullptr);
795}
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescr(ISvcLocator *svcLocator, IMessageSvc *msgSvc, const GeoAlignmentStore *geoAlignStore, const CaloRec::CaloCellPositionShift *cellPosShift)