ATLAS Offline Software
Loading...
Searching...
No Matches
CaloDmDescrManager Class Reference

#include <CaloDmDescrManager.h>

Collaboration diagram for CaloDmDescrManager:

Public Member Functions

 CaloDmDescrManager ()
 ~CaloDmDescrManager ()
int initialize ()
CaloDmDescrElementget_element (const Identifier &cellId) const
CaloDmRegionget_dm_region (const Identifier &cellId) const
IdentifierHash get_dm_hash (const CaloDmRegion *myRegion, float &eta, float &phi) const
int get_dm_key (const Identifier &cellId) const
int get_dm_area (const Identifier &cellId) const
void show_element (const Identifier &cellId) const
std::vector< CaloDmRegion * >::const_iterator reg_begin (void) const
std::vector< CaloDmRegion * >::const_iterator reg_end (void) const

Static Public Member Functions

static const CaloDmDescrManagerinstance ()
static CaloCell_ID::CaloSample get_calo_sample (const std::string &SamplingName)
static CaloCell_ID::CaloSample get_calo_sample (const std::string &SamplingName, float &etaMin, float &etaMax)

Private Member Functions

CaloDmDescrElementbuild_element (const Identifier &cellId, const CaloDmRegion *myRegion)
StatusCode load_regions (const std::string &DmRegionFileName)
void build_element_vector ()

Private Attributes

const CaloDM_IDm_caloDM_ID
const AtlasDetectorIDm_id_helper
ServiceHandle< StoreGateSvcm_detStore
std::vector< CaloDmRegion * > m_DmRegionVector
std::vector< CaloDmDescrElement * > m_DmElementVector

Detailed Description

Definition at line 131 of file CaloDmDescrManager.h.

Constructor & Destructor Documentation

◆ CaloDmDescrManager()

CaloDmDescrManager::CaloDmDescrManager ( )

Definition at line 39 of file CaloDmDescrManager.cxx.

40 : m_caloDM_ID (nullptr),
41 m_id_helper (nullptr),
42 m_detStore ("DetectorStore", "CaloDmDescrManager")
43{
44 initialize();
45}
const AtlasDetectorID * m_id_helper
ServiceHandle< StoreGateSvc > m_detStore
const CaloDM_ID * m_caloDM_ID

◆ ~CaloDmDescrManager()

CaloDmDescrManager::~CaloDmDescrManager ( )

Definition at line 52 of file CaloDmDescrManager.cxx.

53{
54 for(unsigned int i = 0; i<m_DmRegionVector.size(); i++) delete m_DmRegionVector[i];
55 m_DmRegionVector.clear();
56
57 for(unsigned int i = 0; i<m_DmElementVector.size(); i++) delete m_DmElementVector[i];
58 m_DmElementVector.clear();
59
60}
std::vector< CaloDmRegion * > m_DmRegionVector
std::vector< CaloDmDescrElement * > m_DmElementVector

Member Function Documentation

◆ build_element()

CaloDmDescrElement * CaloDmDescrManager::build_element ( const Identifier & cellId,
const CaloDmRegion * myRegion )
private

Definition at line 286 of file CaloDmDescrManager.cxx.

287{
288 int neta = m_caloDM_ID->eta(id);
289 int nphi = m_caloDM_ID->phi(id);
290 int subdet = m_caloDM_ID->pos_neg_z(id);
291 float eta;
292 if(subdet>0){
293 eta = myRegion->etaMin() + (0.5+neta)*myRegion->deta();
294 } else {
295 eta = myRegion->etaMax() - (0.5+neta)*myRegion->deta();
296 }
297 float phi = myRegion->m_dphi*(0.5+nphi);
298 if(phi > M_PI) phi -= 2*M_PI; // we need to have phi=-M_PI,M_PI
299 float theta = 2.*std::atan(std::exp(-eta));
300 float rho, z;
301 if(myRegion->m_isBarrel) {
302 rho=myRegion->m_distance*0.1;
303 z=rho/std::abs(std::tan(theta));
304 }else{
305 z=myRegion->m_distance*0.1;
306 rho=z*std::abs(std::tan(theta));
307 }
308 // building new element which will containt real eta, phi values for this identifier
309 CaloDmDescrElement *element = new CaloDmDescrElement(eta, myRegion->m_deta, phi, myRegion->m_dphi, rho, z);
310 return element;
311}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Scalar theta() const
theta method
#define z
float deta() const
float etaMax() const
float etaMin() const

◆ build_element_vector()

void CaloDmDescrManager::build_element_vector ( )
private

Definition at line 254 of file CaloDmDescrManager.cxx.

255{
256 if(!m_DmElementVector.empty()) {
257 std::cout << "CaloDmDescrManager::build_element_list() -> Warning! Non empty list."
258 << " m_DmElementVector.size(): " << m_DmElementVector.size()
259 << std::endl;
260 return;
261 }
262
263 m_DmElementVector.resize(m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash_max());
264
265 // loop over all DM LAr identifiers
266 for(unsigned int i=0; i<m_caloDM_ID->lar_zone_hash_max(); i++) {
267 Identifier id = m_caloDM_ID->lar_zone_id(i);
268 Identifier id_reg = m_caloDM_ID->region_id(id);
269 IdentifierHash hash_reg = m_caloDM_ID->lar_region_hash(id_reg);
271 }
272 // loop over tile identifier
273 for(unsigned int i=0; i<m_caloDM_ID->tile_zone_hash_max(); i++) {
274 Identifier id = m_caloDM_ID->tile_zone_id(i);
275 Identifier id_reg = m_caloDM_ID->region_id(id);
276 IdentifierHash hash_reg = m_caloDM_ID->lar_region_hash_max() + m_caloDM_ID->tile_region_hash(id_reg);
277 m_DmElementVector[m_caloDM_ID->lar_zone_hash_max() + i] = build_element(id, m_DmRegionVector[hash_reg]);
278 }
279}
CaloDmDescrElement * build_element(const Identifier &cellId, const CaloDmRegion *myRegion)

◆ get_calo_sample() [1/2]

CaloCell_ID::CaloSample CaloDmDescrManager::get_calo_sample ( const std::string & SamplingName)
static

Definition at line 481 of file CaloDmDescrManager.cxx.

482{
483 if ( SamplingName == "PreSamplerB" ) {
484 return CaloCell_ID::PreSamplerB;
485 } else if ( SamplingName == "EMB1" ) {
486 return CaloCell_ID::EMB1;
487 } else if ( SamplingName == "EMB2" ) {
488 return CaloCell_ID::EMB2;
489 } else if ( SamplingName == "EMB3" ) {
490 return CaloCell_ID::EMB3;
491 } else if ( SamplingName == "PreSamplerE" ) {
492 return CaloCell_ID::PreSamplerE;
493 } else if ( SamplingName == "EME1" ) {
494 return CaloCell_ID::EME1;
495 } else if ( SamplingName == "EME2" ) {
496 return CaloCell_ID::EME2;
497 } else if ( SamplingName == "EME3" ) {
498 return CaloCell_ID::EME3;
499 } else if ( SamplingName == "HEC0" ) {
500 return CaloCell_ID::HEC0;
501 }else if ( SamplingName == "HEC1" ) {
502 return CaloCell_ID::HEC1;
503 }else if ( SamplingName == "HEC2" ) {
504 return CaloCell_ID::HEC2;
505 }else if ( SamplingName == "HEC3" ) {
506 return CaloCell_ID::HEC3;
507 }else if ( SamplingName == "TileBar0" ) {
508 return CaloCell_ID::TileBar0;
509 }else if ( SamplingName == "TileBar1" ) {
510 return CaloCell_ID::TileBar1;
511 }else if ( SamplingName == "TileBar2" ) {
512 return CaloCell_ID::TileBar2;
513 }else if ( SamplingName == "TileGap1" ) {
514 return CaloCell_ID::TileGap1;
515 }else if ( SamplingName == "TileGap2" ) {
516 return CaloCell_ID::TileGap2;
517 }else if ( SamplingName == "TileGap3" ) {
518 return CaloCell_ID::TileGap3;
519 }else if ( SamplingName == "TileExt0" ) {
520 return CaloCell_ID::TileExt0;
521 }else if ( SamplingName == "TileExt1" ) {
522 return CaloCell_ID::TileExt1;
523 }else if ( SamplingName == "TileExt2" ) {
524 return CaloCell_ID::TileExt2;
525 }else if ( SamplingName == "FCAL0" ) {
526 return CaloCell_ID::FCAL0;
527 }else if ( SamplingName == "FCAL1" ) {
528 return CaloCell_ID::FCAL1;
529 }else if ( SamplingName == "FCAL2" ) {
530 return CaloCell_ID::FCAL2;
531 }
532 std::cout << "Calorimeter sampling '" << SamplingName
533 << "' is not a valid Calorimeter sampling name and will be ignored! " << std::endl;
534 return CaloCell_ID::Unknown;
535}

◆ get_calo_sample() [2/2]

CaloCell_ID::CaloSample CaloDmDescrManager::get_calo_sample ( const std::string & SamplingName,
float & etaMin,
float & etaMax )
static

Definition at line 543 of file CaloDmDescrManager.cxx.

544{
545 CaloCell_ID::CaloSample nsmp = CaloCell_ID::Unknown;
546 if ( SamplingName.find("PreSamplerB") != std::string::npos ) {
547 nsmp = CaloCell_ID::PreSamplerB;
548 } else if ( SamplingName.find("EMB1") != std::string::npos ) {
549 nsmp = CaloCell_ID::EMB1;
550 } else if ( SamplingName.find("EMB2") != std::string::npos ) {
551 nsmp = CaloCell_ID::EMB2;
552 } else if ( SamplingName.find("EMB3") != std::string::npos ) {
553 nsmp = CaloCell_ID::EMB3;
554 } else if ( SamplingName.find("PreSamplerE") != std::string::npos ) {
555 nsmp = CaloCell_ID::PreSamplerE;
556 } else if ( SamplingName.find("EME1") != std::string::npos ) {
557 nsmp = CaloCell_ID::EME1;
558 } else if ( SamplingName.find("EME2") != std::string::npos ) {
559 nsmp = CaloCell_ID::EME2;
560 } else if ( SamplingName.find("EME3") != std::string::npos ) {
561 nsmp = CaloCell_ID::EME3;
562 } else if ( SamplingName.find("HEC0") != std::string::npos ) {
563 nsmp = CaloCell_ID::HEC0;
564 }else if ( SamplingName.find("HEC1") != std::string::npos ) {
565 nsmp = CaloCell_ID::HEC1;
566 }else if ( SamplingName.find("HEC2") != std::string::npos ) {
567 nsmp = CaloCell_ID::HEC2;
568 }else if ( SamplingName.find("HEC3") != std::string::npos ) {
569 nsmp = CaloCell_ID::HEC3;
570 }else if ( SamplingName.find("TileBar0") != std::string::npos ) {
571 nsmp = CaloCell_ID::TileBar0;
572 }else if ( SamplingName.find("TileBar1") != std::string::npos ) {
573 nsmp = CaloCell_ID::TileBar1;
574 }else if ( SamplingName.find("TileBar2") != std::string::npos ) {
575 nsmp = CaloCell_ID::TileBar2;
576 }else if ( SamplingName.find("TileGap1") != std::string::npos ) {
577 nsmp = CaloCell_ID::TileGap1;
578 }else if ( SamplingName.find("TileGap2") != std::string::npos ) {
579 nsmp = CaloCell_ID::TileGap2;
580 }else if ( SamplingName.find("TileGap3") != std::string::npos ) {
581 nsmp = CaloCell_ID::TileGap3;
582 }else if ( SamplingName.find("TileExt0") != std::string::npos ) {
583 nsmp = CaloCell_ID::TileExt0;
584 }else if ( SamplingName.find("TileExt1") != std::string::npos ) {
585 nsmp = CaloCell_ID::TileExt1;
586 }else if ( SamplingName.find("TileExt2") != std::string::npos ) {
587 nsmp = CaloCell_ID::TileExt2;
588 }else if ( SamplingName.find("FCAL0") != std::string::npos ) {
589 nsmp = CaloCell_ID::FCAL0;
590 }else if ( SamplingName.find("FCAL1") != std::string::npos ) {
591 nsmp = CaloCell_ID::FCAL1;
592 }else if ( SamplingName.find("FCAL2") != std::string::npos ) {
593 nsmp = CaloCell_ID::FCAL2;
594 }else {
595 std::cout << "CaloDmDescrManager::get_calo_sample() -> Calorimeter sampling '" << SamplingName
596 << "' is not a valid Calorimeter sampling name and will be ignored! " << std::endl;
597 return CaloCell_ID::Unknown;
598 }
599 char dummy;
600 if(SamplingName.find('(') == std::string::npos || SamplingName.find(')') != SamplingName.size()-1 ){
601 std::cout << "CaloDmDescrManager::get_calo_sample() -> Can't parse calorimeter sampling '" << SamplingName << "' string! Something with brackets..." << std::endl;
602 return CaloCell_ID::Unknown;
603 }
604 std::string sEtaRange(SamplingName,SamplingName.find('(')+1);
605 std::istringstream iEtaRange( sEtaRange.c_str() );
606 if(iEtaRange >> etaMin >> dummy >> etaMax) {
607 return nsmp;
608 }else{
609 std::cout << "CaloDmDescrManager::get_calo_sample() -> Can't parse calorimeter sampling '" << SamplingName << "' string!" << std::endl;
610 return CaloCell_ID::Unknown;
611 }
612}
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53

◆ get_dm_area()

int CaloDmDescrManager::get_dm_area ( const Identifier & cellId) const

Definition at line 147 of file CaloDmDescrManager.cxx.

148{
149 int key = get_dm_key(cellId);
150 CaloDmDescrElement *el = get_element(cellId);
151 return CaloDmDescrArea::getArea(key, el->eta());
152}
static int getArea(const int &dmkey, const float &eta)
int get_dm_key(const Identifier &cellId) const
CaloDmDescrElement * get_element(const Identifier &cellId) const

◆ get_dm_hash()

IdentifierHash CaloDmDescrManager::get_dm_hash ( const CaloDmRegion * myRegion,
float & eta,
float & phi ) const

Definition at line 185 of file CaloDmDescrManager.cxx.

186{
187 IdentifierHash id_hash;
188
189 if(eta < myRegion->etaMin() || eta >= myRegion->etaMax()) {
190#ifdef DEBUG
191 std::cout << " input eta out of range"
192 << " eta: " << eta
193 << " myRegion->m_key: " << myRegion->m_key
194 << " myRegion->etaMin(): " << myRegion->etaMin()
195 << " myRegion->etaMax(): " << myRegion->etaMax()
196 << std::endl;
197#endif
198 return 0xFFFFFFFF;
199 }
200 int neta;
201 neta=int((eta-myRegion->etaMin())/myRegion->deta());
202 if(myRegion->m_side < 0) {
203 neta = myRegion->netaMax() - neta - 1;
204 }
205 float xphi=phi;
206 if(xphi<0.0) xphi=2*M_PI+xphi;
207 int nphi= int(xphi/myRegion->dphi());
208#ifdef DEBUG
209 std::cout << " key: " << myRegion->m_key
210 << " side: " << myRegion->m_side
211 << " etaMin: " << myRegion->etaMin()
212 << " phiMax: " << myRegion->etaMax()
213 << " neta: " << neta
214 << " nphi: " << nphi
215 << " myRegion->netaMax(): " << myRegion->netaMax()
216 << " myRegion->nphiMax(): " << myRegion->nphiMax()
217 << std::endl;
218#endif
219 if( (neta >=0 && neta < myRegion->netaMax()) && (nphi >=0 && nphi < myRegion->nphiMax()) ) {
220 Identifier id = m_caloDM_ID->zone_id(myRegion->region_id(), neta, nphi);
221 if( m_caloDM_ID->is_lar(id) ) {
222 id_hash = m_caloDM_ID->lar_zone_hash(id);
223 } else if ( m_caloDM_ID->is_tile(id) ) {
224 id_hash = m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash(id);
225 }else{
226 std::cout << "CaloDmDescrManager::get_dm_hash() -> ERROR! p1." << std::endl;
227 return 0xFFFFFFFF;
228 }
229 } else{
230 std::cout << "CaloDmDescrManager::get_dm_hash() -> ERROR! p2."
231 << " key: " << myRegion->m_key
232 << " side: " << myRegion->m_side
233 << " myRegion->etaMin(): " << myRegion->etaMin()
234 << " myRegion->etaMax(): " << myRegion->etaMax()
235 << " myRegion->deta(): " << myRegion->deta()
236 << " eta: " << eta
237 << " phi: " << phi
238 << " neta: " << neta
239 << " nphi: " << nphi
240 << " myRegion->netaMax(): " << myRegion->netaMax()
241 << " myRegion->nphiMax(): " << myRegion->nphiMax()
242 << std::endl;
243 }
244 return id_hash;
245}
float dphi() const
int netaMax() const
int nphiMax() const
const Identifier region_id() const

◆ get_dm_key()

int CaloDmDescrManager::get_dm_key ( const Identifier & cellId) const

Definition at line 132 of file CaloDmDescrManager.cxx.

133{
134 int subdet = m_caloDM_ID->pos_neg_z(cellId);
135 int type = m_caloDM_ID->dmat(cellId);
136 int sampling = m_caloDM_ID->sampling(cellId);
137 int region = m_caloDM_ID->region(cellId);
138 return abs(subdet)*1000+type*100+sampling*10+region;
139}

◆ get_dm_region()

CaloDmRegion * CaloDmDescrManager::get_dm_region ( const Identifier & cellId) const

Definition at line 159 of file CaloDmDescrManager.cxx.

160{
161 Identifier id_reg = m_caloDM_ID->region_id(cellId);
162 IdentifierHash hash_reg;
163 if( m_caloDM_ID->is_lar(cellId) ) {
164 hash_reg = m_caloDM_ID->lar_region_hash(id_reg);
165 } else if ( m_caloDM_ID->is_tile(cellId) ) {
166 hash_reg = m_caloDM_ID->lar_region_hash_max() + m_caloDM_ID->tile_region_hash(id_reg);
167 } else {
168 std::cout << "CaloDmDescrManager::get_dm_region-> Error! Wrong dead material identifier! " << m_id_helper->show_to_string(cellId) << std::endl;
169 return nullptr;
170 }
171 if(hash_reg < m_DmRegionVector.size()) {
172 return m_DmRegionVector[hash_reg];
173 } else {
174 std::cout << "CaloDmDescrManager::get_dm_region-> Error! Bad region hash id!" << m_id_helper->show_to_string(cellId) << std::endl;
175 return nullptr;
176 }
177}

◆ get_element()

CaloDmDescrElement * CaloDmDescrManager::get_element ( const Identifier & cellId) const

Definition at line 107 of file CaloDmDescrManager.cxx.

108{
109 IdentifierHash hash;
110 if( m_caloDM_ID->is_lar(cellId) ) {
111 hash = m_caloDM_ID->lar_zone_hash(cellId);
112 } else if ( m_caloDM_ID->is_tile(cellId) ) {
113 hash = m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash(cellId);
114 } else {
115 std::cout << "CaloDmDescrManager::get_element-> Error! Wrong dead material identifier! " << m_id_helper->show_to_string(cellId) << std::endl;
116 return nullptr;
117 }
118 if(hash < m_DmElementVector.size()) {
119 return m_DmElementVector[hash];
120 } else {
121 std::cout << "CaloDmDescrManager::get_element-> Error! Bad hash id for dead material identifier " << hash << std::endl;
122 return nullptr;
123 }
124}

◆ initialize()

int CaloDmDescrManager::initialize ( )

Definition at line 77 of file CaloDmDescrManager.cxx.

78{
79 const std::string& name = "CaloDmDescrManager";
80 CHECK_WITH_CONTEXT( m_detStore.retrieve(), name, 1);
81 CHECK_WITH_CONTEXT( m_detStore->retrieve(m_caloDM_ID), name, 1);
82 CHECK_WITH_CONTEXT( m_detStore->retrieve(m_id_helper), name, 1);
83 CHECK_WITH_CONTEXT( load_regions("DeadMaterialRegionDescription_1.10c.txt"), name, 1);
84
86
87 return 0;
88}
#define CHECK_WITH_CONTEXT(...)
Evaluate an expression and check for errors, with an explicitly specified context name.
StatusCode load_regions(const std::string &DmRegionFileName)

◆ instance()

const CaloDmDescrManager * CaloDmDescrManager::instance ( )
static

Definition at line 67 of file CaloDmDescrManager.cxx.

68{
69 static const CaloDmDescrManager s_instance;
70 return &s_instance;
71}

◆ load_regions()

StatusCode CaloDmDescrManager::load_regions ( const std::string & DmRegionFileName)
private

Definition at line 318 of file CaloDmDescrManager.cxx.

319{
320 MsgStream log(Athena::getMessageSvc(), "CaloDmDescrManager");
321
322 char cLine[MAX_BUFFER_LEN];
323
324 if(!m_DmRegionVector.empty()) {
325 log << MSG::WARNING << "CaloDmDescrManager::build_element_list() -> Warning! Non empty list."
326 << " m_DmRegionVector.size(): " << m_DmRegionVector.size()
327 << endmsg;
328 return StatusCode::FAILURE;
329 }
330
331 // Find the full path to filename:
332 std::string file = PathResolver::find_file (DmRegionFileName, "DATAPATH");
333 log << MSG::INFO << "Reading file " << file << endmsg;
334
335 std::ifstream fin(file.c_str());
336 if(!fin){
337 log << MSG::ERROR << "Can't open file " << file << endmsg;
338 return StatusCode::FAILURE;
339 }
340
341 m_DmRegionVector.resize(m_caloDM_ID->lar_region_hash_max() + m_caloDM_ID->tile_region_hash_max(), nullptr);
342 std::string sLine;
343 while(fin.getline(cLine,sizeof(cLine)-1)){
344 if( strlen(cLine)==0 || cLine[0] == '#' || cLine[0] == '\n') continue;
345 sLine = std::string(cLine);
346 std::istringstream mypars( sLine.c_str() );
347
348 int key, distance, isBarrel;
349 float etamin, etamax, deta, dphi;
350 if(mypars >> key >> etamin >> etamax >> deta >> dphi >> distance >> isBarrel) {
351 fin.getline(cLine,sizeof(cLine)-1);
352 sLine = std::string(cLine);
353 std::istringstream mynei( sLine.c_str() );
354 std::string sKey;
355 std::vector<short> neighbours;
356 std::vector<float> CaloEtaMinVector;
357 std::vector<float> CaloEtaMaxVector;
358 while (mynei >> sKey) {
359 if(sKey.find("CaloSampleNeighbors") != std::string::npos) continue;
360 if(sKey.find("Unknown") != std::string::npos) continue;
361 float caloEtaMin, caloEtaMax;
362 CaloCell_ID::CaloSample nsmp = get_calo_sample(sKey, caloEtaMin, caloEtaMax);
363 if(nsmp != CaloCell_ID::Unknown) {
364 neighbours.push_back((int)nsmp);
365 CaloEtaMinVector.push_back(caloEtaMin);
366 CaloEtaMaxVector.push_back(caloEtaMax);
367 } else {
368 std::cout << "CaloDmDescrManager::load_regions() -> Fromat ERROR in line '" << sLine << "', key '" << sKey << "'" << std::endl;
369 return StatusCode::FAILURE;
370 }
371 } // while over sKey
372
373 int subdet=key/1000;
374 int type=(key-subdet*1000)/100;
375 int sampling=(key-subdet*1000-type*100)/10;
376 int region=(key-subdet*1000-type*100-sampling*10)/1;
377 if(subdet != 4 && subdet !=5) {
378 log << MSG::ERROR << " Error! Wrong subdet " << subdet << ". Format error in line '" << sLine << "', key '" << sKey << "'" << std::endl;
379 return StatusCode::FAILURE;
380 }
381
382 Identifier id_side_neg = m_caloDM_ID->region_id(-subdet, type, sampling, region);
383 Identifier id_side_pos = m_caloDM_ID->region_id(subdet, type, sampling, region);
384
385 IdentifierHash hash_side_neg;
386 IdentifierHash hash_side_pos;
387 if(subdet == 4) {
388 // lar region
389 hash_side_neg = m_caloDM_ID->lar_zone_hash(id_side_neg);
390 hash_side_pos = m_caloDM_ID->lar_zone_hash(id_side_pos);
391 } else if (subdet == 5){
392 // tile region has shifted position in our vectors
393 hash_side_neg = m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash(id_side_neg);
394 hash_side_pos = m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash(id_side_pos);
395 }
396
397 // Making DM region for positive side
398 CaloDmRegion *myRegionPos = new CaloDmRegion();
399 myRegionPos->m_key=key;
400 myRegionPos->m_side=1;
401 myRegionPos->m_eta_min=etamin;
402 myRegionPos->m_eta_max=etamax;
403 myRegionPos->m_deta=deta;
404 myRegionPos->m_neta_max=int((etamax-etamin)/deta+0.00001);
405 myRegionPos->m_dphi=dphi*(M_PI/3.2);
406 myRegionPos->m_nphi_max=int(M_PI*2./myRegionPos->m_dphi+0.00001);
407 myRegionPos->m_distance=distance;
408 myRegionPos->m_isBarrel=true;
409 if(!isBarrel) myRegionPos->m_isBarrel=false;
410 // assigning of information over neighboring calo samplings for this DM region
411 myRegionPos->m_CaloSampleNeighbours.clear();
412 myRegionPos->m_CaloSampleNeighbours = std::move(neighbours);
413 myRegionPos->m_CaloSampleEtaMin.clear();
414 myRegionPos->m_CaloSampleEtaMin = std::move(CaloEtaMinVector);
415 myRegionPos->m_CaloSampleEtaMax.clear();
416 myRegionPos->m_CaloSampleEtaMax = std::move(CaloEtaMaxVector);
417 // hash index of first DM identifier for this DM region
418 myRegionPos->m_region_id = id_side_pos;
419 myRegionPos->m_region_hash = hash_side_pos;
420
421 // Now making DM region for negative side
422 CaloDmRegion *myRegionNeg = new CaloDmRegion(*myRegionPos);
423 myRegionNeg->m_side = -1 * myRegionPos->m_side;
424 myRegionNeg->m_eta_min = -1 * myRegionPos->m_eta_max;
425 myRegionNeg->m_eta_max = -1 * myRegionPos->m_eta_min;
426 myRegionNeg->m_region_id = id_side_neg;
427 myRegionNeg->m_region_hash = hash_side_neg;
428 myRegionNeg->m_CaloSampleEtaMin.clear();
429 myRegionNeg->m_CaloSampleEtaMax.clear();
430 for(unsigned int i=0; i<myRegionPos->m_CaloSampleNeighbours.size(); i++){
431 myRegionNeg->m_CaloSampleEtaMin.push_back( -1.0 * myRegionPos->m_CaloSampleEtaMax[i] );
432 myRegionNeg->m_CaloSampleEtaMax.push_back( -1.0 * myRegionPos->m_CaloSampleEtaMin[i] );
433 }
434
435 // filling vectors
436 if(subdet == 4) {
437 m_DmRegionVector[m_caloDM_ID->lar_region_hash(id_side_neg)] = myRegionNeg;
438 m_DmRegionVector[m_caloDM_ID->lar_region_hash(id_side_pos)] = myRegionPos;
439 } else if (subdet == 5){
440 int shift_reg = m_caloDM_ID->lar_region_hash_max();
441 m_DmRegionVector[shift_reg + m_caloDM_ID->tile_region_hash(id_side_neg)] = myRegionNeg;
442 m_DmRegionVector[shift_reg + m_caloDM_ID->tile_region_hash(id_side_pos)] = myRegionPos;
443 }
444 // skipping region description
445 while(fin.getline(cLine,sizeof(cLine)-1)) {
446 if(cLine[0] == '}') break;
447 }
448 } else {
449 std::cout << "CaloDmDescrManager::load_regions() -> Fromat ERROR in line '" << sLine << "'" << std::endl;
450 return StatusCode::FAILURE;
451 }
452 } // while over lines in file
453 fin.close();
454
455 log << MSG::INFO << "Loaded " << m_DmRegionVector.size() << " LAr+Tile dead material regions from " << file << endmsg;
456
457// std::vector<CaloDmRegion *>::const_iterator it = reg_begin();
458// int i_reg = 0;
459// for(; it!=reg_end(); it++){
460// const CaloDmRegion *myRegion = (*it);
461// std::cout << i_reg << " key: " << myRegion->m_key
462// << " side: " << myRegion->m_side
463// << " neta X nphi: " << myRegion->netaMax() << " X " << myRegion->nphiMax()
464// << " eta:min/max/deta: " << myRegion->etaMin() << " / " << myRegion->etaMax() << " / " << myRegion->deta()
465// << " hash_id: " << myRegion->region_hash()
466// << " " << m_id_helper->show_to_string(myRegion->region_id())
467// << std::endl;
468// for(unsigned int i_smp=0; i_smp<myRegion->m_CaloSampleNeighbours.size(); i_smp++){
469// std::cout << " i_smp: " << i_smp << " smp: " << myRegion->m_CaloSampleNeighbours[i_smp] << " smp_eta_min_max: " << myRegion->m_CaloSampleEtaMin[i_smp] << " " << myRegion->m_CaloSampleEtaMax[i_smp] << std::endl;
470// }
471// }
472
473 return StatusCode::SUCCESS;
474}
#define endmsg
#define MAX_BUFFER_LEN
static CaloCell_ID::CaloSample get_calo_sample(const std::string &SamplingName)
IdentifierHash m_region_hash
std::vector< short > m_CaloSampleNeighbours
Identifier m_region_id
std::vector< float > m_CaloSampleEtaMin
std::vector< float > m_CaloSampleEtaMax
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
IMessageSvc * getMessageSvc(bool quiet=false)
TFile * file

◆ reg_begin()

std::vector< CaloDmRegion * >::const_iterator CaloDmDescrManager::reg_begin ( void ) const
inline

Definition at line 169 of file CaloDmDescrManager.h.

170{
171 return(m_DmRegionVector.begin());
172}

◆ reg_end()

std::vector< CaloDmRegion * >::const_iterator CaloDmDescrManager::reg_end ( void ) const
inline

Definition at line 174 of file CaloDmDescrManager.h.

175{
176 return(m_DmRegionVector.end());
177}

◆ show_element()

void CaloDmDescrManager::show_element ( const Identifier & cellId) const

Definition at line 95 of file CaloDmDescrManager.cxx.

96{
97 const CaloDmDescrElement *element = get_element(cellId);
98 std::cout << "CaloDmDescrManager::check_element() -> Your identifier " << m_id_helper->show_to_string(cellId);
99 element->print();
100}

Member Data Documentation

◆ m_caloDM_ID

const CaloDM_ID* CaloDmDescrManager::m_caloDM_ID
private

Definition at line 155 of file CaloDmDescrManager.h.

◆ m_detStore

ServiceHandle<StoreGateSvc> CaloDmDescrManager::m_detStore
private

Definition at line 157 of file CaloDmDescrManager.h.

◆ m_DmElementVector

std::vector<CaloDmDescrElement *> CaloDmDescrManager::m_DmElementVector
private

Definition at line 164 of file CaloDmDescrManager.h.

◆ m_DmRegionVector

std::vector<CaloDmRegion *> CaloDmDescrManager::m_DmRegionVector
private

Definition at line 163 of file CaloDmDescrManager.h.

◆ m_id_helper

const AtlasDetectorID* CaloDmDescrManager::m_id_helper
private

Definition at line 156 of file CaloDmDescrManager.h.


The documentation for this class was generated from the following files: