ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CaloDetDescrManager_Base Class Reference

#include <CaloDetDescrManager.h>

Inheritance diagram for CaloDetDescrManager_Base:
Collaboration diagram for CaloDetDescrManager_Base:

Public Types

typedef std::vector< CaloDetDescrElement * > calo_element_vec
 
typedef calo_element_vec::size_type calo_element_vec_size
 
typedef CaloConstIteratorAdaptor< calo_element_vec::const_iterator > calo_element_const_iterator
 
typedef boost::iterator_range< calo_element_const_iteratorcalo_element_range
 
typedef calo_element_vec::const_iterator calo_nonconst_element_const_iterator
 
typedef boost::iterator_range< calo_nonconst_element_const_iteratorcalo_nonconst_element_range
 
typedef std::vector< CaloDetDescriptor * > calo_descr_vec
 
typedef calo_descr_vec::size_type calo_descr_size
 
typedef CaloConstIteratorAdaptor< calo_descr_vec::const_iterator > calo_descr_const_iterator
 
typedef boost::iterator_range< calo_descr_const_iteratorcalo_descr_range
 
typedef calo_descr_vec::const_iterator calo_nonconst_descr_const_iterator
 
typedef boost::iterator_range< calo_nonconst_descr_const_iteratorcalo_nonconst_descr_range
 

Public Member Functions

 CaloDetDescrManager_Base ()
 Default Constructor. More...
 
 ~CaloDetDescrManager_Base ()
 destructor More...
 
void initialize ()
 initialization of the manager, used by the Converter when it creates the Manager More...
 
void print () const
 print out the contents More...
 
bool isInitialized () const
 for backwards compatibility only More...
 
const std::string & lar_geometry () const
 get lar geometry label, distinguish between full atlas and TB More...
 
void set_lar_geometry (const std::string &geom)
 set lar geometry label, distinguish between full atlas and TB More...
 
const CaloCell_Base_IDgetCaloCell_ID () const
 get calo cell ID helper More...
 
const CaloIdManagergetCalo_Mgr () const
 get calo ID manager More...
 
calo_element_vec_size element_size () const
 total number of elements More...
 
calo_element_const_iterator element_begin () const
 first element More...
 
calo_element_const_iterator element_end () const
 end of element vector More...
 
calo_element_range element_range () const
 Range over element vector. More...
 
calo_element_const_iterator element_begin (CaloCell_ID::SUBCALO subCalo) const
 first element in subcalo More...
 
calo_element_const_iterator element_end (CaloCell_ID::SUBCALO subCalo) const
 end of subcalo element list More...
 
calo_element_range element_range (CaloCell_ID::SUBCALO subCalo) const
 Range over subcalo element list. More...
 
calo_nonconst_element_range element_range_nonconst ()
 Range over element vector, with non-const elements. More...
 
const CaloDetDescrElementget_element (const Identifier &cellId) const
 get element by its identifier More...
 
CaloDetDescrElementget_element_nonconst (const Identifier &cellId)
 get element by its identifier, non-const version. More...
 
const CaloDetDescrElementget_element (IdentifierHash caloCellHash) const
 get element by hash identifier More...
 
CaloDetDescrElementget_element_nonconst (IdentifierHash caloCellHash)
 get element by hash identifier, non-const version. More...
 
const CaloDetDescrElementget_element (CaloCell_ID::SUBCALO subCalo, IdentifierHash subCaloCellHash) const
 get element by subcalo and hash identifier More...
 
const CaloDetDescrElementget_element (CaloCell_ID::SUBCALO subCalo, int sampling_or_module, bool barrel, double eta, double phi) const
 LAr only! get element by subcalo, sampling, barrel flag, eta, phi. More...
 
const CaloDetDescrElementget_element (CaloCell_ID::CaloSample sample, double eta, double phi) const
 LAr only! get element by sample, eta phi. More...
 
const CaloDetDescrElementget_element_raw (CaloCell_ID::CaloSample sample, double eta, double phi) const
 Get element from raw quantities (to build real fixed size clusters) More...
 
void cellsInZone (double eta_min, double eta_max, double phi_min, double phi_max, std::vector< IdentifierHash > &cell_list) const
 the only client is CaloCellList class More...
 
void cellsInZone (double eta_min, double eta_max, double phi_min, double phi_max, CaloCell_ID::SUBCALO subCalo, std::vector< IdentifierHash > &cell_list) const
 the only client is CaloCellList class More...
 
void cellsInZone (double eta_min, double eta_max, double phi_min, double phi_max, CaloCell_ID::CaloSample sample, std::vector< IdentifierHash > &cell_list) const
 the only client is CaloCellList class More...
 
void cellsInZone (double eta_min, double eta_max, double phi_min, double phi_max, CaloCell_ID::SUBCALO subCalo, int sampling_or_module, std::vector< IdentifierHash > &cell_list) const
 the only client is CaloCellList class More...
 
void cellsInZone (double eta, double phi, int ncell_eta, int ncell_phi, CaloCell_ID::SUBCALO subCalo, int sampling_or_module, bool barrel, std::vector< IdentifierHash > &cell_list) const
 the only client is CaloCellList class More...
 
void cellsInZone (double eta_min, double eta_max, double phi_min, double phi_max, const CaloDetDescriptor *descr, std::vector< IdentifierHash > &cell_list) const
 the only client is CaloCellList class More...
 
bool is_in (double eta, double phi, CaloCell_ID::CaloSample sample, double &etadist) const
 return true if direction eta,phi crosses ANY of the corresponding descriptors More...
 
calo_descr_const_iterator calo_descriptors_begin () const
 first descriptor in the vector More...
 
calo_descr_const_iterator calo_descriptors_end () const
 end of descriptors vector More...
 
calo_descr_size calo_descriptors_size () const
 number of descriptors More...
 
calo_descr_range calo_descriptors_range () const
 Range over descriptors. More...
 
calo_nonconst_descr_range calo_descriptors_range_nonconst ()
 Range over descriptors, with non-const elements. More...
 
const CaloDetDescriptorget_descriptor (const Identifier &regionId) const
 get descriptor by region identifier More...
 
CaloDetDescriptorget_descriptor_nonconst (const Identifier &regionId)
 get descriptor by region identifier, non-const version. More...
 
const CaloDetDescriptorget_descriptor (CaloCell_ID::SUBCALO subCalo, int sampling_or_module, bool barrel, double eta, double phi) const
 get descriptor by subcalo, sampling, barrel flag, eta, phi More...
 
const CaloDetDescriptorget_descriptor (CaloCell_ID::CaloSample sample, double eta, double phi) const
 get descriptor by sample, eta and phi More...
 
const CaloDetDescriptorget_descriptor_raw (CaloCell_ID::CaloSample sample, double eta, double phi) const
 get descriptor by sample, eta and phi raw More...
 
calo_descr_const_iterator tile_descriptors_begin () const
 first tile descriptor (they are in separate vector) More...
 
calo_descr_const_iterator tile_descriptors_end () const
 end of tile descriptors vector More...
 
calo_descr_size tile_descriptors_size () const
 number of tile descriptors More...
 
calo_descr_range tile_descriptors_range () const
 Range over tile descriptors. More...
 
calo_nonconst_descr_range tile_descriptors_range_nonconst ()
 Range over tile descriptors, with non-const elements. More...
 
void set_helper (const CaloCell_Base_ID *idHelper)
 set calo Cell ID helper More...
 
void set_helper (const CaloIdManager *idHelper)
 set calo ID Manager Helper More...
 
void add (CaloDetDescrElement *element)
 add Calo DD element to the elements vector More...
 
void add (CaloDetDescriptor *descr)
 add new LAr descriptor to the descriptors vector Takes ownership of the object. More...
 
void add (std::unique_ptr< CaloDetDescriptor > descr)
 add new LAr descriptor to the descriptors vector More...
 
void add_tile (CaloDetDescriptor *descr)
 add tile descriptor to the tile descriptors vector More...
 

Static Public Member Functions

static void build_sample (CaloCell_ID::SUBCALO subCalo, bool barrel, int sampling_or_module, CaloCell_ID::CaloSample &sample)
 translate between the 2 ways to label a sub-detector: More...
 
static void decode_sample (CaloCell_ID::SUBCALO &subCalo, bool &barrel, int &sampling_or_module, CaloCell_ID::CaloSample sample)
 translate between the 2 ways to label a sub-detector: More...
 

Private Member Functions

CaloDetDescrElementrelease_element (IdentifierHash hash)
 
const CaloDetDescrElementget_element_FCAL (const CaloDetDescriptor *reg, double eta, double phi) const
 LArFCAl private methode to get element. More...
 
const CaloDetDescrElementget_element_FCAL_raw (const CaloDetDescriptor *reg, double eta, double phi) const
 LArFCAl private methode to get element from raw eta,phi. More...
 

Private Attributes

const CaloCell_Base_IDm_cell_id
 Calo Cell ID helper. More...
 
const CaloIdManagerm_calo_mgr
 Calo ID Manager helper. More...
 
calo_element_vec m_element_vec
 vector of Calo DD elements More...
 
calo_descr_vec m_descr_vec
 vector of descriptors More...
 
std::vector< IdentifierHashm_subCalo_min
 offsets for subcalo's elements More...
 
std::vector< IdentifierHashm_subCalo_max
 offsets for subcalo's elements More...
 
std::vector< calo_element_const_iteratorm_subCalo_begin
 offsets for subcalo's elements More...
 
std::vector< calo_element_const_iteratorm_subCalo_end
 offsets for subcalo's elements More...
 
calo_descr_vec m_tile_descr_vec
 vector of descriptors More...
 
std::string m_lar_geometry
 LAr geometry label (full atlas/TB) for backwards compatibility. More...
 

Friends

class CaloCellPacker_400_500_test
 Helper for CaloCompactCellTool_test. More...
 

Detailed Description

Definition at line 146 of file CaloDetDescrManager.h.

Member Typedef Documentation

◆ calo_descr_const_iterator

Definition at line 324 of file CaloDetDescrManager.h.

◆ calo_descr_range

Definition at line 325 of file CaloDetDescrManager.h.

◆ calo_descr_size

typedef calo_descr_vec::size_type CaloDetDescrManager_Base::calo_descr_size

Definition at line 322 of file CaloDetDescrManager.h.

◆ calo_descr_vec

Definition at line 321 of file CaloDetDescrManager.h.

◆ calo_element_const_iterator

Definition at line 185 of file CaloDetDescrManager.h.

◆ calo_element_range

Definition at line 186 of file CaloDetDescrManager.h.

◆ calo_element_vec

Definition at line 182 of file CaloDetDescrManager.h.

◆ calo_element_vec_size

typedef calo_element_vec::size_type CaloDetDescrManager_Base::calo_element_vec_size

Definition at line 183 of file CaloDetDescrManager.h.

◆ calo_nonconst_descr_const_iterator

typedef calo_descr_vec::const_iterator CaloDetDescrManager_Base::calo_nonconst_descr_const_iterator

Definition at line 329 of file CaloDetDescrManager.h.

◆ calo_nonconst_descr_range

Definition at line 330 of file CaloDetDescrManager.h.

◆ calo_nonconst_element_const_iterator

typedef calo_element_vec::const_iterator CaloDetDescrManager_Base::calo_nonconst_element_const_iterator

Definition at line 189 of file CaloDetDescrManager.h.

◆ calo_nonconst_element_range

Definition at line 190 of file CaloDetDescrManager.h.

Constructor & Destructor Documentation

◆ CaloDetDescrManager_Base()

CaloDetDescrManager_Base::CaloDetDescrManager_Base ( )

Default Constructor.

Definition at line 29 of file CaloDetDescrManager.cxx.

29  :
30  m_cell_id(nullptr),
31  m_calo_mgr(nullptr)
32 {
33 }

◆ ~CaloDetDescrManager_Base()

CaloDetDescrManager_Base::~CaloDetDescrManager_Base ( )

destructor

Definition at line 35 of file CaloDetDescrManager.cxx.

36 {
37  unsigned tile_min = m_subCalo_min[CaloCell_ID::TILE];
38  unsigned tile_max = m_subCalo_max[CaloCell_ID::TILE];
39  for (size_t i = 0; i < m_element_vec.size(); i++) {
40  // Tile elements are deleted by TileDetDescrManager.
41  if (i >= tile_min && i < tile_max) continue;
42  delete m_element_vec[i];
43  }
44 
45  for (size_t i = 0; i < m_descr_vec.size(); i++)
46  delete m_descr_vec[i];
47 }

Member Function Documentation

◆ add() [1/3]

void CaloDetDescrManager_Base::add ( CaloDetDescrElement element)

add Calo DD element to the elements vector

Definition at line 755 of file CaloDetDescrManager.cxx.

756 {
757  m_element_vec[element->calo_hash()] = element;
758 }

◆ add() [2/3]

void CaloDetDescrManager_Base::add ( CaloDetDescriptor descr)

add new LAr descriptor to the descriptors vector Takes ownership of the object.

For new code, prefer the next version that takes a unique_ptr.

Definition at line 760 of file CaloDetDescrManager.cxx.

761 {
762  m_descr_vec[descr->calo_hash()] = descr;
763 }

◆ add() [3/3]

void CaloDetDescrManager_Base::add ( std::unique_ptr< CaloDetDescriptor descr)

add new LAr descriptor to the descriptors vector

Definition at line 765 of file CaloDetDescrManager.cxx.

766 {
767  IdentifierHash idhash = descr->calo_hash();
768  m_descr_vec[idhash] = descr.release();
769 }

◆ add_tile()

void CaloDetDescrManager_Base::add_tile ( CaloDetDescriptor descr)

add tile descriptor to the tile descriptors vector

Definition at line 771 of file CaloDetDescrManager.cxx.

772 {
773  m_tile_descr_vec.push_back(descr);
774 }

◆ build_sample()

void CaloDetDescrManager_Base::build_sample ( CaloCell_ID::SUBCALO  subCalo,
bool  barrel,
int  sampling_or_module,
CaloCell_ID::CaloSample sample 
)
static

translate between the 2 ways to label a sub-detector:

Definition at line 1425 of file CaloDetDescrManager.cxx.

1429 {
1430  if ( subCalo == CaloCell_ID::LAREM ) {
1431  if ( barrel ) {
1432  if (sampling_or_module == 0) sample = CaloCell_ID::PreSamplerB;
1433  if (sampling_or_module == 1) sample = CaloCell_ID::EMB1;
1434  if (sampling_or_module == 2) sample = CaloCell_ID::EMB2;
1435  if (sampling_or_module == 3) sample = CaloCell_ID::EMB3;
1436  } else {
1437  if (sampling_or_module == 0) sample = CaloCell_ID::PreSamplerE;
1438  if (sampling_or_module == 1) sample = CaloCell_ID::EME1;
1439  if (sampling_or_module == 2) sample = CaloCell_ID::EME2;
1440  if (sampling_or_module == 3) sample = CaloCell_ID::EME3;
1441  }
1442  return;
1443  }
1444  else if ( subCalo == CaloCell_ID::LARHEC ) {
1445  if (sampling_or_module == 0) sample = CaloCell_ID::HEC0;
1446  if (sampling_or_module == 1) sample = CaloCell_ID::HEC1;
1447  if (sampling_or_module == 2) sample = CaloCell_ID::HEC2;
1448  if (sampling_or_module == 3) sample = CaloCell_ID::HEC3;
1449  }
1450  else if ( subCalo == CaloCell_ID::LARFCAL ) {
1451  if (sampling_or_module == 0) sample = CaloCell_ID::FCAL0;
1452  if (sampling_or_module == 1) sample = CaloCell_ID::FCAL1;
1453  if (sampling_or_module == 2) sample = CaloCell_ID::FCAL2;
1454  }
1455  else if ( subCalo == CaloCell_ID::TILE ) {
1456  // For Tiles sampling_or_module has a different meaning :
1457  // assume the client meant the entrance of the Tiles and ignore the gap
1458  if ( barrel )
1460  else
1462  }
1463  else
1465 
1466 }

◆ calo_descriptors_begin()

CaloDetDescrManager_Base::calo_descr_const_iterator CaloDetDescrManager_Base::calo_descriptors_begin ( ) const

first descriptor in the vector

Definition at line 517 of file CaloDetDescrManager.cxx.

518 {
519  return m_descr_vec.begin();
520 }

◆ calo_descriptors_end()

CaloDetDescrManager_Base::calo_descr_const_iterator CaloDetDescrManager_Base::calo_descriptors_end ( ) const

end of descriptors vector

Definition at line 523 of file CaloDetDescrManager.cxx.

524 {
525  return m_descr_vec.end();
526 }

◆ calo_descriptors_range()

CaloDetDescrManager_Base::calo_descr_range CaloDetDescrManager_Base::calo_descriptors_range ( ) const

Range over descriptors.

Definition at line 535 of file CaloDetDescrManager.cxx.

536 {
537  return {m_descr_vec.begin(), m_descr_vec.end()};
538 }

◆ calo_descriptors_range_nonconst()

CaloDetDescrManager_Base::calo_nonconst_descr_range CaloDetDescrManager_Base::calo_descriptors_range_nonconst ( )

Range over descriptors, with non-const elements.

Definition at line 541 of file CaloDetDescrManager.cxx.

542 {
543  return {m_descr_vec.begin(), m_descr_vec.end()};
544 }

◆ calo_descriptors_size()

CaloDetDescrManager_Base::calo_descr_size CaloDetDescrManager_Base::calo_descriptors_size ( ) const

number of descriptors

Definition at line 529 of file CaloDetDescrManager.cxx.

530 {
531  return m_descr_vec.size();
532 }

◆ cellsInZone() [1/6]

void CaloDetDescrManager_Base::cellsInZone ( double  eta,
double  phi,
int  ncell_eta,
int  ncell_phi,
CaloCell_ID::SUBCALO  subCalo,
int  sampling_or_module,
bool  barrel,
std::vector< IdentifierHash > &  cell_list 
) const

the only client is CaloCellList class

Definition at line 979 of file CaloDetDescrManager.cxx.

984 {
985 
986  cell_list.clear();
987  double eta_min, eta_max, phi_min, phi_max;
988  double weta = (ncell_eta-1)/2.;
989  double wphi = (ncell_phi-1)/2.;
990 
991  std::vector<IdentifierHash> one_list;
992 
993  if ( subCalo != CaloCell_ID::TILE ) {
994 
995  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
997  if ( reg ) {
998  Identifier regId = reg->identify();
999  if ( subCalo == reg->getSubCalo() &&
1000  m_cell_id->sampling(regId) == sampling_or_module) {
1001 
1002  double eta_gran = m_cell_id->etaGranularity(regId);
1003  double phi_gran = m_cell_id->phiGranularity(regId);
1004 
1005  eta_min = eta-weta*eta_gran;
1006  eta_max = eta+weta*eta_gran;
1007  phi_min = phi-wphi*phi_gran;
1008  phi_max = phi+wphi*phi_gran;
1009  cellsInZone(eta_min, eta_max, phi_min, phi_max, reg, one_list);
1010  cell_list.reserve (cell_list.size() + one_list.size());
1011  for ( unsigned int i = 0; i<one_list.size(); i++ ){
1012  // I know that cellsInZone catches more cells than needed
1013  // => look and cut
1014  const CaloDetDescrElement* elt = get_element (one_list[i]);
1015  double elt_eta = elt->eta();
1016  double elt_phi = elt->phi();
1017  if ( barrel == elt->is_lar_em_barrel() )
1018  if ( std::abs(eta - elt_eta) <= weta )
1019  if ( std::abs(phi - elt_phi) <= wphi )
1020  cell_list.push_back(one_list[i]);
1021  }
1022  }
1023  }
1024  }
1025  }
1026  else {
1027 
1028  // For Tiles loop on elements :
1029  // loosy logic. since I do not know the grannularity in the
1030  // region, I use the one of each element. Hum...
1031  const CaloDetDescrElement* tile_elt;
1032  for ( unsigned int i = m_subCalo_min[subCalo];
1033  i < m_subCalo_max[subCalo]; i++ ) {
1034  tile_elt = m_element_vec[i];
1035  if (tile_elt) {
1036  eta_min = eta-weta*tile_elt->deta();
1037  eta_max = eta+weta*tile_elt->deta();
1038 
1039  if ( tile_elt->eta()+tile_elt->deta()/2. > eta_min &&
1040  tile_elt->eta()-tile_elt->deta()/2. < eta_max) {
1041  phi_min = phi-wphi*tile_elt->dphi();
1042  phi_max = phi+wphi*tile_elt->dphi();
1043  double dphi1 = CaloPhiRange::diff(tile_elt->phi()+tile_elt->dphi()/2.,phi_min);
1044  double dphi2 = CaloPhiRange::diff(phi_max,tile_elt->phi()-tile_elt->dphi()/2);
1045 
1046  if(dphi1 >=0. && dphi2 >= 0. ) {
1047  if (cell_list.empty()) {
1048  // Guess a good size, incl 3 samplings.
1049  cell_list.reserve (static_cast<int> (
1050  ((eta_max-eta_min) / tile_elt->deta()) *
1051  ((phi_max-phi_min) / tile_elt->dphi()) * 3));
1052  }
1053  cell_list.push_back(tile_elt->calo_hash());
1054  } // phi cut
1055  } // eta cut
1056  } // tile elt exisits
1057  }
1058  }
1059 
1060 }

◆ cellsInZone() [2/6]

void CaloDetDescrManager_Base::cellsInZone ( double  eta_min,
double  eta_max,
double  phi_min,
double  phi_max,
CaloCell_ID::CaloSample  sample,
std::vector< IdentifierHash > &  cell_list 
) const

the only client is CaloCellList class

Definition at line 877 of file CaloDetDescrManager.cxx.

881 {
882  cell_list.clear();
883  if ( eta_min >= eta_max ) return;
884  if ( phi_min >= phi_max ) return;
885 
886  std::vector<IdentifierHash> one_list;
887 
888  if ( sample != CaloCell_ID::TileBar0 &&
897 
898  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
900  if ( reg )
901  // this works only for LAr, for Tiles the sampling depends on the
902  // cell
903  if ( sample == reg->getSampling(0) ) {
904  cellsInZone(eta_min, eta_max, phi_min, phi_max, reg, one_list);
905  if (cell_list.empty())
906  cell_list.swap (one_list);
907  else
908  cell_list.insert (cell_list.end(),
909  one_list.begin(), one_list.end());
910  }
911  }
912 
913  } else {
914 
915  // For Tiles loop on elements :
916  int nb = CaloCell_ID::TILE;
917  const CaloDetDescrElement* tile_elt;
918 
919  for ( unsigned int i = m_subCalo_min[nb]; i < m_subCalo_max[nb]; i++ ) {
920  tile_elt = m_element_vec[i];
921  if (tile_elt ){
922  if (tile_elt->getSampling() == sample) {
923 
924  if ( tile_elt->eta()+tile_elt->deta()/2. > eta_min &&
925  tile_elt->eta()-tile_elt->deta()/2. < eta_max) {
926 
927  double dphi1 = CaloPhiRange::diff(tile_elt->phi()+tile_elt->dphi()/2.,phi_min);
928  double dphi2 = CaloPhiRange::diff(phi_max,tile_elt->phi()-tile_elt->dphi()/2);
929 
930  if(dphi1 >=0. && dphi2 >= 0.) {
931  if (cell_list.empty()) {
932  // Guess a good size, incl 3 samplings.
933  cell_list.reserve (static_cast<int>(
934  ((eta_max-eta_min) / tile_elt->deta()) *
935  ((phi_max-phi_min) / tile_elt->dphi()) * 3));
936  }
937  cell_list.push_back(tile_elt->calo_hash());
938  } // phi cut
939  } // eta cut
940  } // sampling cut
941  } // tile_elt exists
942  }
943  }
944 }

◆ cellsInZone() [3/6]

void CaloDetDescrManager_Base::cellsInZone ( double  eta_min,
double  eta_max,
double  phi_min,
double  phi_max,
CaloCell_ID::SUBCALO  subCalo,
int  sampling_or_module,
std::vector< IdentifierHash > &  cell_list 
) const

the only client is CaloCellList class

Definition at line 946 of file CaloDetDescrManager.cxx.

951 {
952  cell_list.clear();
953  if ( eta_min >= eta_max ) return;
954  if ( phi_min >= phi_max ) return;
955 
956  // sampling_or_module has no meaning for tiles
957  if ( subCalo == CaloCell_ID::TILE ) return;
958 
959  std::vector<IdentifierHash> one_list;
960 
961  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
963  if ( reg ) {
964  Identifier regId = reg->identify();
965  if ( subCalo == reg->getSubCalo() &&
966  m_cell_id->sampling(regId) == sampling_or_module ) {
967  cellsInZone(eta_min, eta_max, phi_min, phi_max, reg, one_list);
968  if (cell_list.empty())
969  cell_list.swap (one_list);
970  else
971  cell_list.insert (cell_list.end(),
972  one_list.begin(), one_list.end());
973  }
974  }
975  }
976 }

◆ cellsInZone() [4/6]

void CaloDetDescrManager_Base::cellsInZone ( double  eta_min,
double  eta_max,
double  phi_min,
double  phi_max,
CaloCell_ID::SUBCALO  subCalo,
std::vector< IdentifierHash > &  cell_list 
) const

the only client is CaloCellList class

Definition at line 820 of file CaloDetDescrManager.cxx.

824 {
825  cell_list.clear();
826  if ( eta_min >= eta_max ) return;
827  if ( phi_min >= phi_max ) return;
828 
829  std::vector<IdentifierHash> one_list;
830 
831 
832  if ( subCalo != CaloCell_ID::TILE ) {
833 
834  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
836  if ( reg )
837  if ( subCalo == reg->getSubCalo() ) {
838  cellsInZone(eta_min, eta_max, phi_min, phi_max, reg, one_list);
839  if (cell_list.empty())
840  cell_list.swap (one_list);
841  else
842  cell_list.insert (cell_list.end(),
843  one_list.begin(), one_list.end());
844  }
845  }
846 
847  } else {
848 
849  // For Tiles loop on elements :
850  const CaloDetDescrElement* tile_elt;
851  for ( unsigned int i = m_subCalo_min[subCalo];
852  i < m_subCalo_max[subCalo]; i++ ) {
853  tile_elt = m_element_vec[i];
854  if (tile_elt) {
855 
856  if ( tile_elt->eta()+tile_elt->deta()/2. > eta_min &&
857  tile_elt->eta()-tile_elt->deta()/2. < eta_max) {
858 
859  double dphi1 = CaloPhiRange::diff(tile_elt->phi()+tile_elt->dphi()/2.,phi_min);
860  double dphi2 = CaloPhiRange::diff(phi_max,tile_elt->phi()-tile_elt->dphi()/2);
861 
862  if(dphi1 >=0. && dphi2 >= 0.) {
863  if (cell_list.empty()) {
864  // Guess a good size, incl 3 samplings.
865  cell_list.reserve (static_cast<int>(
866  ((eta_max-eta_min) / tile_elt->deta()) *
867  ((phi_max-phi_min) / tile_elt->dphi()) * 3));
868  }
869  cell_list.push_back(tile_elt->calo_hash());
870  } // phi cut
871  } // eta cut
872  } // tile_elt exits
873  }
874  }
875 }

◆ cellsInZone() [5/6]

void CaloDetDescrManager_Base::cellsInZone ( double  eta_min,
double  eta_max,
double  phi_min,
double  phi_max,
const CaloDetDescriptor descr,
std::vector< IdentifierHash > &  cell_list 
) const

the only client is CaloCellList class

Definition at line 1062 of file CaloDetDescrManager.cxx.

1066 {
1067 
1068  cell_list.clear();
1069 
1070  if ( ! descr ) return;
1071  if ( eta_min >= eta_max ) return;
1072 
1073 // FCAL case : explicit loop over all cells to account for the fact that eta and phi are not independent
1074 
1075  if (descr->is_lar_fcal()) {
1076  // std::cout << " in FCAl case descr etamin/max " << descr->reg_min() << " " << descr->reg_max() <<
1077  // " zone etamin/max " << eta_min << " " << eta_max << std::endl;
1078  if (descr->reg_min() > eta_max || descr->reg_max() < eta_min) return;
1079  Identifier regId = descr->identify();
1080  Identifier cellId;
1081  IdentifierHash caloCellHash;
1082  const CaloDetDescrElement* elt;
1083  IdentifierHash prevHash(0);
1084  // std::cout <<" neta,nphi " << descr->n_eta() << " " << descr->n_phi() << std::endl;
1085  for (int ieta=0; ieta<descr->n_eta(); ieta++) {
1086  for (int iphi=0; iphi<descr->n_phi(); iphi++) {
1087  cellId = m_cell_id->cell_id(regId, ieta, iphi);
1088  caloCellHash = m_cell_id->calo_cell_hash(cellId);
1089  // this is required because otherwise caloCellHash of unconnected channels with be the same as some connected channels (
1090  if (caloCellHash != prevHash) {
1091  prevHash=caloCellHash;
1092  elt = get_element (caloCellHash);
1093  if (elt) {
1094  if ( elt->eta()+elt->deta()/2. > eta_min &&
1095  elt->eta()-elt->deta()/2. < eta_max) {
1096 
1097  double dphi1 = CaloPhiRange::diff(elt->phi()+elt->dphi()/2.,phi_min);
1098  double dphi2 = CaloPhiRange::diff(phi_max,elt->phi()-elt->dphi()/2);
1099 
1100  if(dphi1 >=0. && dphi2 >= 0.) {
1101  cell_list.push_back(caloCellHash);
1102  //std::cout << " elt in ! eta= " << elt->eta() << " phi= " << elt->phi() << " " << ieta << " " << iphi << "hash Id " << caloCellHash << " id " << cellId << std::endl;
1103  } // phi cut
1104  } // eta cut
1105  } // if(elt)
1106  //else {
1107  // std::cout << " no FCAL elt for this cell " << ieta << " " << iphi << " " << cellId << " " << caloCellHash << std::endl;
1108  // }
1109  }
1110  } // loop over iphi
1111  } // loop over iea
1112  }
1113 
1114 // everything but FCAL
1115  else {
1116  if ( ! descr->is_in(eta_min,eta_max,phi_min,phi_max)) return;
1117 
1118  double zone_min = eta_min;
1119  double zone_max = eta_max;
1120  int ieta_min = 0;
1121  int ieta_max = 0;
1122 
1123  // loop will start at ieta_min-1 (included) and finish at ieta_max+1 (included)
1124  // ==> be careful at the edges of the descriptor.
1125  // check on which side we are ( for eta<0 channel ordering is swapped )
1126  if ( descr->calo_sign() > 0 ) {
1127 
1128  if ( descr->reg_min() >= zone_min ){
1129  zone_min = descr->reg_min();
1130  ieta_min = 1;
1131  //std::cout << " POS ! setting zone_min to reg_min = " << zone_min << " and ieta_min to " << ieta_min << std::endl;
1132  }
1133  else {
1134  ieta_min = descr->eta_channel(zone_min);
1135  if (ieta_min < 0)
1136  ieta_min = 1;
1137  }
1138 
1139  if ( descr->reg_max() <= zone_max ) {
1140  zone_max = descr->reg_max();
1141  ieta_max = descr->n_eta() -1;
1142  //std::cout << " POS ! setting zone_max to reg_max = " << zone_max << " and ieta_max to " << ieta_max << std::endl;
1143  }
1144  else {
1145  ieta_max = descr->eta_channel(zone_max);
1146  if (ieta_max < 1)
1147  ieta_max = descr->n_eta() - 1;
1148  }
1149 
1150  }
1151  else {
1152 
1153  if ( descr->reg_min() >= zone_min ){
1154  zone_min = descr->reg_min();
1155  ieta_max = descr->n_eta() - 1;
1156  //std::cout << " NEG ! setting zone_min to reg_min = " << zone_min << " and ieta_max to " << ieta_max << std::endl;
1157  }
1158  else {
1159  ieta_max = descr->eta_channel(zone_min);
1160  if (ieta_max < 1)
1161  ieta_max = descr->n_eta() - 1;
1162  }
1163 
1164  if ( descr->reg_max() <= zone_max ) {
1165  zone_max = descr->reg_max();
1166  ieta_min = 1 ;
1167  //std::cout << " NEG ! setting zone_max to reg_max = " << zone_max << " and ieta_min to " << ieta_min << std::endl;
1168  }
1169  else {
1170  ieta_min = descr->eta_channel(zone_max - 0.0001);
1171  if (ieta_min < 0)
1172  ieta_min = 1;
1173  }
1174 
1175  }
1176 
1177 
1178  // phi :
1179 
1180  // for a full detector, the window limits cannot be outside... BUT :
1181  // for zones where phi_min is < 0 and phi_max > 0 ( around 0 ),
1182  // or phi_max is < 0 ( around M_PI )
1183  // the channel number iphi_min is larger than iphi_max and
1184  // the search will have to be done in 2 steps.
1185 
1186  // for a subset ( H8 or H6 testbeams ), if the window is larger than the
1187  // module the min/max channel numbers will be -1 => mess in loops
1188  // ==> reduce the window size to the module size
1189 
1190 
1191  double zone_phi_min = CaloPhiRange::fix (phi_min);
1192  double zone_phi_max = CaloPhiRange::fix (phi_max);
1193 
1194  // *** *** *** TEST BEAM!!! *** *** ***
1195  if (m_lar_geometry == "H8" || m_lar_geometry == "H6") {
1196  double margin = descr->dphi()*0.1;
1197 
1198  // FIXME : ideal values are used here, this should NOT be !!!!
1199 
1200  if ( descr->calo_phi_min() > zone_phi_min) zone_phi_min = descr->calo_phi_min() + margin;
1201  if ( descr->calo_phi_max() < zone_phi_max) zone_phi_max = descr->calo_phi_max() - margin;
1202  }
1203 
1204  int iphi_min = descr->phi_channel(zone_phi_min);
1205  int iphi_max = descr->phi_channel(zone_phi_max);
1206 
1207 // add more safety in case of strips to protect against misalignment
1208  int reg_sampl=descr->getSampling(0);
1209  if (reg_sampl == CaloCell_ID::EMB1 || reg_sampl == CaloCell_ID::EME1) {
1210  ieta_min = ieta_min -1;
1211  ieta_max = ieta_max +1;
1212  }
1213 
1214 
1215  Identifier regId = descr->identify();
1216  Identifier cellId;
1217  IdentifierHash caloCellHash;
1218  const CaloDetDescrElement* elt;
1219 
1220 
1221  /*
1222  std::cout << " cellsInZone : eta ! reg " << descr->reg_min() << " " << descr->reg_max()
1223  << " zone " << zone_min << " " << zone_max
1224  << " channels " << ieta_min << " " << ieta_max << std::endl;
1225 
1226  std::cout << " cellsInZone : phi ! reg " << descr->calo_phi_min() << " " << descr->calo_phi_max()
1227  << " zone " << zone_phi_min << " " << zone_phi_max
1228  << " channels " << iphi_min << " " << iphi_max << std::endl;
1229  */
1230 
1231 
1232  int reg_EtaMin = m_cell_id->eta_min (regId);
1233  int reg_EtaMax = m_cell_id->eta_max (regId);
1234  int reg_PhiMin = m_cell_id->phi_min (regId);
1235  if (reg_PhiMin<0) reg_PhiMin=0; // catch case where it is not defined for Tile
1236  int reg_PhiMax = m_cell_id->phi_max (regId);
1237 
1238 
1239  if ( iphi_min <= iphi_max && zone_phi_min <= zone_phi_max ) {
1240 
1241  // The easy case : just make list a bit larger to avoid rounding effects
1242 
1243  for ( int ieta = ieta_min-1 ; ieta <= ieta_max+1; ieta++ )
1244  for ( int iphi = iphi_min-1 ; iphi <= iphi_max+1; iphi++ )
1245  {
1246  if (ieta>=reg_EtaMin && ieta <=reg_EtaMax && iphi>=reg_PhiMin && iphi<=reg_PhiMax) {
1247  cellId = m_cell_id->cell_id(regId, ieta, iphi);
1248  caloCellHash = m_cell_id->calo_cell_hash(cellId);
1249  elt = get_element (caloCellHash);
1250  //std::cout << " case 1 : for ieta = " << ieta << " iphi = " << iphi << std::endl;
1251  if (elt
1252  && ( (elt->eta()+elt->deta()/2.) > zone_min + 0.00001 )
1253  && ( (elt->eta()-elt->deta()/2.) + 0.00001 < zone_max )
1254  && ( (elt->phi()+elt->dphi()/2.) > zone_phi_min + 0.00001 )
1255  && ( (elt->phi()-elt->dphi()/2.) + 0.00001 < zone_phi_max ) )
1256  {
1257  cell_list.push_back(caloCellHash);
1258  //std::cout << " elt in ! eta= " << elt->eta() << " phi= " << elt->phi() << " " << ieta << " " << iphi << std::endl;
1259  }
1260  //else
1261  //std::cout << " elt out ! eta= " << elt->eta() << " phi= " << elt->phi() << std::endl;
1262  }
1263  }
1264  }
1265  else if ( iphi_min <= iphi_max && zone_phi_min > zone_phi_max ) {
1266 
1267  // we are around the -M_PI -> +M_PI discontinuity , no zone_phi_max cut
1268 
1269  for ( int ieta = ieta_min-1 ; ieta <= ieta_max+1; ieta++ )
1270  for ( int iphi = iphi_min-1 ; iphi <= iphi_max+1; iphi++ )
1271  {
1272  if (ieta>=reg_EtaMin && ieta <=reg_EtaMax && iphi>=reg_PhiMin && iphi<=reg_PhiMax) {
1273  cellId = m_cell_id->cell_id(regId, ieta, iphi);
1274  caloCellHash = m_cell_id->calo_cell_hash(cellId);
1275  elt = get_element (caloCellHash);
1276  //std::cout << " case 2 : for ieta = " << ieta << " iphi = " << iphi << std::endl;
1277  if (elt
1278  && ( (elt->eta()+elt->deta()/2.) > zone_min + 0.00001 )
1279  && ( (elt->eta()-elt->deta()/2.) + 0.00001 < zone_max )
1280  && ( ( (elt->phi()+elt->dphi()/2.) > zone_phi_min + 0.00001 )
1281  || ( (elt->phi()-elt->dphi()/2.) + 0.00001 < zone_phi_max ) )
1282  )
1283  {
1284  cell_list.push_back(caloCellHash);
1285  //std::cout << " elt in ! eta= " << elt->eta() << " phi= " << elt->phi() << " " << ieta << " " << iphi << std::endl;
1286  }
1287  //else
1288  //std::cout << " elt out ! eta= " << elt->eta() << " phi= " << elt->phi() << std::endl;
1289  }
1290  }
1291  }
1292  else {
1293 
1294  // iphi_min > iphi_max => we are around phi = 0
1295 
1296  int nchmax = m_cell_id->phi_max(regId);
1297  // number of cells = nchmax + 1 ==> 0 to nchmax included
1298 
1299  for ( int ieta = ieta_min-1 ; ieta <= ieta_max+1; ieta++ ) {
1300 
1301  // first cells from min up to 2*M_PI
1302  for ( int iphi = iphi_min-1 ; iphi <= nchmax; iphi++ )
1303  {
1304  if (ieta>=reg_EtaMin && ieta <=reg_EtaMax && iphi>=reg_PhiMin && iphi<=reg_PhiMax) {
1305  cellId = m_cell_id->cell_id(regId, ieta, iphi);
1306  caloCellHash = m_cell_id->calo_cell_hash(cellId);
1307  elt = get_element (caloCellHash);
1308  //std::cout << " case 3 : for ieta = " << ieta << " iphi = " << iphi << std::endl;
1309  if (elt
1310  && ( (elt->eta()+elt->deta()/2.) > zone_min + 0.00001 )
1311  && ( (elt->eta()-elt->deta()/2.) + 0.00001 < zone_max )
1312  && ( (elt->phi()+elt->dphi()/2.) > zone_phi_min + 0.00001 )
1313  && ( (elt->phi()-elt->dphi()/2.) + 0.00001 < zone_phi_max ) )
1314  {
1315  cell_list.push_back(caloCellHash);
1316  //std::cout << " elt in ! eta= " << elt->eta() << " phi= " << elt->phi() << " " << ieta << " " << iphi << std::endl;
1317  }
1318  //else
1319  //std::cout << " elt out ! eta= " << elt->eta() << " phi= " << elt->phi() << std::endl;
1320  }
1321  }
1322  // now cells from 0 to min
1323  for ( int iphi = 0 ; iphi <= iphi_max+1; iphi++ )
1324  {
1325  if (ieta>=reg_EtaMin && ieta <=reg_EtaMax && iphi>=reg_PhiMin && iphi<=reg_PhiMax) {
1326  cellId = m_cell_id->cell_id(regId, ieta, iphi);
1327  caloCellHash = m_cell_id->calo_cell_hash(cellId);
1328  elt = get_element (caloCellHash);
1329  //std::cout << " case 4 : for ieta = " << ieta << " iphi = " << iphi << std::endl;
1330  if (elt
1331  && ( (elt->eta()+elt->deta()/2.) > zone_min + 0.00001 )
1332  && ( (elt->eta()-elt->deta()/2.) + 0.00001 < zone_max )
1333  && ( (elt->phi()+elt->dphi()/2.) > zone_phi_min + 0.00001 )
1334  && ( (elt->phi()-elt->dphi()/2.) + 0.00001 < zone_phi_max ) )
1335  {
1336  cell_list.push_back(caloCellHash);
1337  //std::cout << " elt in ! eta= " << elt->eta() << " phi= " << elt->phi() << " " << ieta << " " << iphi << std::endl;
1338  }
1339  //else
1340  //std::cout << " elt out ! eta= " << elt->eta() << " phi= " << elt->phi() << std::endl;
1341  }
1342  }
1343  }
1344  }
1345  } // if else FCAL
1346 }

◆ cellsInZone() [6/6]

void CaloDetDescrManager_Base::cellsInZone ( double  eta_min,
double  eta_max,
double  phi_min,
double  phi_max,
std::vector< IdentifierHash > &  cell_list 
) const

the only client is CaloCellList class

Definition at line 793 of file CaloDetDescrManager.cxx.

796 {
797  cell_list.clear();
798  if ( eta_min >= eta_max ) return;
799  if ( phi_min >= phi_max ) return;
800 
801  std::vector<IdentifierHash> one_list;
802 
803  // For LAr use the descriptors :
804  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
806  if ( reg ) {
807  cellsInZone(eta_min, eta_max, phi_min, phi_max, reg, one_list);
808  if (cell_list.empty())
809  cell_list.swap (one_list);
810  else
811  cell_list.insert (cell_list.end(), one_list.begin(), one_list.end());
812  }
813  }
814 
815  // Now Tiles :
816  cellsInZone(eta_min, eta_max, phi_min, phi_max, CaloCell_ID::TILE, one_list);
817  cell_list.insert (cell_list.end(), one_list.begin(), one_list.end());
818 }

◆ decode_sample()

void CaloDetDescrManager_Base::decode_sample ( CaloCell_ID::SUBCALO subCalo,
bool &  barrel,
int &  sampling_or_module,
CaloCell_ID::CaloSample  sample 
)
static

translate between the 2 ways to label a sub-detector:

Definition at line 1468 of file CaloDetDescrManager.cxx.

1472 {
1473  if ( sample == CaloCell_ID::PreSamplerB) {
1474  subCalo = CaloCell_ID::LAREM;
1475  barrel = true;
1476  sampling_or_module = 0;
1477  return;
1478  }
1479  else if ( sample == CaloCell_ID::EMB1) {
1480  subCalo = CaloCell_ID::LAREM;
1481  barrel = true;
1482  sampling_or_module = 1;
1483  return;
1484  }
1485  else if ( sample == CaloCell_ID::EMB2) {
1486  subCalo = CaloCell_ID::LAREM;
1487  barrel = true;
1488  sampling_or_module = 2;
1489  return;
1490  }
1491  else if ( sample == CaloCell_ID::EMB3) {
1492  subCalo = CaloCell_ID::LAREM;
1493  barrel = true;
1494  sampling_or_module = 3;
1495  return;
1496  }
1497  else if ( sample == CaloCell_ID::PreSamplerE) {
1498  subCalo = CaloCell_ID::LAREM;
1499  barrel = false;
1500  sampling_or_module = 0;
1501  return;
1502  }
1503  else if ( sample == CaloCell_ID::EME1) {
1504  subCalo = CaloCell_ID::LAREM;
1505  barrel = false;
1506  sampling_or_module = 1;
1507  return;
1508  }
1509  else if ( sample == CaloCell_ID::EME2) {
1510  subCalo = CaloCell_ID::LAREM;
1511  barrel = false;
1512  sampling_or_module = 2;
1513  return;
1514  }
1515  else if ( sample == CaloCell_ID::EME3) {
1516  subCalo = CaloCell_ID::LAREM;
1517  barrel = false;
1518  sampling_or_module = 3;
1519  return;
1520  }
1521  else if ( sample == CaloCell_ID::HEC0) {
1522  subCalo = CaloCell_ID::LARHEC;
1523  barrel = false;
1524  sampling_or_module = 0;
1525  return;
1526  }
1527  else if ( sample == CaloCell_ID::HEC1) {
1528  subCalo = CaloCell_ID::LARHEC;
1529  barrel = false;
1530  sampling_or_module = 1;
1531  return;
1532  }
1533  else if ( sample == CaloCell_ID::HEC2) {
1534  subCalo = CaloCell_ID::LARHEC;
1535  barrel = false;
1536  sampling_or_module = 2;
1537  return;
1538  }
1539  else if ( sample == CaloCell_ID::HEC3) {
1540  subCalo = CaloCell_ID::LARHEC;
1541  barrel = false;
1542  sampling_or_module = 3;
1543  return;
1544  }
1545  else if ( sample == CaloCell_ID::FCAL0) {
1546  subCalo = CaloCell_ID::LARFCAL;
1547  barrel = false;
1548  sampling_or_module = 0;
1549  return;
1550  }
1551  else if ( sample == CaloCell_ID::FCAL1) {
1552  subCalo = CaloCell_ID::LARFCAL;
1553  barrel = false;
1554  sampling_or_module = 1;
1555  return;
1556  }
1557  else if ( sample == CaloCell_ID::FCAL2) {
1558  subCalo = CaloCell_ID::LARFCAL;
1559  barrel = false;
1560  sampling_or_module = 2;
1561  return;
1562  }
1563  else if ( sample == CaloCell_ID::TileBar0 ||
1569  subCalo = CaloCell_ID::TILE;
1570  barrel = true;
1571  sampling_or_module = 0;
1572  return;
1573  }
1574  else if ( sample == CaloCell_ID::TileExt0 ||
1577  subCalo = CaloCell_ID::TILE;
1578  barrel = false;
1579  sampling_or_module = 0;
1580  return;
1581  }
1582  else {
1583  subCalo = CaloCell_ID::NOT_VALID;
1584  barrel = true;
1585  sampling_or_module = 0;
1586  }
1587 
1588 }

◆ element_begin() [1/2]

CaloDetDescrManager_Base::calo_element_const_iterator CaloDetDescrManager_Base::element_begin ( ) const

first element

Definition at line 111 of file CaloDetDescrManager.cxx.

112 {
113  return m_element_vec.begin();
114 }

◆ element_begin() [2/2]

CaloDetDescrManager_Base::calo_element_const_iterator CaloDetDescrManager_Base::element_begin ( CaloCell_ID::SUBCALO  subCalo) const

first element in subcalo

Definition at line 137 of file CaloDetDescrManager.cxx.

138 {
139  int sCal = (int)subCalo;
140  return m_subCalo_begin[sCal];
141 }

◆ element_end() [1/2]

CaloDetDescrManager_Base::calo_element_const_iterator CaloDetDescrManager_Base::element_end ( ) const

end of element vector

Definition at line 117 of file CaloDetDescrManager.cxx.

118 {
119  return m_element_vec.end();
120 }

◆ element_end() [2/2]

CaloDetDescrManager_Base::calo_element_const_iterator CaloDetDescrManager_Base::element_end ( CaloCell_ID::SUBCALO  subCalo) const

end of subcalo element list

Definition at line 144 of file CaloDetDescrManager.cxx.

145 {
146  int sCal = (int) subCalo;
147  return m_subCalo_end[sCal];
148 }

◆ element_range() [1/2]

CaloDetDescrManager_Base::calo_element_range CaloDetDescrManager_Base::element_range ( ) const

Range over element vector.

Definition at line 123 of file CaloDetDescrManager.cxx.

124 {
125  return {m_element_vec.begin(),
126  m_element_vec.end()};
127 }

◆ element_range() [2/2]

CaloDetDescrManager_Base::calo_element_range CaloDetDescrManager_Base::element_range ( CaloCell_ID::SUBCALO  subCalo) const

Range over subcalo element list.

Definition at line 151 of file CaloDetDescrManager.cxx.

152 {
153  int sCal = (int) subCalo;
154  return {m_subCalo_begin[sCal],
155  m_subCalo_end[sCal]};
156 }

◆ element_range_nonconst()

CaloDetDescrManager_Base::calo_nonconst_element_range CaloDetDescrManager_Base::element_range_nonconst ( )

Range over element vector, with non-const elements.

Definition at line 130 of file CaloDetDescrManager.cxx.

131 {
132  return {m_element_vec.begin(),
133  m_element_vec.end()};
134 }

◆ element_size()

CaloDetDescrManager_Base::calo_element_vec_size CaloDetDescrManager_Base::element_size ( ) const

total number of elements

Definition at line 105 of file CaloDetDescrManager.cxx.

106 {
107  return m_element_vec.size();
108 }

◆ get_descriptor() [1/3]

const CaloDetDescriptor * CaloDetDescrManager_Base::get_descriptor ( CaloCell_ID::CaloSample  sample,
double  eta,
double  phi 
) const

get descriptor by sample, eta and phi

Definition at line 680 of file CaloDetDescrManager.cxx.

682 {
683  // note that this code does not work in the FCal as eta indices depend
684  // on eta and phi
685 
686  const CaloDetDescriptor* desc = nullptr;
687 
688  if ( sample == CaloCell_ID::TileBar0 ||
696  sample == CaloCell_ID::TileExt2 ) return desc;
697 
698  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
700 
701  if (reg) {
702  if ( reg->eta_channel(eta) >=0 && reg->phi_channel(phi) >=0) {
703  // this works only for LAr EM and HEC, for Tiles the sampling
704  // depends on the cell
705  int reg_sampl = reg->getSampling(0);
706  if ( reg_sampl == sample ) desc = reg;
707  }
708  }
709  }
710 
711  return desc;
712 }

◆ get_descriptor() [2/3]

const CaloDetDescriptor * CaloDetDescrManager_Base::get_descriptor ( CaloCell_ID::SUBCALO  subCalo,
int  sampling_or_module,
bool  barrel,
double  eta,
double  phi 
) const

get descriptor by subcalo, sampling, barrel flag, eta, phi

Definition at line 599 of file CaloDetDescrManager.cxx.

604 {
605  const CaloDetDescriptor* desc0 = nullptr;
606  const CaloDetDescriptor* desc1 = nullptr;
607  const CaloDetDescriptor* desc2 = nullptr;
608  const CaloDetDescriptor* desc3 = nullptr;
609 
610  if(subCalo == CaloCell_ID::TILE) return nullptr;
611  if(subCalo == CaloCell_ID::LARHEC && barrel) return nullptr;
612  if(subCalo == CaloCell_ID::LARFCAL && barrel) return nullptr;
613 
614  for (unsigned int i=0; i<m_descr_vec.size(); i++)
615  {
617 
618  if(reg)
619  {
620 
621  // for em differentiate barrel from endcap :
622  if ((subCalo != CaloCell_ID::LAREM
623  || (!barrel && reg->is_lar_em_endcap())
624  || (barrel && reg->is_lar_em_barrel())
625  )
626  && ((subCalo == CaloCell_ID::LAREM && reg->is_lar_em())
627  || (subCalo == CaloCell_ID::LARHEC && reg->is_lar_hec())
628  || (subCalo == CaloCell_ID::LARFCAL && reg->is_lar_fcal())
629  )
630  )
631  {
632 
633  if(reg->eta_channel(eta) >=0 && reg->phi_channel(phi) >=0)
634  {
635  // this works only for LAr, for Tiles the sampling depends on the
636  // cell
637  int reg_sampl = reg->getSampling(0);
638  // using enums as running indices is not safe! Therefore ask
639  // for each sampling explicitly
640  if(reg->is_lar_em_barrel())
641  {
642  if(reg_sampl == CaloCell_ID::PreSamplerB) desc0 = reg;
643  else if(reg_sampl == CaloCell_ID::EMB1) desc1 = reg;
644  else if(reg_sampl == CaloCell_ID::EMB2) desc2 = reg;
645  else if(reg_sampl == CaloCell_ID::EMB3) desc3 = reg;
646  }
647  else if(reg->is_lar_em_endcap())
648  {
649  if(reg_sampl == CaloCell_ID::PreSamplerE) desc0 = reg;
650  else if(reg_sampl == CaloCell_ID::EME1) desc1 = reg;
651  else if(reg_sampl == CaloCell_ID::EME2) desc2 = reg;
652  else if(reg_sampl == CaloCell_ID::EME3) desc3 = reg;
653  }
654  else if(reg->is_lar_hec())
655  {
656  if(reg_sampl == CaloCell_ID::HEC0) desc0 = reg;
657  else if(reg_sampl == CaloCell_ID::HEC1) desc1 = reg;
658  else if(reg_sampl == CaloCell_ID::HEC2) desc2 = reg;
659  else if(reg_sampl == CaloCell_ID::HEC3) desc3 = reg;
660  }
661  else if(reg->is_lar_fcal())
662  {
663  if(reg_sampl == CaloCell_ID::FCAL0) desc0 = reg;
664  else if(reg_sampl == CaloCell_ID::FCAL1) desc1 = reg;
665  else if(reg_sampl == CaloCell_ID::FCAL2) desc2 = reg;
666  }
667  } //if(reg->eta_channel(eta) >=0 && reg->phi_channel(phi) >=0)
668  }
669  } //if(reg)
670  } // iteration over descriptors
671 
672  if(sampling_or_module == 0) return desc0;
673  else if(sampling_or_module == 1) return desc1;
674  else if(sampling_or_module == 2) return desc2;
675  else if(sampling_or_module == 3) return desc3;
676  else return nullptr;
677 }

◆ get_descriptor() [3/3]

const CaloDetDescriptor * CaloDetDescrManager_Base::get_descriptor ( const Identifier regionId) const

get descriptor by region identifier

Definition at line 579 of file CaloDetDescrManager.cxx.

580 {
582  if(hash < m_descr_vec.size())
583  return m_descr_vec[hash] ;
584  else
585  return nullptr;
586 }

◆ get_descriptor_nonconst()

CaloDetDescriptor * CaloDetDescrManager_Base::get_descriptor_nonconst ( const Identifier regionId)

get descriptor by region identifier, non-const version.

Definition at line 589 of file CaloDetDescrManager.cxx.

590 {
592  if(hash < m_descr_vec.size())
593  return m_descr_vec[hash] ;
594  else
595  return nullptr;
596 }

◆ get_descriptor_raw()

const CaloDetDescriptor * CaloDetDescrManager_Base::get_descriptor_raw ( CaloCell_ID::CaloSample  sample,
double  eta,
double  phi 
) const

get descriptor by sample, eta and phi raw

Definition at line 715 of file CaloDetDescrManager.cxx.

717 {
718  // note that this code does not work in the FCal as eta indices depend
719  // on eta and phi
720 
721  //std::cout << " in CaloDetDescrManager_Base::get_descriptor_raw " << std::endl;
722 
723  const CaloDetDescriptor* desc = nullptr;
724 
725  if ( sample == CaloCell_ID::TileBar0 ||
733  sample == CaloCell_ID::TileExt2 ) return desc;
734 
735  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
737 
738  if (reg) {
739  int reg_sampl = reg->getSampling(0);
740  if ( reg_sampl == sample ) {
741  if ( reg->eta_channel_raw(eta) >=0 && reg->phi_channel_raw(phi) >=0) {
742  // this works only for LAr EM and HEC, for Tiles the sampling
743  // depends on the cell
744  desc=reg;
745  return desc;
746  }
747  }
748  }
749  }
750 
751  return desc;
752 }

◆ get_element() [1/5]

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element ( CaloCell_ID::CaloSample  sample,
double  eta,
double  phi 
) const

LAr only! get element by sample, eta phi.

This is slower for FCAL

Definition at line 256 of file CaloDetDescrManager.cxx.

259 {
260  const CaloDetDescrElement* elt=nullptr;
261 
262  // For LAr loop on regions :
263 
269 
270  bool inCell=false;
271  int niter=0;
272  const CaloDetDescrElement* elt_best=nullptr;
273 
274  double eta2=eta;
275  double phi2=phi;
276  double deltabest=9999.;
277 
278  while (!inCell && niter<3) {
279 
281  if ( ! reg ) return elt;
282 
283  if (reg->is_lar_fcal()) return get_element_FCAL(reg,eta2,phi2);
284 
285  int ieta = reg->eta_channel(eta2);
286  int iphi = reg->phi_channel(phi2);
287 
288  if(ieta < 0) return elt;
289  if(iphi < 0) return elt;
290 
291  Identifier regId = reg->identify();
292  Identifier cellId = m_cell_id->cell_id(regId, ieta, iphi);
293  IdentifierHash caloCellHash = m_cell_id->calo_cell_hash(cellId);
294  // Check for invalid identifier.
295  if (m_cell_id->cell_id (caloCellHash) != cellId) return elt;
296  elt = get_element(caloCellHash);
297  double deta=std::fabs(eta-elt->eta())-0.5*elt->deta();
298  double dphi = std::fabs(CaloPhiRange::fix(phi-elt->phi())) - 0.5*elt->dphi();
299  if (deta>0. || dphi > 0.) {
300  double delta=0.;
301  if (deta>0.) {
302  eta2=eta2 + (eta-elt->eta());
303  delta = delta + deta;
304  }
305  if (dphi>0.) {
306  phi2=CaloPhiRange::fix(phi2+(phi-elt->phi()));
307  delta = delta + dphi;
308  }
309  if (delta<deltabest) {
310  deltabest=delta;
311  elt_best = elt;
312  }
313  niter++;
314  }
315  else inCell=true;
316  }
317  if (!inCell) {
318  elt = elt_best;
319  //std::cout << " after iteration get_element " << inCell << " " << eta << " " << phi << " " << elt->eta() << " " << elt->phi() << " " << deltabest << std::endl;
320  }
321 
322 
323  } else {
324 
325  // For Tiles loop on elements :
326 
327  for ( unsigned int i = m_subCalo_min[CaloCell_ID::TILE];
329  {
331  if (pt) {
332  const double dphi = std::fabs(CaloPhiRange::fix(phi-pt->phi()));
333  if ( pt->getSampling() == sample &&
334  pt->eta()+pt->deta()/2 >= eta &&
335  pt->eta()-pt->deta()/2 <= eta &&
336  dphi <= pt->dphi()/2 )
337  {
338  elt = pt;
339  break;
340  }
341  }
342  }
343  }
344  return elt;
345 }

◆ get_element() [2/5]

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element ( CaloCell_ID::SUBCALO  subCalo,
IdentifierHash  subCaloCellHash 
) const

get element by subcalo and hash identifier

Parameters
subCalo[IN] subsystem
subCaloCellHash[IN] sub calo hash

Definition at line 173 of file CaloDetDescrManager.cxx.

175 {
176  // meaningless interface for Tiles, will only work for LAr
177 
178  int sCal = (int) subCalo;
179  if ( subCaloCellHash + m_subCalo_min[sCal] < m_element_vec.size() )
180  return m_element_vec[subCaloCellHash + m_subCalo_min[sCal]] ;
181  else return nullptr ;
182 }

◆ get_element() [3/5]

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element ( CaloCell_ID::SUBCALO  subCalo,
int  sampling_or_module,
bool  barrel,
double  eta,
double  phi 
) const

LAr only! get element by subcalo, sampling, barrel flag, eta, phi.

This is slower for FCAL

Definition at line 185 of file CaloDetDescrManager.cxx.

190 {
191 
192  bool inCell=false;
193  int niter=0;
194  const CaloDetDescrElement* elt=nullptr ;
195  const CaloDetDescrElement* elt_best=nullptr ;
196 
197  double eta2=eta;
198  double phi2=phi;
199  double deltabest=9999.;
200  //std::cout << " in get_element0 " << subCalo << " " << sampling_or_module << " " << barrel << " " << eta << " " << phi << std::endl;
201 
202 
203  while (!inCell && niter<3) {
204 
205  const CaloDetDescriptor* reg = get_descriptor(subCalo,sampling_or_module,barrel,eta2,phi2);
206  if (!reg) return nullptr;
207 
208  if (reg->is_lar_fcal()) return get_element_FCAL(reg,eta,phi);
209 
210  int ieta = reg->eta_channel(eta2);
211  int iphi = reg->phi_channel(phi2);
212  //std::cout << " ieta,iphi " << ieta << " " << iphi << std::endl;
213 
214  if(ieta < 0) return elt;
215  if(iphi < 0) return elt;
216 
217  Identifier regId = reg->identify();
218  Identifier cellId = m_cell_id->cell_id(regId, ieta, iphi);
219  IdentifierHash caloCellHash = m_cell_id->calo_cell_hash(cellId);
220  // Check for invalid identifier.
221  if (m_cell_id->cell_id (caloCellHash) != cellId) return elt;
222  elt = get_element(caloCellHash);
223  //std::cout << " element " << elt->eta() << " " << elt->phi() << " " << elt->deta() << " " << elt->dphi() << std::endl;
224  double deta=std::fabs(eta-elt->eta())-0.5*elt->deta();
225  double dphi = std::fabs(CaloPhiRange::fix(phi-elt->phi())) - 0.5*elt->dphi();
226  if (deta>0. || dphi > 0.) {
227  double delta=0.;
228  if (deta>0.) {
229  eta2=eta2 + (eta-elt->eta());
230  delta = delta + deta;
231  }
232  if (dphi>0.) {
233  phi2=CaloPhiRange::fix(phi2+(phi-elt->phi()));
234  delta = delta + dphi;
235  }
236  //std::cout << " need to iteration => eta2,phi2 " << eta2 << " " << phi2 << std::endl;
237  if (delta<deltabest) {
238  deltabest=delta;
239  elt_best = elt;
240  }
241  niter++;
242  }
243  else inCell=true;
244  }
245  if (!inCell) {
246  elt = elt_best;
247  // std::cout << " after iteration get_element0 " << inCell << " " << eta << " " << phi << " " << elt->eta() << " " << elt->phi() << " " << deltabest << std::endl;
248  }
249 
250 
251 
252  return elt;
253 }

◆ get_element() [4/5]

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element ( const Identifier cellId) const

get element by its identifier

Parameters
cellId[IN] element identifier

Definition at line 159 of file CaloDetDescrManager.cxx.

160 {
162  return get_element(hash);
163 }

◆ get_element() [5/5]

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element ( IdentifierHash  caloCellHash) const
inline

get element by hash identifier

Parameters
caloCellHash[IN] hash identifier for the element

Definition at line 509 of file CaloDetDescrManager.h.

510 {
511  if ( caloCellHash < m_element_vec.size() )
512  return m_element_vec[caloCellHash] ;
513  else return nullptr ;
514 }

◆ get_element_FCAL()

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element_FCAL ( const CaloDetDescriptor reg,
double  eta,
double  phi 
) const
private

LArFCAl private methode to get element.

Definition at line 443 of file CaloDetDescrManager.cxx.

446 {
447  const CaloDetDescrElement* elt=nullptr;
448 
449  //std::cout << " in get_element_FCAL " << descr->reg_min() << " " << descr->reg_max() << " eta,phi " << eta << " " << phi << std::endl;
450  if (eta < (descr->reg_min()-0.01) || eta > (descr->reg_max()+0.01) ) return elt;
451 
452  Identifier regId = descr->identify();
453  Identifier cellId;
454  IdentifierHash caloCellHash;
455  const CaloDetDescrElement* elt2;
456  double drmax=9999.;
457  for (int ieta=0; ieta<descr->n_eta(); ieta++) {
458  for (int iphi=0; iphi<descr->n_phi(); iphi++) {
459  cellId = m_cell_id->cell_id(regId, ieta, iphi);
460  caloCellHash = m_cell_id->calo_cell_hash(cellId);
461  elt2 = get_element (caloCellHash);
462  double deta = (eta-elt2->eta());
463  double dphi = CaloPhiRange::diff(phi,elt2->phi());
464  double dr = (deta*deta+dphi*dphi);
465  if (dr<drmax) {
466  drmax=dr;
467  elt = elt2;
468  }
469  }
470  }
471 
472  //if (elt) std::cout << " element found " << elt->eta() << " " << elt->phi() << std::endl;
473  //else std::cout <<" element not found " << std::endl;
474 
475  return elt;
476 }

◆ get_element_FCAL_raw()

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element_FCAL_raw ( const CaloDetDescriptor reg,
double  eta,
double  phi 
) const
private

LArFCAl private methode to get element from raw eta,phi.

Definition at line 479 of file CaloDetDescrManager.cxx.

482 {
483  const CaloDetDescrElement* elt=nullptr;
484 
485  //std::cout << " in get_element_FCAL " << descr->reg_min() << " " << descr->reg_max() << " eta,phi " << eta << " " << phi << std::endl;
486  if (std::fabs(eta) < (descr->calo_eta_min()-0.01) || std::fabs(eta) > (descr->calo_eta_max()+0.01) ) return elt;
487 
488  Identifier regId = descr->identify();
489  Identifier cellId;
490  IdentifierHash caloCellHash;
491  const CaloDetDescrElement* elt2;
492  double drmax=9999.;
493  for (int ieta=0; ieta<descr->n_eta(); ieta++) {
494  for (int iphi=0; iphi<descr->n_phi(); iphi++) {
495  cellId = m_cell_id->cell_id(regId, ieta, iphi);
496  caloCellHash = m_cell_id->calo_cell_hash(cellId);
497  elt2 = get_element (caloCellHash);
498  double deta = (eta-elt2->eta_raw());
499  double dphi = CaloPhiRange::diff(phi,elt2->phi_raw());
500  double dr = (deta*deta+dphi*dphi);
501  if (dr<drmax) {
502  drmax=dr;
503  elt = elt2;
504  }
505  }
506  }
507 
508  //if (elt) std::cout << " element found " << elt->eta() << " " << elt->phi() << std::endl;
509  //else std::cout <<" element not found " << std::endl;
510 
511  return elt;
512 }

◆ get_element_nonconst() [1/2]

CaloDetDescrElement * CaloDetDescrManager_Base::get_element_nonconst ( const Identifier cellId)

get element by its identifier, non-const version.

Parameters
cellId[IN] element identifier

Definition at line 166 of file CaloDetDescrManager.cxx.

167 {
169  return get_element_nonconst(hash);
170 }

◆ get_element_nonconst() [2/2]

CaloDetDescrElement * CaloDetDescrManager_Base::get_element_nonconst ( IdentifierHash  caloCellHash)
inline

get element by hash identifier, non-const version.

Parameters
caloCellHash[IN] hash identifier for the element

Definition at line 517 of file CaloDetDescrManager.h.

518 {
519  if ( caloCellHash < m_element_vec.size() )
520  return m_element_vec[caloCellHash] ;
521  else return nullptr ;
522 }

◆ get_element_raw()

const CaloDetDescrElement * CaloDetDescrManager_Base::get_element_raw ( CaloCell_ID::CaloSample  sample,
double  eta,
double  phi 
) const

Get element from raw quantities (to build real fixed size clusters)

Definition at line 349 of file CaloDetDescrManager.cxx.

352 {
353  //std::cout << " ----- in get_element_raw for eta,phi raw " << eta << " " << phi << std::endl;
354  const CaloDetDescrElement* elt=nullptr;
355 
356  // For LAr loop on regions :
357 
363 
364  bool inCell=false;
365  int niter=0;
366  const CaloDetDescrElement* elt_best=nullptr ;
367 
368  double eta2=eta;
369  double phi2=phi;
370  double deltabest=9999.;
371 
372  while (!inCell && niter<3) {
373 
375  if ( ! reg ) return elt;
376  //std::cout << " get_element_raw: found region calo etamin,etamax " << reg->calo_eta_min() << " " << reg->calo_eta_max() << std::endl;
377 
378  if (reg->is_lar_fcal()) return get_element_FCAL_raw(reg,eta,phi);
379 
380  int ieta = reg->eta_channel_raw(eta2);
381  int iphi = reg->phi_channel_raw(phi2);
382 
383  if(ieta < 0) return elt;
384  if(iphi < 0) return elt;
385 
386  Identifier regId = reg->identify();
387  Identifier cellId = m_cell_id->cell_id(regId, ieta, iphi);
388  IdentifierHash caloCellHash = m_cell_id->calo_cell_hash(cellId);
389  // Check for invalid identifier.
390  if (m_cell_id->cell_id (caloCellHash) != cellId) return elt;
391  elt = get_element(caloCellHash);
392  //std::cout << " elt raw,phi raw " << elt->eta_raw() << " " << elt->phi_raw() << std::endl;
393  double deta=std::fabs(eta-elt->eta_raw())-0.5*elt->deta();
394  double dphi = std::fabs(CaloPhiRange::fix(phi-elt->phi_raw())) - 0.5*elt->dphi();
395  if (deta>0. || dphi > 0.) {
396  double delta=0.;
397  if (deta>0.) {
398  eta2=eta2 + (eta-elt->eta_raw());
399  delta = delta + deta;
400  }
401  if (dphi>0.) {
402  phi2=CaloPhiRange::fix(phi2+(phi-elt->phi_raw()));
403  delta = delta + dphi;
404  }
405  if (delta<deltabest) {
406  deltabest=delta;
407  elt_best = elt;
408  }
409  niter++;
410  }
411  else {
412  //std::cout << " found cell " << elt->eta_raw() << " " << elt->phi_raw() << std::endl;
413  inCell=true;
414  }
415  }
416  if (!inCell) {
417  elt=elt_best;
418  //std::cout << " after iteration raw " << inCell << " " << eta << " " << phi << " " << elt->eta_raw() << " " << elt->phi_raw() << " " << deltabest << std::endl;
419  }
420 
421 
422  } else {
423 
424  // For Tiles loop on elements :
425 
426  for ( unsigned int i = m_subCalo_min[CaloCell_ID::TILE];
429  if (pt)
430  if ( pt->getSampling() == sample &&
431  pt->eta()+pt->deta()/2 <= eta &&
432  pt->eta()-pt->deta()/2 >= eta &&
433  pt->phi()+pt->phi()/2 <= phi &&
434  pt->phi()-pt->phi()/2 >= phi ) elt = pt ;
435  }
436  }
437  return elt;
438 }

◆ getCalo_Mgr()

const CaloIdManager * CaloDetDescrManager_Base::getCalo_Mgr ( ) const

get calo ID manager

Definition at line 99 of file CaloDetDescrManager.cxx.

100 {
101  return m_calo_mgr;
102 }

◆ getCaloCell_ID()

const CaloCell_Base_ID * CaloDetDescrManager_Base::getCaloCell_ID ( ) const

get calo cell ID helper

Definition at line 94 of file CaloDetDescrManager.cxx.

95 {
96  return m_cell_id;
97 }

◆ initialize()

void CaloDetDescrManager_Base::initialize ( )

initialization of the manager, used by the Converter when it creates the Manager

Definition at line 49 of file CaloDetDescrManager.cxx.

50 {
51  // set sizes :
54 
55  // --- --- Temporary, for testing only --- ---
56  for(unsigned int i=0; i<m_element_vec.size(); i++)
57  m_element_vec[i] = nullptr;
58 
59  for(unsigned int i=0; i<m_descr_vec.size(); i++)
60  m_descr_vec[i] = nullptr;
61  // --- --- Temporary, for testing only --- ---
62 
63  // cache offsets :
65 
66  m_subCalo_min.resize(nb);
67  m_subCalo_max.resize(nb);
68  m_subCalo_begin.resize(nb);
69  m_subCalo_end.resize(nb);
70 
71  for(int i = 0; i < nb; i++) {
73 
76  }
77 }

◆ is_in()

bool CaloDetDescrManager_Base::is_in ( double  eta,
double  phi,
CaloCell_ID::CaloSample  sample,
double &  etadist 
) const

return true if direction eta,phi crosses ANY of the corresponding descriptors

Parameters
eta[IN] eta direction
phi[IN] phi direction
sample[IN] Calo Sample
etadist[OUT] distance in eta to the neares edge

Definition at line 1348 of file CaloDetDescrManager.cxx.

1350 {
1351  // note that this code does not work in the FCal as eta indices depend
1352  // on eta and phi
1353 
1354  // I'm looking for the distance between the eta direction and the closest edge.
1355  // all in absolute value --> the sign will indicate if it is in or out.
1356 
1357  bool result = false;
1358  etadist = 9999999.;
1359  double aeta = std::abs(eta);
1360 
1361  // Tile first
1362  // Treat Tile Barrel and End Cap in different ways
1363  // -- Barrel
1364  if(sample == CaloCell_ID::TileBar0 ||
1367  {
1368  for(unsigned int i=0; i<m_tile_descr_vec.size(); i++)
1369  {
1371 
1372  if(reg && reg->getSampling(0) == sample)
1373  {
1374  etadist = std::abs(aeta - reg->calo_eta_max());
1375  if(aeta <= reg->calo_eta_max()) result = true;
1376  break;
1377  }
1378  }
1379  }
1380  // End Cap
1381  else if(sample == CaloCell_ID::TileExt0 ||
1387  {
1388  for(unsigned int i=0; i<m_tile_descr_vec.size(); i++)
1389  {
1391 
1392  if(reg && reg->getSampling(0) == sample)
1393  {
1394  double edgemin = std::abs(aeta - reg->calo_eta_min());
1395  double edgemax = std::abs(aeta - reg->calo_eta_max());
1396  if(edgemin < etadist) etadist = edgemin;
1397  if(edgemax < etadist) etadist = edgemax;
1398 
1399  if(aeta >= reg->calo_eta_min() &&
1400  aeta <= reg->calo_eta_max()) result = true;
1401  break;
1402  }
1403  }
1404  }
1405  else {
1406  for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
1407  const CaloDetDescriptor* reg = m_descr_vec[i];
1408  if ( reg ) {
1409  if ( reg->getSampling(0) == sample ) {
1410  if ( reg->eta_channel(eta) >=0 && reg->phi_channel(phi) >=0) result = true;
1411  double edgemin = std::abs( aeta - reg->reg_min() );
1412  double edgemax = std::abs( aeta - reg->reg_max() );
1413  if ( edgemin < etadist ) etadist = edgemin;
1414  if ( edgemax < etadist ) etadist = edgemax;
1415  }
1416  }
1417  }
1418  }
1419 
1420  if (result) etadist = etadist*(-1.);
1421 
1422  return result;
1423 }

◆ isInitialized()

bool CaloDetDescrManager_Base::isInitialized ( ) const
inline

for backwards compatibility only

Definition at line 165 of file CaloDetDescrManager.h.

165 {return true;}

◆ lar_geometry()

const std::string& CaloDetDescrManager_Base::lar_geometry ( ) const
inline

get lar geometry label, distinguish between full atlas and TB

Definition at line 168 of file CaloDetDescrManager.h.

168 {return m_lar_geometry;}

◆ print()

void CaloDetDescrManager_Base::print ( ) const

print out the contents

Definition at line 79 of file CaloDetDescrManager.cxx.

80 {
81  std::cout << " CaloDetDescrManager_Base: \n";
82 
83  std::cout << " Number of Calo descriptors : " << m_descr_vec.size() << "\n";
84 
85  int ntot = m_descr_vec.size();
86  for(int i=0 ; i<ntot; i++ )
87  {
88  std::cout << "\n ------ Calo descriptor number " << i << "\n";
89  if(m_descr_vec[i])
90  m_descr_vec[i]->print();
91  }
92 }

◆ release_element()

CaloDetDescrElement * CaloDetDescrManager_Base::release_element ( IdentifierHash  hash)
private

Definition at line 776 of file CaloDetDescrManager.cxx.

777 {
779  m_element_vec[hash] = nullptr;
780  return old;
781 }

◆ set_helper() [1/2]

void CaloDetDescrManager_Base::set_helper ( const CaloCell_Base_ID idHelper)

set calo Cell ID helper

Definition at line 783 of file CaloDetDescrManager.cxx.

784 {
785  m_cell_id = idHelper;
786 }

◆ set_helper() [2/2]

void CaloDetDescrManager_Base::set_helper ( const CaloIdManager idHelper)

set calo ID Manager Helper

Definition at line 788 of file CaloDetDescrManager.cxx.

789 {
790  m_calo_mgr = idHelper;
791 }

◆ set_lar_geometry()

void CaloDetDescrManager_Base::set_lar_geometry ( const std::string &  geom)
inline

set lar geometry label, distinguish between full atlas and TB

Definition at line 171 of file CaloDetDescrManager.h.

171 { m_lar_geometry = geom;}

◆ tile_descriptors_begin()

CaloDetDescrManager_Base::calo_descr_const_iterator CaloDetDescrManager_Base::tile_descriptors_begin ( ) const

first tile descriptor (they are in separate vector)

Definition at line 547 of file CaloDetDescrManager.cxx.

548 {
549  return m_tile_descr_vec.begin();
550 }

◆ tile_descriptors_end()

CaloDetDescrManager_Base::calo_descr_const_iterator CaloDetDescrManager_Base::tile_descriptors_end ( ) const

end of tile descriptors vector

Definition at line 553 of file CaloDetDescrManager.cxx.

554 {
555  return m_tile_descr_vec.end();
556 }

◆ tile_descriptors_range()

CaloDetDescrManager_Base::calo_descr_range CaloDetDescrManager_Base::tile_descriptors_range ( ) const

Range over tile descriptors.

Definition at line 565 of file CaloDetDescrManager.cxx.

566 {
567  return {m_tile_descr_vec.begin(),
568  m_tile_descr_vec.end()};
569 }

◆ tile_descriptors_range_nonconst()

CaloDetDescrManager_Base::calo_nonconst_descr_range CaloDetDescrManager_Base::tile_descriptors_range_nonconst ( )

Range over tile descriptors, with non-const elements.

Definition at line 572 of file CaloDetDescrManager.cxx.

573 {
574  return {m_tile_descr_vec.begin(),
575  m_tile_descr_vec.end()};
576 }

◆ tile_descriptors_size()

CaloDetDescrManager_Base::calo_descr_size CaloDetDescrManager_Base::tile_descriptors_size ( ) const

number of tile descriptors

Definition at line 559 of file CaloDetDescrManager.cxx.

560 {
561  return m_tile_descr_vec.size();
562 }

Friends And Related Function Documentation

◆ CaloCellPacker_400_500_test

friend class CaloCellPacker_400_500_test
friend

Helper for CaloCompactCellTool_test.

Definition at line 416 of file CaloDetDescrManager.h.

Member Data Documentation

◆ m_calo_mgr

const CaloIdManager* CaloDetDescrManager_Base::m_calo_mgr
private

Calo ID Manager helper.

Definition at line 425 of file CaloDetDescrManager.h.

◆ m_cell_id

const CaloCell_Base_ID* CaloDetDescrManager_Base::m_cell_id
private

Calo Cell ID helper.

Definition at line 422 of file CaloDetDescrManager.h.

◆ m_descr_vec

calo_descr_vec CaloDetDescrManager_Base::m_descr_vec
private

vector of descriptors

Definition at line 432 of file CaloDetDescrManager.h.

◆ m_element_vec

calo_element_vec CaloDetDescrManager_Base::m_element_vec
private

vector of Calo DD elements

Definition at line 429 of file CaloDetDescrManager.h.

◆ m_lar_geometry

std::string CaloDetDescrManager_Base::m_lar_geometry
private

LAr geometry label (full atlas/TB) for backwards compatibility.

Definition at line 453 of file CaloDetDescrManager.h.

◆ m_subCalo_begin

std::vector<calo_element_const_iterator> CaloDetDescrManager_Base::m_subCalo_begin
private

offsets for subcalo's elements

Definition at line 442 of file CaloDetDescrManager.h.

◆ m_subCalo_end

std::vector<calo_element_const_iterator> CaloDetDescrManager_Base::m_subCalo_end
private

offsets for subcalo's elements

Definition at line 445 of file CaloDetDescrManager.h.

◆ m_subCalo_max

std::vector<IdentifierHash> CaloDetDescrManager_Base::m_subCalo_max
private

offsets for subcalo's elements

Definition at line 439 of file CaloDetDescrManager.h.

◆ m_subCalo_min

std::vector<IdentifierHash> CaloDetDescrManager_Base::m_subCalo_min
private

offsets for subcalo's elements

Definition at line 436 of file CaloDetDescrManager.h.

◆ m_tile_descr_vec

calo_descr_vec CaloDetDescrManager_Base::m_tile_descr_vec
private

vector of descriptors

Definition at line 449 of file CaloDetDescrManager.h.


The documentation for this class was generated from the following files:
CaloDetDescrElement::deta
float deta() const
cell deta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:356
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
CaloDetDescrManager_Base::m_subCalo_end
std::vector< calo_element_const_iterator > m_subCalo_end
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:445
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
CaloCell_ID_FCS::TileExt2
@ TileExt2
Definition: FastCaloSim_CaloCell_ID.h:39
get_generator_info.result
result
Definition: get_generator_info.py:21
CaloCell_Base_ID::calo_cell_hash
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CaloCell_Base_ID::phi_min
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloDetDescrManager_Base::m_subCalo_max
std::vector< IdentifierHash > m_subCalo_max
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:439
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
CaloCell_ID_FCS::TileExt0
@ TileExt0
Definition: FastCaloSim_CaloCell_ID.h:37
CaloCell_ID_FCS::TileBar1
@ TileBar1
Definition: FastCaloSim_CaloCell_ID.h:32
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
test_pyathena.pt
pt
Definition: test_pyathena.py:11
CaloCell_ID_FCS::FCAL1
@ FCAL1
Definition: FastCaloSim_CaloCell_ID.h:41
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
CaloCell_Base_ID::eta_max
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
python.DomainsRegistry.reg
reg
globals -----------------------------------------------------------------—
Definition: DomainsRegistry.py:343
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloDetDescrManager_Base::m_tile_descr_vec
calo_descr_vec m_tile_descr_vec
vector of descriptors
Definition: CaloDetDescrManager.h:449
CaloCell_Base_ID::calo_region_hash
IdentifierHash calo_region_hash(const Identifier regionId) const
create hash id from 'global' region id
CaloCell_Base_ID::phi_max
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
CaloDetDescrElement::calo_hash
IdentifierHash calo_hash() const
cell calo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:412
CaloCell_ID_FCS::HEC1
@ HEC1
Definition: FastCaloSim_CaloCell_ID.h:28
CaloCondBlobAlgs_fillNoiseFromASCII.desc
desc
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:54
CaloDetDescrManager_Base::m_lar_geometry
std::string m_lar_geometry
LAr geometry label (full atlas/TB) for backwards compatibility.
Definition: CaloDetDescrManager.h:453
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloDetDescrManager_Base::m_calo_mgr
const CaloIdManager * m_calo_mgr
Calo ID Manager helper.
Definition: CaloDetDescrManager.h:425
CaloCell_Base_ID::calo_cell_hash_range
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
CaloCell_ID_FCS::TileBar0
@ TileBar0
Definition: FastCaloSim_CaloCell_ID.h:31
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
CaloCell_Base_ID::sampling
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
CaloCell_ID_FCS::TileGap2
@ TileGap2
Definition: FastCaloSim_CaloCell_ID.h:35
CaloDetDescrManager_Base::calo_element_const_iterator
CaloConstIteratorAdaptor< calo_element_vec::const_iterator > calo_element_const_iterator
Definition: CaloDetDescrManager.h:185
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
CaloDetDescrManager_Base::m_descr_vec
calo_descr_vec m_descr_vec
vector of descriptors
Definition: CaloDetDescrManager.h:432
python.TransformConfig.descr
descr
print "%s.properties()" % self.__name__
Definition: TransformConfig.py:360
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
CaloDetDescrManager_Base::m_subCalo_min
std::vector< IdentifierHash > m_subCalo_min
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:436
CaloDetDescrManager_Base::cellsInZone
void cellsInZone(double eta_min, double eta_max, double phi_min, double phi_max, std::vector< IdentifierHash > &cell_list) const
the only client is CaloCellList class
Definition: CaloDetDescrManager.cxx:793
CaloCell_Base_ID::phiGranularity
float phiGranularity(const Identifier regId) const
LAr phi granularity (NOT_VALID == failure)
CaloCell_ID_FCS::TileGap1
@ TileGap1
Definition: FastCaloSim_CaloCell_ID.h:34
CaloPhiRange::fix
static double fix(double phi)
Definition: CaloPhiRange.cxx:14
CaloCell_Base_ID::eta_min
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
CaloCell_ID_FCS::TileExt1
@ TileExt1
Definition: FastCaloSim_CaloCell_ID.h:38
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
CaloCell_Base_ID::cell_id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
CaloDetDescrManager_Base::get_element_FCAL_raw
const CaloDetDescrElement * get_element_FCAL_raw(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element from raw eta,phi.
Definition: CaloDetDescrManager.cxx:479
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
CaloDetDescrManager_Base::get_element_FCAL
const CaloDetDescrElement * get_element_FCAL(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element.
Definition: CaloDetDescrManager.cxx:443
CaloDetDescrElement::dphi
float dphi() const
cell dphi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:358
CaloDetDescrElement::is_lar_em_barrel
bool is_lar_em_barrel() const
cell belongs to EM barrel
Definition: CaloDetDescrElement.cxx:98
CaloDetDescrManager_Base::get_element_nonconst
CaloDetDescrElement * get_element_nonconst(const Identifier &cellId)
get element by its identifier, non-const version.
Definition: CaloDetDescrManager.cxx:166
CaloDetDescriptor
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
Definition: CaloDetDescriptor.h:58
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CSV_InDetExporter.old
old
Definition: CSV_InDetExporter.py:145
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloDetDescrManager_Base::m_subCalo_begin
std::vector< calo_element_const_iterator > m_subCalo_begin
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:442
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
DetectorZone::barrel
@ barrel
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloCell_Base_ID::NSUBCALO
@ NSUBCALO
Definition: CaloCell_Base_ID.h:46
CaloDetDescrManager_Base::m_element_vec
calo_element_vec m_element_vec
vector of Calo DD elements
Definition: CaloDetDescrManager.h:429
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
IdentifierHash
Definition: IdentifierHash.h:38
LArDigits2NtupleDumper.geom
geom
Definition: LArDigits2NtupleDumper.py:133
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
CaloCell_Base_ID::NOT_VALID
@ NOT_VALID
Definition: CaloCell_Base_ID.h:46
hotSpotInTAG.nb
nb
Definition: hotSpotInTAG.py:164
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
CaloCell_Base_ID::calo_region_hash_max
size_type calo_region_hash_max(void) const
cell 'global' region table max size
CaloCell_ID_FCS::TileBar2
@ TileBar2
Definition: FastCaloSim_CaloCell_ID.h:33
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
CaloDetDescrManager_Base::m_cell_id
const CaloCell_Base_ID * m_cell_id
Calo Cell ID helper.
Definition: CaloDetDescrManager.h:422
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloPhiRange::diff
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
Definition: CaloPhiRange.cxx:22
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size
CaloDetDescrManager_Base::get_descriptor_raw
const CaloDetDescriptor * get_descriptor_raw(CaloCell_ID::CaloSample sample, double eta, double phi) const
get descriptor by sample, eta and phi raw
Definition: CaloDetDescrManager.cxx:715
CaloDetDescrManager_Base::get_descriptor
const CaloDetDescriptor * get_descriptor(const Identifier &regionId) const
get descriptor by region identifier
Definition: CaloDetDescrManager.cxx:579
CaloCell_Base_ID::etaGranularity
float etaGranularity(const Identifier regId) const
LAr eta granularity (NOT_VALID == failure)