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

This class provides the client interface for accessing the detector description information common to LAr and Tile. More...

#include <CaloDetDescrManager.h>

Inheritance diagram for CaloDetDescrManager:
Collaboration diagram for CaloDetDescrManager:

Public Types

using calo_element_vec = std::vector<CaloDetDescrElement*>
using calo_element_vec_size = calo_element_vec::size_type
using calo_element_const_iterator = CaloConstIteratorAdaptor<calo_element_vec::const_iterator>
using calo_element_range = std::ranges::subrange<calo_element_const_iterator>
using calo_nonconst_element_const_iterator = calo_element_vec::const_iterator
using calo_nonconst_element_range = std::ranges::subrange<calo_nonconst_element_const_iterator>
using calo_descr_vec = std::vector <CaloDetDescriptor*>
using calo_descr_size = calo_descr_vec::size_type
using calo_descr_const_iterator = CaloConstIteratorAdaptor<calo_descr_vec::const_iterator>
using calo_descr_range = std::ranges::subrange<calo_descr_const_iterator>
using calo_nonconst_descr_const_iterator = calo_descr_vec::const_iterator
using calo_nonconst_descr_range = std::ranges::subrange<calo_nonconst_descr_const_iterator>

Public Member Functions

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

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:
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:

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.
const CaloDetDescrElementget_element_FCAL_raw (const CaloDetDescriptor *reg, double eta, double phi) const
 LArFCAl private methode to get element from raw eta,phi.

Private Attributes

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

Detailed Description

This class provides the client interface for accessing the detector description information common to LAr and Tile.

It is used in the Calorimeter reconstruction (from CaloCell building down to combined reconstruction)

For subdetector specific functionality one should use special managers 4 for LAr (in LArReadoutgeometry package) and one for Tile (in TileDetDescr package), essentially upstream of CaloCell building.

MAJOR FUNCTIONALITIES :

1) 2 enums and 3 coordinate systems :

For historical reasons, there are 2 ways to label a piece of the Calorimeter: the CaloCell_ID::CaloSample enum is by far the recommended one. The methods CaloDetDescrManager::build_sample and CaloDetDescrManager::decode_sample provide the translation.

The CaloCell_ID::SUBCALO subCalo + bool barrel + int sampling_or_module combination is meaningless for Tiles, but used in many places in the LAr code, so was kept for backward compatibility. The boolean "barrel" is needed because there is an emb/emec ambiguity (in the enum definition) and eta overlap: if true, will search EMB/TILES, if false will search EMEC/HEC/FCAL.

Also note the different coordinates : in EMB people generally use "eta, phi, radius", in EMEC/HEC people generally use "eta, phi, Z", in Tiles/FCAL people generally use cartesian coordinates. To avoid confusion, the coordinate system used is explicit in all methods signature.

2) Access to the "big" array of CaloDetDescrElement :

These are stored internally according to the IdentifierHash caloCellHash. All navigation/convertion between the this complete hash and the subcalo (em/hec/fcal/tile) are provided by the CaloCell_ID helper.

3) Methods cellsInZone :

Given a zone in eta/phi, a sub detector and a sampling (or module for FCAL), these methods return the list of CALO IdentifierHash. In case of failiure, the vector will be empty.

WARNING : eta_min and eta_max can have NEGATIVE values and are not abs() (in contrast to CaloDescriptors, where eta() is always positive and has to be multiplied by sign() )

WARNING: For the FCAL this involves a loop over all the Fcal cells, so this is a little bit slower if Fcal layers are required

4) Given an eta/phi and a sampling or a depth, where-am-I ?

These method return CaloDetDescrElement* (to get, e.g., cell size), or return the entrance into the calorimeter (r or z, for barrel or endcap).

WARNING : if eta/phi is outside the Calo range, or no Element or descriptor is found for some reason, returns a NULL pointer or a radius=0 !

WARNING : the methods get_barrel_element and get_ec_element only work in the barrel/endcap regions.

5) Methods is_in :

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

6) Methods get_entrance and get_surface (needed for TrackToCalo):

Trk::Surfaces are not built by the CaloDetDescrManager to avoid any dependency from Calorimeter onto Tracking : this is done in the Reconstruction/RecoTools/TrackToCalo package. But this class provides the surface parameters

By convention, for each CaloSample the radius/z correspond to the entrance of the sampling, and are "flat" in the sense that there is no eta dependance. This is valid for PS, Strips, HEC, FCAL and Tiles, but not for EMB2,EMB3,EMEC2,EMEC3

Clients who want a more precise (and eta dependant) entrance radius can overwrite the default one by the result of the methods get_entrance_radius/get_entrance_z .

Clients who want to add an offset, use the middle rather than entrace or use a parametrised depth are invited to use the CaloDepthTool, which is in Reconstruction/RecoTool/TrackToCalo

7) Access to the CaloDetDescriptors :

In LAr, there is 1 CaloDetDescriptor per region of homogeneus granularity. Their primary goal if to speedup loops by grouping cells within regions, and save spave by caching what they have in common. You may need to access them to get, for example, the grannularity.

Definition at line 467 of file CaloDetDescrManager.h.

Member Typedef Documentation

◆ calo_descr_const_iterator

using CaloDetDescrManager_Base::calo_descr_const_iterator = CaloConstIteratorAdaptor<calo_descr_vec::const_iterator>
inherited

Definition at line 320 of file CaloDetDescrManager.h.

◆ calo_descr_range

Definition at line 321 of file CaloDetDescrManager.h.

◆ calo_descr_size

using CaloDetDescrManager_Base::calo_descr_size = calo_descr_vec::size_type
inherited

Definition at line 319 of file CaloDetDescrManager.h.

◆ calo_descr_vec

Definition at line 318 of file CaloDetDescrManager.h.

◆ calo_element_const_iterator

using CaloDetDescrManager_Base::calo_element_const_iterator = CaloConstIteratorAdaptor<calo_element_vec::const_iterator>
inherited

Definition at line 182 of file CaloDetDescrManager.h.

◆ calo_element_range

Definition at line 183 of file CaloDetDescrManager.h.

◆ calo_element_vec

Definition at line 180 of file CaloDetDescrManager.h.

◆ calo_element_vec_size

using CaloDetDescrManager_Base::calo_element_vec_size = calo_element_vec::size_type
inherited

Definition at line 181 of file CaloDetDescrManager.h.

◆ calo_nonconst_descr_const_iterator

using CaloDetDescrManager_Base::calo_nonconst_descr_const_iterator = calo_descr_vec::const_iterator
inherited

Definition at line 325 of file CaloDetDescrManager.h.

◆ calo_nonconst_descr_range

Definition at line 326 of file CaloDetDescrManager.h.

◆ calo_nonconst_element_const_iterator

using CaloDetDescrManager_Base::calo_nonconst_element_const_iterator = calo_element_vec::const_iterator
inherited

Definition at line 186 of file CaloDetDescrManager.h.

◆ calo_nonconst_element_range

Member Function Documentation

◆ add() [1/3]

void CaloDetDescrManager_Base::add ( CaloDetDescrElement * element)
inherited

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}
calo_element_vec m_element_vec
vector of Calo DD elements

◆ add() [2/3]

void CaloDetDescrManager_Base::add ( CaloDetDescriptor * descr)
inherited

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}
calo_descr_vec m_descr_vec
vector of descriptors
list descr
print "%s.properties()" % self.__name__

◆ add() [3/3]

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

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)
inherited

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}
calo_descr_vec m_tile_descr_vec
vector of descriptors

◆ build_sample()

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

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 )
1459 sample = CaloCell_ID::TileBar0;
1460 else
1461 sample = CaloCell_ID::TileExt0;
1462 }
1463 else
1464 sample = CaloCell_ID::Unknown;
1465
1466}

◆ calo_descriptors_begin()

CaloDetDescrManager_Base::calo_descr_const_iterator CaloDetDescrManager_Base::calo_descriptors_begin ( ) const
inherited

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
inherited

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
inherited

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 ( )
inherited

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
inherited

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
inherited

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++ ) {
996 const CaloDetDescriptor* reg = m_descr_vec[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}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
bool is_lar_em_barrel() const
cell belongs to EM barrel
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
std::vector< IdentifierHash > m_subCalo_min
offsets for subcalo's elements
const CaloCell_Base_ID * m_cell_id
Calo Cell ID helper.
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
std::vector< IdentifierHash > m_subCalo_max
offsets for subcalo's elements
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.

◆ 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
inherited

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 &&
889 sample != CaloCell_ID::TileBar1 &&
890 sample != CaloCell_ID::TileBar2 &&
891 sample != CaloCell_ID::TileGap1 &&
892 sample != CaloCell_ID::TileGap2 &&
893 sample != CaloCell_ID::TileGap3 &&
894 sample != CaloCell_ID::TileExt0 &&
895 sample != CaloCell_ID::TileExt1 &&
896 sample != CaloCell_ID::TileExt2 ) {
897
898 for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
899 const CaloDetDescriptor* reg = m_descr_vec[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}
CaloCell_ID::CaloSample getSampling() const
cell sampling

◆ 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
inherited

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++ ) {
962 const CaloDetDescriptor* reg = m_descr_vec[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
inherited

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++ ) {
835 const CaloDetDescriptor* reg = m_descr_vec[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
inherited

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}
std::string m_lar_geometry
LAr geometry label (full atlas/TB) for backwards compatibility.
static double fix(double phi)

◆ 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
inherited

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++ ) {
805 const CaloDetDescriptor* reg = m_descr_vec[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 )
staticinherited

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 ||
1564 sample == CaloCell_ID::TileBar1 ||
1565 sample == CaloCell_ID::TileBar2 ||
1566 sample == CaloCell_ID::TileGap1 ||
1567 sample == CaloCell_ID::TileGap2 ||
1568 sample == CaloCell_ID::TileGap3 ) {
1569 subCalo = CaloCell_ID::TILE;
1570 barrel = true;
1571 sampling_or_module = 0;
1572 return;
1573 }
1574 else if ( sample == CaloCell_ID::TileExt0 ||
1575 sample == CaloCell_ID::TileExt1 ||
1576 sample == CaloCell_ID::TileExt2 ) {
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
inherited

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
inherited

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}
std::vector< calo_element_const_iterator > m_subCalo_begin
offsets for subcalo's elements

◆ element_end() [1/2]

CaloDetDescrManager_Base::calo_element_const_iterator CaloDetDescrManager_Base::element_end ( ) const
inherited

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
inherited

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}
std::vector< calo_element_const_iterator > m_subCalo_end
offsets for subcalo's elements

◆ element_range() [1/2]

CaloDetDescrManager_Base::calo_element_range CaloDetDescrManager_Base::element_range ( ) const
inherited

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
inherited

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 ( )
inherited

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
inherited

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
inherited

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 ||
689 sample == CaloCell_ID::TileBar1 ||
690 sample == CaloCell_ID::TileBar2 ||
691 sample == CaloCell_ID::TileGap1 ||
692 sample == CaloCell_ID::TileGap2 ||
693 sample == CaloCell_ID::TileGap3 ||
694 sample == CaloCell_ID::TileExt0 ||
695 sample == CaloCell_ID::TileExt1 ||
696 sample == CaloCell_ID::TileExt2 ) return desc;
697
698 for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
699 const CaloDetDescriptor* reg = m_descr_vec[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
inherited

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 {
616 const CaloDetDescriptor* reg = m_descr_vec[i];
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
inherited

get descriptor by region identifier

Definition at line 579 of file CaloDetDescrManager.cxx.

580{
581 IdentifierHash hash = m_cell_id->calo_region_hash(regionId);
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)
inherited

get descriptor by region identifier, non-const version.

Definition at line 589 of file CaloDetDescrManager.cxx.

590{
591 IdentifierHash hash = m_cell_id->calo_region_hash(regionId);
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
inherited

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 ||
726 sample == CaloCell_ID::TileBar1 ||
727 sample == CaloCell_ID::TileBar2 ||
728 sample == CaloCell_ID::TileGap1 ||
729 sample == CaloCell_ID::TileGap2 ||
730 sample == CaloCell_ID::TileGap3 ||
731 sample == CaloCell_ID::TileExt0 ||
732 sample == CaloCell_ID::TileExt1 ||
733 sample == CaloCell_ID::TileExt2 ) return desc;
734
735 for ( unsigned int i=0; i<m_descr_vec.size(); i++ ) {
736 const CaloDetDescriptor* reg = m_descr_vec[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
inherited

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
264 if ( sample != CaloCell_ID::TileBar0 && sample != CaloCell_ID::TileBar1 &&
265 sample != CaloCell_ID::TileBar2 && sample != CaloCell_ID::TileGap1 &&
266 sample != CaloCell_ID::TileGap2 && sample != CaloCell_ID::TileGap3 &&
267 sample != CaloCell_ID::TileExt0 && sample != CaloCell_ID::TileExt1 &&
268 sample != CaloCell_ID::TileExt2 ) {
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
280 const CaloDetDescriptor* reg = get_descriptor(sample,eta2,phi2);
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 {
330 const CaloDetDescrElement* pt = m_element_vec[i];
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}
const CaloDetDescrElement * get_element_FCAL(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element.
const CaloDetDescriptor * get_descriptor(const Identifier &regionId) const
get descriptor by region identifier

◆ get_element() [2/5]

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

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
inherited

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
inherited

get element by its identifier

Parameters
cellId[IN] element identifier

Definition at line 159 of file CaloDetDescrManager.cxx.

160{
161 IdentifierHash hash = m_cell_id->calo_cell_hash(cellId);
162 return get_element(hash);
163}

◆ get_element() [5/5]

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

get element by hash identifier

Parameters
caloCellHash[IN] hash identifier for the element

Definition at line 505 of file CaloDetDescrManager.h.

506{
507 if ( caloCellHash < m_element_vec.size() )
508 return m_element_vec[caloCellHash] ;
509 else return nullptr ;
510}

◆ get_element_FCAL()

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

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
privateinherited

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)
inherited

get element by its identifier, non-const version.

Parameters
cellId[IN] element identifier

Definition at line 166 of file CaloDetDescrManager.cxx.

167{
168 IdentifierHash hash = m_cell_id->calo_cell_hash(cellId);
169 return get_element_nonconst(hash);
170}
CaloDetDescrElement * get_element_nonconst(const Identifier &cellId)
get element by its identifier, non-const version.

◆ get_element_nonconst() [2/2]

CaloDetDescrElement * CaloDetDescrManager_Base::get_element_nonconst ( IdentifierHash caloCellHash)
inlineinherited

get element by hash identifier, non-const version.

Parameters
caloCellHash[IN] hash identifier for the element

Definition at line 513 of file CaloDetDescrManager.h.

514{
515 if ( caloCellHash < m_element_vec.size() )
516 return m_element_vec[caloCellHash] ;
517 else return nullptr ;
518}

◆ get_element_raw()

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

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
358 if ( sample != CaloCell_ID::TileBar0 && sample != CaloCell_ID::TileBar1 &&
359 sample != CaloCell_ID::TileBar2 && sample != CaloCell_ID::TileGap1 &&
360 sample != CaloCell_ID::TileGap2 && sample != CaloCell_ID::TileGap3 &&
361 sample != CaloCell_ID::TileExt0 && sample != CaloCell_ID::TileExt1 &&
362 sample != CaloCell_ID::TileExt2 ) {
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
374 const CaloDetDescriptor* reg = get_descriptor_raw(sample,eta2,phi2);
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];
428 const CaloDetDescrElement* pt = m_element_vec[i];
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}
const CaloDetDescrElement * get_element_FCAL_raw(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element from raw eta,phi.
const CaloDetDescriptor * get_descriptor_raw(CaloCell_ID::CaloSample sample, double eta, double phi) const
get descriptor by sample, eta and phi raw

◆ getCalo_Mgr()

const CaloIdManager * CaloDetDescrManager_Base::getCalo_Mgr ( ) const
inherited

get calo ID manager

Definition at line 99 of file CaloDetDescrManager.cxx.

100{
101 return m_calo_mgr;
102}
const CaloIdManager * m_calo_mgr
Calo ID Manager helper.

◆ getCaloCell_ID()

const CaloCell_ID * CaloDetDescrManager::getCaloCell_ID ( ) const

get calo cell ID helper

Definition at line 1590 of file CaloDetDescrManager.cxx.

1591{
1592 return static_cast<const CaloCell_ID*>
1594}
const CaloCell_Base_ID * getCaloCell_ID() const
get calo cell ID helper

◆ initialize()

void CaloDetDescrManager_Base::initialize ( )
inherited

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 :
52 m_element_vec.resize(m_cell_id->calo_cell_hash_max());
53 m_descr_vec.resize(m_cell_id->calo_region_hash_max());
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++) {
72 m_cell_id->calo_cell_hash_range(i,m_subCalo_min[i],m_subCalo_max[i]);
73
76 }
77}
CaloConstIteratorAdaptor< calo_element_vec::const_iterator > calo_element_const_iterator

◆ is_in()

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

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 ||
1365 sample == CaloCell_ID::TileBar1 ||
1366 sample == CaloCell_ID::TileBar2)
1367 {
1368 for(unsigned int i=0; i<m_tile_descr_vec.size(); i++)
1369 {
1370 const CaloDetDescriptor* reg = m_tile_descr_vec[i];
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 ||
1382 sample == CaloCell_ID::TileExt1 ||
1383 sample == CaloCell_ID::TileExt2 ||
1384 sample == CaloCell_ID::TileGap1 ||
1385 sample == CaloCell_ID::TileGap2 ||
1386 sample == CaloCell_ID::TileGap3)
1387 {
1388 for(unsigned int i=0; i<m_tile_descr_vec.size(); i++)
1389 {
1390 const CaloDetDescriptor* reg = m_tile_descr_vec[i];
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
inlineinherited

for backwards compatibility only

Definition at line 163 of file CaloDetDescrManager.h.

163{return true;}

◆ lar_geometry()

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

get lar geometry label, distinguish between full atlas and TB

Definition at line 166 of file CaloDetDescrManager.h.

166{return m_lar_geometry;}

◆ print()

void CaloDetDescrManager_Base::print ( ) const
inherited

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)
privateinherited

Definition at line 776 of file CaloDetDescrManager.cxx.

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

◆ set_helper() [1/3]

void CaloDetDescrManager::set_helper ( const CaloCell_ID * idHelper)

set calo Cell ID helper

Definition at line 1596 of file CaloDetDescrManager.cxx.

1597{
1599}
void set_helper(const CaloCell_Base_ID *idHelper)
set calo Cell ID helper

◆ set_helper() [2/3]

void CaloDetDescrManager::set_helper ( const CaloIdManager * idHelper)

Definition at line 1602 of file CaloDetDescrManager.cxx.

1603{
1605}

◆ set_helper() [3/3]

void CaloDetDescrManager_Base::set_helper ( const CaloCell_Base_ID * idHelper)
inherited

set calo Cell ID helper

Definition at line 783 of file CaloDetDescrManager.cxx.

784{
785 m_cell_id = idHelper;
786}

◆ set_lar_geometry()

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

set lar geometry label, distinguish between full atlas and TB

Definition at line 169 of file CaloDetDescrManager.h.

◆ tile_descriptors_begin()

CaloDetDescrManager_Base::calo_descr_const_iterator CaloDetDescrManager_Base::tile_descriptors_begin ( ) const
inherited

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
inherited

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
inherited

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 ( )
inherited

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
inherited

number of tile descriptors

Definition at line 559 of file CaloDetDescrManager.cxx.

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

Member Data Documentation

◆ m_calo_mgr

const CaloIdManager* CaloDetDescrManager_Base::m_calo_mgr
privateinherited

Calo ID Manager helper.

Definition at line 421 of file CaloDetDescrManager.h.

◆ m_cell_id

const CaloCell_Base_ID* CaloDetDescrManager_Base::m_cell_id
privateinherited

Calo Cell ID helper.

Definition at line 418 of file CaloDetDescrManager.h.

◆ m_descr_vec

calo_descr_vec CaloDetDescrManager_Base::m_descr_vec
privateinherited

vector of descriptors

Definition at line 428 of file CaloDetDescrManager.h.

◆ m_element_vec

calo_element_vec CaloDetDescrManager_Base::m_element_vec
privateinherited

vector of Calo DD elements

Definition at line 425 of file CaloDetDescrManager.h.

◆ m_lar_geometry

std::string CaloDetDescrManager_Base::m_lar_geometry
privateinherited

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

Definition at line 449 of file CaloDetDescrManager.h.

◆ m_subCalo_begin

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

offsets for subcalo's elements

Definition at line 438 of file CaloDetDescrManager.h.

◆ m_subCalo_end

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

offsets for subcalo's elements

Definition at line 441 of file CaloDetDescrManager.h.

◆ m_subCalo_max

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

offsets for subcalo's elements

Definition at line 435 of file CaloDetDescrManager.h.

◆ m_subCalo_min

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

offsets for subcalo's elements

Definition at line 432 of file CaloDetDescrManager.h.

◆ m_tile_descr_vec

calo_descr_vec CaloDetDescrManager_Base::m_tile_descr_vec
privateinherited

vector of descriptors

Definition at line 445 of file CaloDetDescrManager.h.


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