Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CaloDmDescrManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /* ****************************************************************************
6  Filename : CaloDmDescrManager.cxx
7  Author : guennadi.pospelov@cern.ch
8  Created : March, 2007
9  DESCRIPTION : dead material identifiers description package
10  Usage:
11  const CaloDmDescrManager *mgr = CaloDmDescrManager::instance();
12  CaloDmDescrElement *element = mgr->get_element(dm_identifier);
13  Enjoy with element->eta(), element->phi().
14 **************************************************************************** */
18 
19 #include "GaudiKernel/IMessageSvc.h"
20 #include "StoreGate/StoreGateSvc.h"
22 
25 
26 #include <cmath>
27 #include <fstream>
28 #include <iostream>
29 #include <string>
30 #include <string_view>
31 #include <vector>
32 
33 #define MAX_BUFFER_LEN 1024
34 #undef DEBUG
35 
36 /* **************************************************************************
37 
38 ************************************************************************** */
40  : m_caloDM_ID (nullptr),
41  m_id_helper (nullptr),
42  m_detStore ("DetectorStore", "CaloDmDescrManager")
43 {
44  initialize();
45 }
46 
47 
48 
49 /* **************************************************************************
50 
51 ************************************************************************** */
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 }
61 
62 
63 
64 /* **************************************************************************
65 
66 ************************************************************************** */
68 {
69  static const CaloDmDescrManager s_instance;
70  return &s_instance;
71 }
72 
73 
74 /* **************************************************************************
75 
76 ************************************************************************** */
78 {
79  const std::string& name = "CaloDmDescrManager";
80  CHECK_WITH_CONTEXT( m_detStore.retrieve(), name, 1);
83  CHECK_WITH_CONTEXT( load_regions("DeadMaterialRegionDescription_1.10c.txt"), name, 1);
84 
86 
87  return 0;
88 }
89 
90 
91 
92 /* **************************************************************************
93 
94 ************************************************************************** */
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 }
101 
102 
103 
104 /* **************************************************************************
105 Get description element for dead material id.
106 ************************************************************************** */
108 {
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) ) {
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 }
125 
126 
127 
128 /* **************************************************************************
129 Calculate dead material region 'key' number from identifier iof the dead
130 material calibration hit
131 ************************************************************************** */
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 }
140 
141 
142 
143 /* **************************************************************************
144 return dead material area number, where area is a collection of dm hits in
145 some detector regions
146 ************************************************************************** */
148 {
149  int key = get_dm_key(cellId);
150  CaloDmDescrElement *el = get_element(cellId);
151  return CaloDmDescrArea::getArea(key, el->eta());
152 }
153 
154 
155 
156 /* **************************************************************************
157 Get DM region for DM hit identifier
158 ************************************************************************** */
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) ) {
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 }
178 
179 
180 
181 /* **************************************************************************
182 For given eta, phi coordinate and CaloDmRegion returns hash identifier of
183 appropriate dead material calibration hit
184 ************************************************************************** */
185 IdentifierHash CaloDmDescrManager::get_dm_hash(const CaloDmRegion *myRegion, float &eta, float &phi) const
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) ) {
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 }
246 
247 
248 
249 /* **************************************************************************
250 Build vector of elements (eta, phi, deta, dphi) for all dead material id's
251 Total size of vector will be
252 m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash_max()
253 ************************************************************************** */
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 
264 
265  // loop over all DM LAr identifiers
266  for(unsigned int i=0; i<m_caloDM_ID->lar_zone_hash_max(); 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++) {
275  Identifier id_reg = m_caloDM_ID->region_id(id);
278  }
279 }
280 
281 
282 
283 /* **************************************************************************
284 Create element corresponded to given DM id.
285 ************************************************************************** */
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 }
312 
313 
314 
315 /* **************************************************************************
316 Load private Dead Material Regions definition from text file
317 ************************************************************************** */
318 StatusCode CaloDmDescrManager::load_regions(const std::string& DmRegionFileName)
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 
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 = neighbours;
413  myRegionPos->m_CaloSampleEtaMin.clear();
414  myRegionPos->m_CaloSampleEtaMin = CaloEtaMinVector;
415  myRegionPos->m_CaloSampleEtaMax.clear();
416  myRegionPos->m_CaloSampleEtaMax = 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 }
475 
476 
477 
478 /* **************************************************************************
479 To get calo_sample number from calo_sample name
480 ************************************************************************** */
482 {
483  if ( SamplingName == "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" ) {
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 }
536 
537 
538 
539 /* **************************************************************************
540 To get calo_sample number and eta values from calo_sample string
541  - "PreSamplerB(0.0,1.5)" -> CaloCell_ID::PreSamplerB, 0.0, 1.5
542 ************************************************************************** */
543 CaloCell_ID::CaloSample CaloDmDescrManager::get_calo_sample(const std::string &SamplingName, float &etaMin, float &etaMax)
544 {
546  if ( SamplingName.find("PreSamplerB") != std::string::npos ) {
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 ) {
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 }
CaloDmRegion::m_CaloSampleEtaMin
std::vector< float > m_CaloSampleEtaMin
Definition: CaloDmDescrManager.h:107
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
CaloDmDescrManager::show_element
void show_element(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:95
CaloDM_ID::dmat
int dmat(const Identifier &id) const
return DMtype according to :
Definition: CaloDM_ID.h:669
CHECK_WITH_CONTEXT
#define CHECK_WITH_CONTEXT(...)
Evaluate an expression and check for errors, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:396
CaloDmRegion::m_deta
float m_deta
Definition: CaloDmDescrManager.h:102
CaloCell_ID_FCS::TileExt2
@ TileExt2
Definition: FastCaloSim_CaloCell_ID.h:39
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
CaloDmRegion::etaMax
float etaMax() const
Definition: CaloDmDescrManager.h:115
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
CaloDM_ID::lar_region_hash_max
size_type lar_region_hash_max(void) const
lar region hash table max size
Definition: CaloDM_ID.h:566
CaloDmDescrManager::get_element
CaloDmDescrElement * get_element(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:107
CaloDM_ID::lar_zone_hash_max
size_type lar_zone_hash_max(void) const
lar zone hash table max size
Definition: CaloDM_ID.h:572
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloDmRegion::nphiMax
int nphiMax() const
Definition: CaloDmDescrManager.h:119
CaloCell_ID_FCS::TileExt0
@ TileExt0
Definition: FastCaloSim_CaloCell_ID.h:37
CaloCell_ID_FCS::TileBar1
@ TileBar1
Definition: FastCaloSim_CaloCell_ID.h:32
CaloDM_ID::region
int region(const Identifier &id) const
return region according to :
Definition: CaloDM_ID.h:651
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
CaloDmDescrManager::build_element_vector
void build_element_vector()
Definition: CaloDmDescrManager.cxx:254
CaloDM_ID::lar_region_hash
IdentifierHash lar_region_hash(Identifier LArRegionId) const
create a lar hash id from region id
Definition: CaloDM_ID.h:532
CaloDM_ID::tile_zone_id
Identifier tile_zone_id(IdentifierHash tile_zone_hash_id) const
create a tile zone id from hash id
Definition: CaloDM_ID.h:526
CaloDmRegion::netaMax
int netaMax() const
Definition: CaloDmDescrManager.h:118
M_PI
#define M_PI
Definition: ActiveFraction.h:11
CaloCell_ID_FCS::FCAL1
@ FCAL1
Definition: FastCaloSim_CaloCell_ID.h:41
CaloDmDescrElement::print
void print() const
Definition: CaloDmDescrManager.h:52
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
CaloDmDescrManager::m_id_helper
const AtlasDetectorID * m_id_helper
Definition: CaloDmDescrManager.h:156
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
CaloDmDescrManager::load_regions
StatusCode load_regions(const std::string &DmRegionFileName)
Definition: CaloDmDescrManager.cxx:318
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
CaloDmRegion::m_region_id
Identifier m_region_id
Definition: CaloDmDescrManager.h:94
CaloDmDescrManager::CaloDmDescrManager
CaloDmDescrManager()
Definition: CaloDmDescrManager.cxx:39
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
CaloDmRegion::region_id
const Identifier region_id() const
Definition: CaloDmDescrManager.h:113
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
CaloDmDescrManager::get_dm_region
CaloDmRegion * get_dm_region(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:159
CaloCell_ID.h
CaloDmDescrManager::instance
static const CaloDmDescrManager * instance()
Definition: CaloDmDescrManager.cxx:67
CaloDmRegion::m_isBarrel
bool m_isBarrel
Definition: CaloDmDescrManager.h:105
CaloDmRegion::m_region_hash
IdentifierHash m_region_hash
Definition: CaloDmDescrManager.h:95
MAX_BUFFER_LEN
#define MAX_BUFFER_LEN
Definition: CaloDmDescrManager.cxx:33
CaloCell_ID_FCS::HEC1
@ HEC1
Definition: FastCaloSim_CaloCell_ID.h:28
CaloDM_ID::tile_region_hash_max
size_type tile_region_hash_max(void) const
tile region hash table max size
Definition: CaloDM_ID.h:578
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
CaloDmRegion
Definition: CaloDmDescrManager.h:79
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloDmDescrManager.h
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
z
#define z
CaloCell_ID_FCS::TileBar0
@ TileBar0
Definition: FastCaloSim_CaloCell_ID.h:31
CaloDmRegion::deta
float deta() const
Definition: CaloDmDescrManager.h:116
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloCell_ID_FCS::TileGap2
@ TileGap2
Definition: FastCaloSim_CaloCell_ID.h:35
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
CaloDM_ID::pos_neg_z
int pos_neg_z(const Identifier &id) const
return pos_neg_z according to :
Definition: CaloDM_ID.h:639
file
TFile * file
Definition: tile_monitor.h:29
CaloDmDescrManager
Definition: CaloDmDescrManager.h:131
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
CaloDM_ID::is_lar
bool is_lar(const Identifier &zoneId) const
to disentangle between LAr and Tile dead material
Definition: CaloDM_ID.h:496
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
CaloDmDescrManager::m_DmElementVector
std::vector< CaloDmDescrElement * > m_DmElementVector
Definition: CaloDmDescrManager.h:164
python.xAODType.dummy
dummy
Definition: xAODType.py:4
CaloDmRegion::m_dphi
float m_dphi
Definition: CaloDmDescrManager.h:103
CaloDmRegion::m_eta_max
float m_eta_max
Definition: CaloDmDescrManager.h:101
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
CaloDmDescrElement
Definition: CaloDmDescrManager.h:33
CaloDM_ID::tile_zone_hash
IdentifierHash tile_zone_hash(Identifier TileZoneId) const
create a tile hash id from zone id
Definition: CaloDM_ID.h:559
CaloDmDescrManager::get_calo_sample
static CaloCell_ID::CaloSample get_calo_sample(const std::string &SamplingName)
Definition: CaloDmDescrManager.cxx:481
CaloDmDescrManager::~CaloDmDescrManager
~CaloDmDescrManager()
Definition: CaloDmDescrManager.cxx:52
CaloCell_ID_FCS::TileGap1
@ TileGap1
Definition: FastCaloSim_CaloCell_ID.h:34
CaloDM_ID.h
CaloDmRegion::m_CaloSampleEtaMax
std::vector< float > m_CaloSampleEtaMax
Definition: CaloDmDescrManager.h:108
CaloDM_ID::region_id
Identifier region_id(int pos_neg_z, int dmat, int sampling, int region) const
build a region identifier valid for both LAr and Tiles
Definition: CaloDM_ID.h:415
PathResolver.h
CaloDmRegion::m_nphi_max
int m_nphi_max
Definition: CaloDmDescrManager.h:99
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CaloCell_ID_FCS::TileExt1
@ TileExt1
Definition: FastCaloSim_CaloCell_ID.h:38
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CaloDM_ID::tile_region_hash
IdentifierHash tile_region_hash(Identifier TileRegionId) const
create a tile hash id from region id
Definition: CaloDM_ID.h:542
CaloDmDescrManager::get_dm_hash
IdentifierHash get_dm_hash(const CaloDmRegion *myRegion, float &eta, float &phi) const
Definition: CaloDmDescrManager.cxx:185
CaloDM_ID::sampling
int sampling(const Identifier &id) const
return sampling according to :
Definition: CaloDM_ID.h:645
CaloDmDescrManager::get_dm_key
int get_dm_key(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:132
CaloDmDescrManager::m_caloDM_ID
const CaloDM_ID * m_caloDM_ID
Definition: CaloDmDescrManager.h:155
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
CaloDmRegion::dphi
float dphi() const
Definition: CaloDmDescrManager.h:117
CaloDmRegion::etaMin
float etaMin() const
Definition: CaloDmDescrManager.h:114
CaloDM_ID::lar_zone_hash
IdentifierHash lar_zone_hash(Identifier LArZoneId) const
create a lar hash id from zone id
Definition: CaloDM_ID.h:552
CaloDM_ID::eta
int eta(const Identifier &id) const
return eta
Definition: CaloDM_ID.h:657
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:350
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
CaloDM_ID::lar_zone_id
Identifier lar_zone_id(IdentifierHash lar_zone_hash_id) const
create a lar zone id from hash id
Definition: CaloDM_ID.h:520
CaloDmDescrManager::initialize
int initialize()
Definition: CaloDmDescrManager.cxx:77
CaloDM_ID::phi
int phi(const Identifier &id) const
return phi
Definition: CaloDM_ID.h:663
CaloDmDescrManager::build_element
CaloDmDescrElement * build_element(const Identifier &cellId, const CaloDmRegion *myRegion)
Definition: CaloDmDescrManager.cxx:286
CaloDmRegion::m_side
int m_side
Definition: CaloDmDescrManager.h:97
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CaloDmDescrManager::m_DmRegionVector
std::vector< CaloDmRegion * > m_DmRegionVector
Definition: CaloDmDescrManager.h:163
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
CaloDmRegion::m_key
int m_key
Definition: CaloDmDescrManager.h:96
CaloDM_ID::is_tile
bool is_tile(const Identifier &zoneId) const
to disentangle between LAr and Tile dead material
Definition: CaloDM_ID.h:502
compute_lumi.fin
fin
Definition: compute_lumi.py:19
CaloDmDescrManager::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: CaloDmDescrManager.h:157
CaloDM_ID::tile_zone_hash_max
size_type tile_zone_hash_max(void) const
tile zone hash table max size
Definition: CaloDM_ID.h:584
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
CaloDmRegion::m_eta_min
float m_eta_min
Definition: CaloDmDescrManager.h:100
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloDM_ID::zone_id
Identifier zone_id(int pos_neg_z, int dat, int sampling, int region, int eta, int phi) const
build a zone identifier valid for both LAr and Tiles
Definition: CaloDM_ID.h:463
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
StoreGateSvc.h
CaloCell_ID_FCS::TileBar2
@ TileBar2
Definition: FastCaloSim_CaloCell_ID.h:33
CaloDmRegion::m_CaloSampleNeighbours
std::vector< short > m_CaloSampleNeighbours
Definition: CaloDmDescrManager.h:106
CaloDmRegion::m_distance
float m_distance
Definition: CaloDmDescrManager.h:104
CaloDmRegion::m_neta_max
int m_neta_max
Definition: CaloDmDescrManager.h:98
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
fitman.rho
rho
Definition: fitman.py:532
CaloDmDescrManager::get_dm_area
int get_dm_area(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:147
CaloDmDescrArea::getArea
static int getArea(const int &dmkey, const float &eta)
Definition: CaloDmDescrArea.cxx:25
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Identifier
Definition: IdentifierFieldParser.cxx:14