ATLAS Offline Software
CaloDmDescrManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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 **************************************************************************** */
17 
18 #include "GaudiKernel/Bootstrap.h"
19 #include "GaudiKernel/ISvcLocator.h"
20 #include "GaudiKernel/IMessageSvc.h"
21 #include "StoreGate/StoreGateSvc.h"
23 
26 
27 #include <cmath>
28 #include <fstream>
29 #include <iostream>
30 #include <string>
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 {
43  initialize();
44 }
45 
46 
47 
48 /* **************************************************************************
49 
50 ************************************************************************** */
52 {
53  for(unsigned int i = 0; i<m_DmRegionVector.size(); i++) delete m_DmRegionVector[i];
54  m_DmRegionVector.clear();
55 
56  for(unsigned int i = 0; i<m_DmElementVector.size(); i++) delete m_DmElementVector[i];
57  m_DmElementVector.clear();
58 
59 }
60 
61 
62 
63 /* **************************************************************************
64 
65 ************************************************************************** */
67 {
68  static const CaloDmDescrManager s_instance;
69  return &s_instance;
70 }
71 
72 
73 /* **************************************************************************
74 
75 ************************************************************************** */
77 {
78  MsgStream log(Athena::getMessageSvc(), "CaloDmDescrManager");
79 
80  ISvcLocator* svcLoc = Gaudi::svcLocator();
81  StatusCode sc = svcLoc->service("DetectorStore", m_detStore);
82  if ( sc.isFailure() ) {
83  log << MSG::ERROR
84  << "Unable to get pointer to StoreGate Service" << endmsg;
85  return 1;
86  }
87 
89  if (sc.isFailure() || !m_caloDM_ID) {
90  log << MSG::ERROR
91  << "Unable to retrieve caloDM_ID helper from DetectorStore" << endmsg;
92  return 1;
93  }
94 
96  if (sc.isFailure()) {
97  log << MSG::ERROR
98  << "Unable to retrieve AtlasDetectorID helper from DetectorStore" << endmsg;
99  return 1;
100  }
101 
102  // m_caloDM_ID->set_do_checks(true);
103  m_DmRegionFileName = "DeadMaterialRegionDescription_1.10c.txt";
105  if (sc.isFailure()) {
106  log << MSG::ERROR
107  << "Unable to load DM regions from '" << m_DmRegionFileName << "' file."<< endmsg;
108  return 1;
109  }
110 
112 
113  return 0;
114 }
115 
116 
117 
118 /* **************************************************************************
119 
120 ************************************************************************** */
122 {
123  const CaloDmDescrElement *element = get_element(cellId);
124  std::cout << "CaloDmDescrManager::check_element() -> Your identifier " << m_id_helper->show_to_string(cellId);
125  element->print();
126 }
127 
128 
129 
130 /* **************************************************************************
131 Get description element for dead material id.
132 ************************************************************************** */
134 {
136  if( m_caloDM_ID->is_lar(cellId) ) {
137  hash = m_caloDM_ID->lar_zone_hash(cellId);
138  } else if ( m_caloDM_ID->is_tile(cellId) ) {
140  } else {
141  std::cout << "CaloDmDescrManager::get_element-> Error! Wrong dead material identifier! " << m_id_helper->show_to_string(cellId) << std::endl;
142  return nullptr;
143  }
144  if(hash < m_DmElementVector.size()) {
145  return m_DmElementVector[hash];
146  } else {
147  std::cout << "CaloDmDescrManager::get_element-> Error! Bad hash id for dead material identifier " << hash << std::endl;
148  return nullptr;
149  }
150 }
151 
152 
153 
154 /* **************************************************************************
155 Calculate dead material region 'key' number from identifier iof the dead
156 material calibration hit
157 ************************************************************************** */
159 {
160  int subdet = m_caloDM_ID->pos_neg_z(cellId);
161  int type = m_caloDM_ID->dmat(cellId);
162  int sampling = m_caloDM_ID->sampling(cellId);
163  int region = m_caloDM_ID->region(cellId);
164  return abs(subdet)*1000+type*100+sampling*10+region;
165 }
166 
167 
168 
169 /* **************************************************************************
170 return dead material area number, where area is a collection of dm hits in
171 some detector regions
172 ************************************************************************** */
174 {
175  int key = get_dm_key(cellId);
176  CaloDmDescrElement *el = get_element(cellId);
177  return CaloDmDescrArea::getArea(key, el->eta());
178 }
179 
180 
181 
182 /* **************************************************************************
183 Get DM region for DM hit identifier
184 ************************************************************************** */
186 {
187  Identifier id_reg = m_caloDM_ID->region_id(cellId);
188  IdentifierHash hash_reg;
189  if( m_caloDM_ID->is_lar(cellId) ) {
190  hash_reg = m_caloDM_ID->lar_region_hash(id_reg);
191  } else if ( m_caloDM_ID->is_tile(cellId) ) {
193  } else {
194  std::cout << "CaloDmDescrManager::get_dm_region-> Error! Wrong dead material identifier! " << m_id_helper->show_to_string(cellId) << std::endl;
195  return nullptr;
196  }
197  if(hash_reg < m_DmRegionVector.size()) {
198  return m_DmRegionVector[hash_reg];
199  } else {
200  std::cout << "CaloDmDescrManager::get_dm_region-> Error! Bad region hash id!" << m_id_helper->show_to_string(cellId) << std::endl;
201  return nullptr;
202  }
203 }
204 
205 
206 
207 /* **************************************************************************
208 For given eta, phi coordinate and CaloDmRegion returns hash identifier of
209 appropriate dead material calibration hit
210 ************************************************************************** */
211 IdentifierHash CaloDmDescrManager::get_dm_hash(const CaloDmRegion *myRegion, float &eta, float &phi) const
212 {
213  IdentifierHash id_hash;
214 
215  if(eta < myRegion->etaMin() || eta >= myRegion->etaMax()) {
216 #ifdef DEBUG
217  std::cout << " input eta out of range"
218  << " eta: " << eta
219  << " myRegion->m_key: " << myRegion->m_key
220  << " myRegion->etaMin(): " << myRegion->etaMin()
221  << " myRegion->etaMax(): " << myRegion->etaMax()
222  << std::endl;
223 #endif
224  return 0xFFFFFFFF;
225  }
226  int neta;
227  neta=int((eta-myRegion->etaMin())/myRegion->deta());
228  if(myRegion->m_side < 0) {
229  neta = myRegion->netaMax() - neta - 1;
230  }
231  float xphi=phi;
232  if(xphi<0.0) xphi=2*M_PI+xphi;
233  int nphi= int(xphi/myRegion->dphi());
234 #ifdef DEBUG
235  std::cout << " key: " << myRegion->m_key
236  << " side: " << myRegion->m_side
237  << " etaMin: " << myRegion->etaMin()
238  << " phiMax: " << myRegion->etaMax()
239  << " neta: " << neta
240  << " nphi: " << nphi
241  << " myRegion->netaMax(): " << myRegion->netaMax()
242  << " myRegion->nphiMax(): " << myRegion->nphiMax()
243  << std::endl;
244 #endif
245  if( (neta >=0 && neta < myRegion->netaMax()) && (nphi >=0 && nphi < myRegion->nphiMax()) ) {
246  Identifier id = m_caloDM_ID->zone_id(myRegion->region_id(), neta, nphi);
247  if( m_caloDM_ID->is_lar(id) ) {
248  id_hash = m_caloDM_ID->lar_zone_hash(id);
249  } else if ( m_caloDM_ID->is_tile(id) ) {
251  }else{
252  std::cout << "CaloDmDescrManager::get_dm_hash() -> ERROR! p1." << std::endl;
253  return 0xFFFFFFFF;
254  }
255  } else{
256  std::cout << "CaloDmDescrManager::get_dm_hash() -> ERROR! p2."
257  << " key: " << myRegion->m_key
258  << " side: " << myRegion->m_side
259  << " myRegion->etaMin(): " << myRegion->etaMin()
260  << " myRegion->etaMax(): " << myRegion->etaMax()
261  << " myRegion->deta(): " << myRegion->deta()
262  << " eta: " << eta
263  << " phi: " << phi
264  << " neta: " << neta
265  << " nphi: " << nphi
266  << " myRegion->netaMax(): " << myRegion->netaMax()
267  << " myRegion->nphiMax(): " << myRegion->nphiMax()
268  << std::endl;
269  }
270  return id_hash;
271 }
272 
273 
274 
275 /* **************************************************************************
276 Build vector of elements (eta, phi, deta, dphi) for all dead material id's
277 Total size of vector will be
278 m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash_max()
279 ************************************************************************** */
281 {
282  if(!m_DmElementVector.empty()) {
283  std::cout << "CaloDmDescrManager::build_element_list() -> Warning! Non empty list."
284  << " m_DmElementVector.size(): " << m_DmElementVector.size()
285  << std::endl;
286  return;
287  }
288 
290 
291  // loop over all DM LAr identifiers
292  for(unsigned int i=0; i<m_caloDM_ID->lar_zone_hash_max(); i++) {
294  Identifier id_reg = m_caloDM_ID->region_id(id);
295  IdentifierHash hash_reg = m_caloDM_ID->lar_region_hash(id_reg);
297  }
298  // loop over tile identifier
299  for(unsigned int i=0; i<m_caloDM_ID->tile_zone_hash_max(); i++) {
301  Identifier id_reg = m_caloDM_ID->region_id(id);
304  }
305 }
306 
307 
308 
309 /* **************************************************************************
310 Create element corresponded to given DM id.
311 ************************************************************************** */
313 {
314  int neta = m_caloDM_ID->eta(id);
315  int nphi = m_caloDM_ID->phi(id);
316  int subdet = m_caloDM_ID->pos_neg_z(id);
317  float eta;
318  if(subdet>0){
319  eta = myRegion->etaMin() + (0.5+neta)*myRegion->deta();
320  } else {
321  eta = myRegion->etaMax() - (0.5+neta)*myRegion->deta();
322  }
323  float phi = myRegion->m_dphi*(0.5+nphi);
324  if(phi > M_PI) phi -= 2*M_PI; // we need to have phi=-M_PI,M_PI
325  float theta = 2.*std::atan(std::exp(-eta));
326  float rho, z;
327  if(myRegion->m_isBarrel) {
328  rho=myRegion->m_distance*0.1;
329  z=rho/std::abs(std::tan(theta));
330  }else{
331  z=myRegion->m_distance*0.1;
332  rho=z*std::abs(std::tan(theta));
333  }
334  // building new element which will containt real eta, phi values for this identifier
335  CaloDmDescrElement *element = new CaloDmDescrElement(eta, myRegion->m_deta, phi, myRegion->m_dphi, rho, z);
336  return element;
337 }
338 
339 
340 
341 /* **************************************************************************
342 Load private Dead Material Regions definition from text file
343 ************************************************************************** */
344 StatusCode CaloDmDescrManager::load_regions(const std::string& DmRegionFileName)
345 {
346  MsgStream log(Athena::getMessageSvc(), "CaloDmDescrManager");
347 
348  char cLine[MAX_BUFFER_LEN];
349 
350  if(!m_DmRegionVector.empty()) {
351  log << MSG::WARNING << "CaloDmDescrManager::build_element_list() -> Warning! Non empty list."
352  << " m_DmRegionVector.size(): " << m_DmRegionVector.size()
353  << endmsg;
354  return StatusCode::FAILURE;
355  }
356 
357  // Find the full path to filename:
358  std::string file = PathResolver::find_file (DmRegionFileName, "DATAPATH");
359  log << MSG::INFO << "Reading file " << file << endmsg;
360 
361  std::ifstream fin(file.c_str());
362  if(!fin){
363  log << MSG::ERROR << "Can't open file " << file << endmsg;
364  return StatusCode::FAILURE;
365  }
366 
368  std::string sLine;
369  while(fin.getline(cLine,sizeof(cLine)-1)){
370  if( strlen(cLine)==0 || cLine[0] == '#' || cLine[0] == '\n') continue;
371  sLine = std::string(cLine);
372  std::istringstream mypars( sLine.c_str() );
373 
374  int key, distance, isBarrel;
375  float etamin, etamax, deta, dphi;
376  if(mypars >> key >> etamin >> etamax >> deta >> dphi >> distance >> isBarrel) {
377  fin.getline(cLine,sizeof(cLine)-1);
378  sLine = std::string(cLine);
379  std::istringstream mynei( sLine.c_str() );
380  std::string sKey;
381  std::vector<short> neighbours;
382  std::vector<float> CaloEtaMinVector;
383  std::vector<float> CaloEtaMaxVector;
384  while (mynei >> sKey) {
385  if(sKey.find("CaloSampleNeighbors") != std::string::npos) continue;
386  if(sKey.find("Unknown") != std::string::npos) continue;
387  float caloEtaMin, caloEtaMax;
388  CaloCell_ID::CaloSample nsmp = get_calo_sample(sKey, caloEtaMin, caloEtaMax);
389  if(nsmp != CaloCell_ID::Unknown) {
390  neighbours.push_back((int)nsmp);
391  CaloEtaMinVector.push_back(caloEtaMin);
392  CaloEtaMaxVector.push_back(caloEtaMax);
393  } else {
394  std::cout << "CaloDmDescrManager::load_regions() -> Fromat ERROR in line '" << sLine << "', key '" << sKey << "'" << std::endl;
395  return StatusCode::FAILURE;
396  }
397  } // while over sKey
398 
399  int subdet=key/1000;
400  int type=(key-subdet*1000)/100;
401  int sampling=(key-subdet*1000-type*100)/10;
402  int region=(key-subdet*1000-type*100-sampling*10)/1;
403  if(subdet != 4 && subdet !=5) {
404  log << MSG::ERROR << " Error! Wrong subdet " << subdet << ". Format error in line '" << sLine << "', key '" << sKey << "'" << std::endl;
405  return StatusCode::FAILURE;
406  }
407 
408  Identifier id_side_neg = m_caloDM_ID->region_id(-subdet, type, sampling, region);
409  Identifier id_side_pos = m_caloDM_ID->region_id(subdet, type, sampling, region);
410 
411  IdentifierHash hash_side_neg;
412  IdentifierHash hash_side_pos;
413  if(subdet == 4) {
414  // lar region
415  hash_side_neg = m_caloDM_ID->lar_zone_hash(id_side_neg);
416  hash_side_pos = m_caloDM_ID->lar_zone_hash(id_side_pos);
417  } else if (subdet == 5){
418  // tile region has shifted position in our vectors
419  hash_side_neg = m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash(id_side_neg);
420  hash_side_pos = m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash(id_side_pos);
421  }
422 
423  // Making DM region for positive side
424  CaloDmRegion *myRegionPos = new CaloDmRegion();
425  myRegionPos->m_key=key;
426  myRegionPos->m_side=1;
427  myRegionPos->m_eta_min=etamin;
428  myRegionPos->m_eta_max=etamax;
429  myRegionPos->m_deta=deta;
430  myRegionPos->m_neta_max=int((etamax-etamin)/deta+0.00001);
431  myRegionPos->m_dphi=dphi*(M_PI/3.2);
432  myRegionPos->m_nphi_max=int(M_PI*2./myRegionPos->m_dphi+0.00001);
433  myRegionPos->m_distance=distance;
434  myRegionPos->m_isBarrel=true;
435  if(!isBarrel) myRegionPos->m_isBarrel=false;
436  // assigning of information over neighboring calo samplings for this DM region
437  myRegionPos->m_CaloSampleNeighbours.clear();
438  myRegionPos->m_CaloSampleNeighbours = neighbours;
439  myRegionPos->m_CaloSampleEtaMin.clear();
440  myRegionPos->m_CaloSampleEtaMin = CaloEtaMinVector;
441  myRegionPos->m_CaloSampleEtaMax.clear();
442  myRegionPos->m_CaloSampleEtaMax = CaloEtaMaxVector;
443  // hash index of first DM identifier for this DM region
444  myRegionPos->m_region_id = id_side_pos;
445  myRegionPos->m_region_hash = hash_side_pos;
446 
447  // Now making DM region for negative side
448  CaloDmRegion *myRegionNeg = new CaloDmRegion(*myRegionPos);
449  myRegionNeg->m_side = -1 * myRegionPos->m_side;
450  myRegionNeg->m_eta_min = -1 * myRegionPos->m_eta_max;
451  myRegionNeg->m_eta_max = -1 * myRegionPos->m_eta_min;
452  myRegionNeg->m_region_id = id_side_neg;
453  myRegionNeg->m_region_hash = hash_side_neg;
454  myRegionNeg->m_CaloSampleEtaMin.clear();
455  myRegionNeg->m_CaloSampleEtaMax.clear();
456  for(unsigned int i=0; i<myRegionPos->m_CaloSampleNeighbours.size(); i++){
457  myRegionNeg->m_CaloSampleEtaMin.push_back( -1.0 * myRegionPos->m_CaloSampleEtaMax[i] );
458  myRegionNeg->m_CaloSampleEtaMax.push_back( -1.0 * myRegionPos->m_CaloSampleEtaMin[i] );
459  }
460 
461  // filling vectors
462  if(subdet == 4) {
463  m_DmRegionVector[m_caloDM_ID->lar_region_hash(id_side_neg)] = myRegionNeg;
464  m_DmRegionVector[m_caloDM_ID->lar_region_hash(id_side_pos)] = myRegionPos;
465  } else if (subdet == 5){
466  int shift_reg = m_caloDM_ID->lar_region_hash_max();
467  m_DmRegionVector[shift_reg + m_caloDM_ID->tile_region_hash(id_side_neg)] = myRegionNeg;
468  m_DmRegionVector[shift_reg + m_caloDM_ID->tile_region_hash(id_side_pos)] = myRegionPos;
469  }
470  // skipping region description
471  while(fin.getline(cLine,sizeof(cLine)-1)) {
472  if(cLine[0] == '}') break;
473  }
474  } else {
475  std::cout << "CaloDmDescrManager::load_regions() -> Fromat ERROR in line '" << sLine << "'" << std::endl;
476  return StatusCode::FAILURE;
477  }
478  } // while over lines in file
479  fin.close();
480 
481  log << MSG::INFO << "Loaded " << m_DmRegionVector.size() << " LAr+Tile dead material regions from " << file << endmsg;
482 
483 // std::vector<CaloDmRegion *>::const_iterator it = reg_begin();
484 // int i_reg = 0;
485 // for(; it!=reg_end(); it++){
486 // const CaloDmRegion *myRegion = (*it);
487 // std::cout << i_reg << " key: " << myRegion->m_key
488 // << " side: " << myRegion->m_side
489 // << " neta X nphi: " << myRegion->netaMax() << " X " << myRegion->nphiMax()
490 // << " eta:min/max/deta: " << myRegion->etaMin() << " / " << myRegion->etaMax() << " / " << myRegion->deta()
491 // << " hash_id: " << myRegion->region_hash()
492 // << " " << m_id_helper->show_to_string(myRegion->region_id())
493 // << std::endl;
494 // for(unsigned int i_smp=0; i_smp<myRegion->m_CaloSampleNeighbours.size(); i_smp++){
495 // 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;
496 // }
497 // }
498 
499  return StatusCode::SUCCESS;
500 }
501 
502 
503 
504 /* **************************************************************************
505 To get calo_sample number from calo_sample name
506 ************************************************************************** */
508 {
509  if ( SamplingName == "PreSamplerB" ) {
511  } else if ( SamplingName == "EMB1" ) {
512  return CaloCell_ID::EMB1;
513  } else if ( SamplingName == "EMB2" ) {
514  return CaloCell_ID::EMB2;
515  } else if ( SamplingName == "EMB3" ) {
516  return CaloCell_ID::EMB3;
517  } else if ( SamplingName == "PreSamplerE" ) {
519  } else if ( SamplingName == "EME1" ) {
520  return CaloCell_ID::EME1;
521  } else if ( SamplingName == "EME2" ) {
522  return CaloCell_ID::EME2;
523  } else if ( SamplingName == "EME3" ) {
524  return CaloCell_ID::EME3;
525  } else if ( SamplingName == "HEC0" ) {
526  return CaloCell_ID::HEC0;
527  }else if ( SamplingName == "HEC1" ) {
528  return CaloCell_ID::HEC1;
529  }else if ( SamplingName == "HEC2" ) {
530  return CaloCell_ID::HEC2;
531  }else if ( SamplingName == "HEC3" ) {
532  return CaloCell_ID::HEC3;
533  }else if ( SamplingName == "TileBar0" ) {
534  return CaloCell_ID::TileBar0;
535  }else if ( SamplingName == "TileBar1" ) {
536  return CaloCell_ID::TileBar1;
537  }else if ( SamplingName == "TileBar2" ) {
538  return CaloCell_ID::TileBar2;
539  }else if ( SamplingName == "TileGap1" ) {
540  return CaloCell_ID::TileGap1;
541  }else if ( SamplingName == "TileGap2" ) {
542  return CaloCell_ID::TileGap2;
543  }else if ( SamplingName == "TileGap3" ) {
544  return CaloCell_ID::TileGap3;
545  }else if ( SamplingName == "TileExt0" ) {
546  return CaloCell_ID::TileExt0;
547  }else if ( SamplingName == "TileExt1" ) {
548  return CaloCell_ID::TileExt1;
549  }else if ( SamplingName == "TileExt2" ) {
550  return CaloCell_ID::TileExt2;
551  }else if ( SamplingName == "FCAL0" ) {
552  return CaloCell_ID::FCAL0;
553  }else if ( SamplingName == "FCAL1" ) {
554  return CaloCell_ID::FCAL1;
555  }else if ( SamplingName == "FCAL2" ) {
556  return CaloCell_ID::FCAL2;
557  }
558  std::cout << "Calorimeter sampling '" << SamplingName
559  << "' is not a valid Calorimeter sampling name and will be ignored! " << std::endl;
560  return CaloCell_ID::Unknown;
561 }
562 
563 
564 
565 /* **************************************************************************
566 To get calo_sample number and eta values from calo_sample string
567  - "PreSamplerB(0.0,1.5)" -> CaloCell_ID::PreSamplerB, 0.0, 1.5
568 ************************************************************************** */
569 CaloCell_ID::CaloSample CaloDmDescrManager::get_calo_sample(const std::string &SamplingName, float &etaMin, float &etaMax)
570 {
572  if ( SamplingName.find("PreSamplerB") != std::string::npos ) {
574  } else if ( SamplingName.find("EMB1") != std::string::npos ) {
575  nsmp = CaloCell_ID::EMB1;
576  } else if ( SamplingName.find("EMB2") != std::string::npos ) {
577  nsmp = CaloCell_ID::EMB2;
578  } else if ( SamplingName.find("EMB3") != std::string::npos ) {
579  nsmp = CaloCell_ID::EMB3;
580  } else if ( SamplingName.find("PreSamplerE") != std::string::npos ) {
582  } else if ( SamplingName.find("EME1") != std::string::npos ) {
583  nsmp = CaloCell_ID::EME1;
584  } else if ( SamplingName.find("EME2") != std::string::npos ) {
585  nsmp = CaloCell_ID::EME2;
586  } else if ( SamplingName.find("EME3") != std::string::npos ) {
587  nsmp = CaloCell_ID::EME3;
588  } else if ( SamplingName.find("HEC0") != std::string::npos ) {
589  nsmp = CaloCell_ID::HEC0;
590  }else if ( SamplingName.find("HEC1") != std::string::npos ) {
591  nsmp = CaloCell_ID::HEC1;
592  }else if ( SamplingName.find("HEC2") != std::string::npos ) {
593  nsmp = CaloCell_ID::HEC2;
594  }else if ( SamplingName.find("HEC3") != std::string::npos ) {
595  nsmp = CaloCell_ID::HEC3;
596  }else if ( SamplingName.find("TileBar0") != std::string::npos ) {
597  nsmp = CaloCell_ID::TileBar0;
598  }else if ( SamplingName.find("TileBar1") != std::string::npos ) {
599  nsmp = CaloCell_ID::TileBar1;
600  }else if ( SamplingName.find("TileBar2") != std::string::npos ) {
601  nsmp = CaloCell_ID::TileBar2;
602  }else if ( SamplingName.find("TileGap1") != std::string::npos ) {
603  nsmp = CaloCell_ID::TileGap1;
604  }else if ( SamplingName.find("TileGap2") != std::string::npos ) {
605  nsmp = CaloCell_ID::TileGap2;
606  }else if ( SamplingName.find("TileGap3") != std::string::npos ) {
607  nsmp = CaloCell_ID::TileGap3;
608  }else if ( SamplingName.find("TileExt0") != std::string::npos ) {
609  nsmp = CaloCell_ID::TileExt0;
610  }else if ( SamplingName.find("TileExt1") != std::string::npos ) {
611  nsmp = CaloCell_ID::TileExt1;
612  }else if ( SamplingName.find("TileExt2") != std::string::npos ) {
613  nsmp = CaloCell_ID::TileExt2;
614  }else if ( SamplingName.find("FCAL0") != std::string::npos ) {
615  nsmp = CaloCell_ID::FCAL0;
616  }else if ( SamplingName.find("FCAL1") != std::string::npos ) {
617  nsmp = CaloCell_ID::FCAL1;
618  }else if ( SamplingName.find("FCAL2") != std::string::npos ) {
619  nsmp = CaloCell_ID::FCAL2;
620  }else {
621  std::cout << "CaloDmDescrManager::get_calo_sample() -> Calorimeter sampling '" << SamplingName
622  << "' is not a valid Calorimeter sampling name and will be ignored! " << std::endl;
623  return CaloCell_ID::Unknown;
624  }
625  char dummy;
626  if(SamplingName.find('(') == std::string::npos || SamplingName.find(')') != SamplingName.size()-1 ){
627  std::cout << "CaloDmDescrManager::get_calo_sample() -> Can't parse calorimeter sampling '" << SamplingName << "' string! Something with brackets..." << std::endl;
628  return CaloCell_ID::Unknown;
629  }
630  std::string sEtaRange(SamplingName,SamplingName.find('(')+1);
631  std::istringstream iEtaRange( sEtaRange.c_str() );
632  if(iEtaRange >> etaMin >> dummy >> etaMax) {
633  return nsmp;
634  }else{
635  std::cout << "CaloDmDescrManager::get_calo_sample() -> Can't parse calorimeter sampling '" << SamplingName << "' string!" << std::endl;
636  return CaloCell_ID::Unknown;
637  }
638 }
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:121
CaloDM_ID::dmat
int dmat(const Identifier &id) const
return DMtype according to :
Definition: CaloDM_ID.h:669
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:64
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:133
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
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
CaloDmDescrManager::m_detStore
StoreGateSvc * m_detStore
Definition: CaloDmDescrManager.h:159
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:71
CaloDmDescrManager::build_element_vector
void build_element_vector()
Definition: CaloDmDescrManager.cxx:280
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:158
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
CaloDmDescrManager::load_regions
StatusCode load_regions(const std::string &DmRegionFileName)
Definition: CaloDmDescrManager.cxx:344
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
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:185
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CaloCell_ID.h
CaloDmDescrManager::instance
static const CaloDmDescrManager * instance()
Definition: CaloDmDescrManager.cxx:66
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
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:92
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
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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
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:166
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:507
CaloDmDescrManager::~CaloDmDescrManager
~CaloDmDescrManager()
Definition: CaloDmDescrManager.cxx:51
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
CaloCell_ID_FCS::TileExt1
@ TileExt1
Definition: FastCaloSim_CaloCell_ID.h:38
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
CaloDmDescrManager::m_DmRegionFileName
std::string m_DmRegionFileName
Definition: CaloDmDescrManager.h:150
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:211
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:158
CaloDmDescrManager::m_caloDM_ID
const CaloDM_ID * m_caloDM_ID
Definition: CaloDmDescrManager.h:157
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:574
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:76
CaloDM_ID::phi
int phi(const Identifier &id) const
return phi
Definition: CaloDM_ID.h:663
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloDmDescrManager::build_element
CaloDmDescrElement * build_element(const Identifier &cellId, const CaloDmRegion *myRegion)
Definition: CaloDmDescrManager.cxx:312
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:165
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
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
Definition: IdentifierHash.h:38
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:173
CaloDmDescrArea::getArea
static int getArea(const int &dmkey, const float &eta)
Definition: CaloDmDescrArea.cxx:25
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37