4namespace {
constexpr auto pi = 3.14159265358979323846; }
44 return StatusCode::FAILURE;
50 return StatusCode::FAILURE;
66 return StatusCode::FAILURE;
77 for (
auto fcell(
m_caloDDM->element_begin()); fcell !=
m_caloDDM->element_end(); ++fcell ) {
83 msg << MSG::WARNING <<
"Cell hash identifier out of range " << cidx <<
"/" <<
m_towerLookup.size() <<
", ignore cell" <<
endmsg;
93 return StatusCode::SUCCESS;
106 double cXpos(pCaloDDE->
x_raw());
107 double cYpos(pCaloDDE->
y_raw());
108 double cZpos(pCaloDDE->
z_raw());
109 double cZpos2(cZpos*cZpos);
111 double cXwid(pCaloDDE->
dx());
112 double cYwid(pCaloDDE->
dy());
120 double cXstp(cXwid/((
double)nXslice));
121 double cYstp(cYwid/((
double)nYslice));
125 double x(cXpos-(cXwid-cXstp)/2.);
126 double xlim(cXpos+cXwid/2.);
double ylim(cYpos+cYwid/2.);
133 double y(cYpos-(cYwid-cYstp)/2.);
135 double r(std::sqrt(
x*
x+
y*
y+cZpos2));
136 double eta(-0.5*std::log((
r-cZpos)/(
r+cZpos)));
137 bool etaAdjusted(
false);
153 msg << MSG::WARNING <<
"Found invalid tower index for FCal cell (eta,phi) = (" <<
eta <<
"," <<
phi <<
") at (x,y,z) = ("
154 <<
x <<
"," <<
y <<
"," << cZpos <<
") [cell ignored]" <<
endmsg;
158 msg << MSG::WARNING <<
"FCal cell direction (eta,phi) = (" << etaOrig <<
"," <<
phi <<
") for cell at (x,y,z) = ("
159 <<
x <<
"," <<
y <<
"," << cZpos <<
") adjusted to (eta,phi) = (" <<
eta <<
"," <<
phi <<
") [cell adjusted]" <<
endmsg;
167 return StatusCode::SUCCESS;
173 double cEtaPos(pCaloDDE->
eta_raw());
174 double cEtaWid(pCaloDDE->
deta());
175 double cPhiPos(pCaloDDE->
phi_raw());
176 double cPhiWid(pCaloDDE->
dphi());
183 if ( kEta > 1 || kPhi > 1 ) {
185 << std::dec <<
"] spawning several towers."
186 <<
" Neta = " << kEta <<
", Nphi = " << kPhi <<
endmsg;
190 double cWght(1./((
double)kEta*kPhi));
191 double sEta(cEtaWid/((
double)kEta));
192 double sPhi(cPhiWid/((
double)kPhi));
193 double oEta(cEtaPos-sEta/2.);
194 double oPhi(cPhiPos-sPhi/2.);
197 for (
uint_t ie(1); ie<=kEta; ++ie ) {
198 double ceta(oEta+((
double)ie-0.5)*sEta);
199 for (
uint_t ip(1); ip<=kPhi; ++ip ) {
200 double cphi(oPhi+((
double)ip-0.5)*sPhi);
204 msg << MSG::ERROR <<
"Found invalid tower index for non-FCal cell (id,eta,phi) = (" << pCaloDDE->
calo_hash()
205 <<
"," << ceta <<
"," << cphi <<
")" <<
endmsg;
206 return StatusCode::FAILURE;
211 return StatusCode::SUCCESS;
243 return StatusCode::SUCCESS;
251 return StatusCode::SUCCESS;
289 const auto *
const cdde =
f_caloDDE(cellHash);
302 const auto *
const cdde =
f_caloDDE(cellHash);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
This class groups all DetDescr information related to a CaloCell.
virtual int getLayer() const
cell layer
IdentifierHash calo_hash() const
cell calo hash
float y_raw() const
cell y_raw
float eta_raw() const
cell eta_raw
float dphi() const
cell dphi
float x_raw() const
cell x_raw
Identifier identify() const override final
cell identifier
float phi_raw() const
cell phi_raw
float deta() const
cell deta
float z_raw() const
cell z_raw
bool is_lar_fcal() const
cell belongs to FCAL
This class provides the client interface for accessing the detector description information common to...
static double fix(double phi)
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
index_t invalidIndex() const
Returns value of invalid index.
double m_fcal3Xslice
Number of x slices for cells in FCal3.
uint_t m_towerBins
Maximum number of towers.
index_t towerIndex(IdentifierHash cellHash) const
Get global tower index for a calorimeter cell referenced by its hash identifier.
double m_fcal2Yslice
Number of y slices for cells in FCal2.
double m_fcal2Xslice
Number of x slices for cells in FCal2.
IdentifierHash::value_type index_t
Type for scalar (pseudorapidity,azimuth) index (is an unsigned int type)
static const index_t m_invalidIndex
Invalid index indicator.
double m_fcal3Yslice
Number of y slices for cells in FCal3.
uint_t m_maxCellHash
Maximum cell hash value.
double m_towerPhiMin
Lower boundary .
uint_t m_towerPhiBins
Number of bins.
CaloTowerGeometry()=delete
StatusCode initialize(MsgStream &msg)
Initialize object.
index_t etaIndex(IdentifierHash cellHash) const
Get tower bin index for a calorimeter cell referenced by its hash identifier.
StatusCode f_setupTowerGridFCal(const CaloDetDescrElement *pCaloDDE, MsgStream &msg)
Internally used function mapping an FCal cell onto the tower grid.
double m_towerPhiMax
Upper boundary .
uint_t m_towerEtaBins
Internally stored tower grid descriptors.
index_t phiIndex(IdentifierHash cellHash) const
Get tower bin index for a calorimeter cell referenced by its hash identifier.
double m_fcal1Yslice
Number of y slices for cells in FCal1.
std::size_t uint_t
Type for unsigned integer.
double m_towerPhiWidth
Width of tower bin in azimuth.
uint_t m_numberOfCells
Total number of cells.
std::array< double, 3 > m_ndxFCal
Stores number of fragments along x for each FCal module.
const CaloDetDescrElement * f_caloDDE(IdentifierHash cellHash) const
Retrieve calorimeter detector description element for a given cell hash identifier.
double m_towerEtaMin
Lower boundary .
double f_assign(IdentifierHash cellHash, index_t towerIdx, double wgt)
Internally used function assigning tower to cell with update of weight if same tower is already assig...
elementmap_t m_towerLookup
Cell-to-tower mapping lookup store.
std::array< double, 3 > m_wgtFCal
Stores geometrical weights.
const CaloDetDescrManager * m_caloDDM
Pointer to calorimeter detector description.
std::array< double, 3 > m_ndyFCal
Stores number of fragments along y for each FCal module.
StatusCode access(IdentifierHash cellHash, std::vector< index_t > &towerIdx, std::vector< double > &towerWghts) const
double cellWeight(const element_t &elm) const
Retrieve cell signal weight from lookup table entry.
std::tuple< index_t, double > element_t
Type storing tower index and geometrical weight.
double m_towerEtaWidth
Width of tower bin in pseudorapidity.
double m_fcal1Xslice
Number of x slices for cells in FCal1.
double m_towerArea
Area of individual tower.
StatusCode f_setupTowerGrid(MsgStream &msg)
Internally used function setting up the lookup store.
bool m_adjustEta
Adjust FCal cells to eta boundary (default true )
StatusCode f_setupTowerGridProj(const CaloDetDescrElement *pCaloDDE, MsgStream &msg)
Internally used function mapping a projective cell onto the tower grid.
std::vector< element_t > elementvector_t
Type for list of elements holding tower index and list of weights.
bool isInvalidIndex(index_t idx) const
Returns true if argument is equal to the value provided by invalidIndex()
static const double m_invalidValue
Return value for out-of-range indices andother invalid conversions to a physical quantity.
elementvector_t getTowers(IdentifierHash cellHash) const
Retrieve the list of towers associated with a calorimeter cell referenced its hash identifier.
double m_towerEtaMax
Upper boundary .
This is a "hash" representation of an Identifier.
value_type get_compact() const
Get the compact id.
int32_t index_t
The index type of the node in the vector.