15#include "GaudiKernel/SystemOfUnits.h"
25 const double Dx = 0.5 * elt.
dx();
26 const double Dy = 0.5 * elt.
dy();
27 const double phi = elt.
phi();
28 const double r = elt.
r();
29 const double dxcphi = Dx*std::cos(
phi);
30 const double dxsphi = Dx*std::sin(
phi);
31 const double dycphi = Dy*std::cos(
phi);
32 const double dysphi = Dy*std::sin(
phi);
34 const double DrT = std::sqrt(dxsphi*dxsphi+dycphi*dycphi);
36 const double inv_r = 1. /
r;
37 dphi = 2.*DrT * inv_r;
40 double dr = std::sqrt(dxcphi*dxcphi+dysphi*dysphi);
48 double f=elt.
z() * inv_r;
49 double df = elt.
z()*
dr*inv_r*inv_r;
50 deta = 2.*std::abs(df) /std::sqrt(f*f+1.);
79 if(
m_cell->getEndcapIndex()==0)
82 const double phi_loc = (
m_cell->getPhiLocalLower() +
m_cell->getPhiLocalUpper())/2.;
84 double x_loc, y_loc, z_loc, r_loc;
91 x_loc = r_loc*std::cos(phi_loc);
92 y_loc = r_loc*std::sin(phi_loc);
99 m_x_raw =
static_cast<float> (globalDefCoords.x());
100 m_y_raw =
static_cast<float> (globalDefCoords.y());
101 m_z_raw =
static_cast<float> (globalDefCoords.z());
103 m_x =
static_cast<float> (globalAbsCoords.x());
104 m_y =
static_cast<float> (globalAbsCoords.y());
105 m_z =
static_cast<float> (globalAbsCoords.z());
107 const double r_raw= std::sqrt(globalDefCoords.x()*globalDefCoords.x()+globalDefCoords.y()*globalDefCoords.y());
110 const double r = std::sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y());
111 m_r=
static_cast<float>(
r);
115 const double big_r = std::sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y()+globalAbsCoords.z()*globalAbsCoords.z());
116 const double inv_big_r = 1. / big_r;
117 const double inv_r = 1. /
r;
118 m_eta =
static_cast<float> (-std::log((big_r-globalAbsCoords.z()) * inv_r));
119 m_sinTh =
static_cast<float> (
r * inv_big_r);
120 m_cosTh =
static_cast<float> (globalAbsCoords.z() * inv_big_r);
121 m_cosPhi=globalAbsCoords.x() * inv_r;
122 m_sinPhi=globalAbsCoords.y() * inv_r;
129 m_phi_raw =
static_cast<float> (std::atan2(globalDefCoords.y(),globalDefCoords.x()));
130 m_phi =
static_cast<float> (std::atan2(globalAbsCoords.y(),globalAbsCoords.x()));
133 m_dphi =
static_cast<float> (std::abs(
m_cell->getPhiLocalUpper() -
m_cell->getPhiLocalLower()));
148 return m_region->getSamplingIndex();
176 if(
m_cell->getEndcapIndex()==0)
181 double x_loc, y_loc, z_loc, r_loc;
186 if(
m_cell->getEndcapIndex()==0)
208 m_x_raw =
static_cast<float> (globalNomCoords.x());
209 m_y_raw =
static_cast<float> (globalNomCoords.y());
210 m_z_raw =
static_cast<float> (globalNomCoords.z());
212 m_x =
static_cast<float> (globalAbsCoords.x());
213 m_y =
static_cast<float> (globalAbsCoords.y());
214 m_z =
static_cast<float> (globalAbsCoords.z());
217 const double r_raw= sqrt(globalNomCoords.x()*globalNomCoords.x()+globalNomCoords.y()*globalNomCoords.y());
220 const double r = sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y());
221 m_r=
static_cast<float>(
r);
225 const double big_r = std::sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y()+globalAbsCoords.z()*globalAbsCoords.z());
226 const double inv_big_r = 1. / big_r;
227 const double inv_r = 1. /
r;
228 m_eta =
static_cast<float> (-log((big_r-globalAbsCoords.z()) * inv_r));
229 m_sinTh =
static_cast<float> (
r * inv_big_r);
230 m_cosTh =
static_cast<float> (globalAbsCoords.z() * inv_big_r);
231 m_cosPhi=globalAbsCoords.x() * inv_r;
232 m_sinPhi=globalAbsCoords.y() * inv_r;
239 m_phi =
static_cast<float> (std::atan2(globalAbsCoords.y(),globalAbsCoords.x()));
242 m_dphi =
static_cast<float> (std::abs(
m_cell->getPhiLocalLower() -
m_cell->getPhiLocalUpper()));
255 if(
m_cell->getEndcapIndex()==1)
264 if(
m_cell->getPhiLocalLower()<0)
273 return m_region->getSamplingIndex();
305 if(
m_cell->getEndcapIndex()==0)
308 double x_loc, y_loc, z_loc, r_loc;
317 if(
m_cell->getEndcapIndex()==0)
336 m_x_raw =
static_cast<float> (globalNomCoords.x());
337 m_y_raw =
static_cast<float> (globalNomCoords.y());
338 m_z_raw =
static_cast<float> (globalNomCoords.z());
340 m_x =
static_cast<float> (globalAbsCoords.x());
341 m_y =
static_cast<float> (globalAbsCoords.y());
342 m_z =
static_cast<float> (globalAbsCoords.z());
345 const double r_raw= std::sqrt(globalNomCoords.x()*globalNomCoords.x()+globalNomCoords.y()*globalNomCoords.y());
348 const double r = std::sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y());
349 m_r=
static_cast<float>(
r);
353 const double big_r = std::sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y()+globalAbsCoords.z()*globalAbsCoords.z());
354 const double inv_r = 1. /
r;
355 const double inv_big_r = 1. / big_r;
356 m_eta =
static_cast<float> (-std::log((big_r-globalAbsCoords.z()) * inv_r));
357 m_sinTh =
static_cast<float> (
r * inv_big_r);
358 m_cosTh =
static_cast<float> (globalAbsCoords.z() * inv_big_r);
359 m_cosPhi=globalAbsCoords.x() * inv_r;
360 m_sinPhi=globalAbsCoords.y() * inv_r;
367 m_phi =
static_cast<float> (std::atan2(globalAbsCoords.y(),globalAbsCoords.x()));
369 m_deta =
static_cast<float> (
m_cell->getEtaMaxNominal() -
m_cell->getEtaMinNominal());
370 m_dphi =
static_cast<float> (std::abs(
m_cell->getPhiLocalUpper() -
m_cell->getPhiLocalLower()));
383 if(
m_cell->getEndcapIndex()==1)
392 if(
m_cell->getPhiLocalLower()<0)
406 return m_region->getSamplingIndex();
432 double x_loc =
m_tile->getX();
433 double y_loc =
m_tile->getY();
451 std::cout<<
"Wrong FCAL module for TB, using FCAL1 !!!"<<std::endl;
463 m_x_raw =
static_cast<float> (globalDefCoords.x());
464 m_y_raw =
static_cast<float> (globalDefCoords.y());
465 m_z_raw =
static_cast<float> (globalDefCoords.z());
467 m_x =
static_cast<float> (globalAbsCoords.x());
468 m_y =
static_cast<float> (globalAbsCoords.y());
469 m_z =
static_cast<float> (globalAbsCoords.z());
480 const double r = std::sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y());
481 m_r=
static_cast<float>(
r);
485 const double big_r = std::sqrt(globalAbsCoords.x()*globalAbsCoords.x()+globalAbsCoords.y()*globalAbsCoords.y()+globalAbsCoords.z()*globalAbsCoords.z());
486 const double inv_big_r = 1. / big_r;
487 const double inv_r = 1. /
r;
488 m_eta =
static_cast<float> (-log((big_r-globalAbsCoords.z()) * inv_r));
489 m_sinTh =
static_cast<float> (
r * inv_big_r);
490 m_cosTh =
static_cast<float> (globalAbsCoords.z() * inv_big_r);
491 m_cosPhi=globalAbsCoords.x() * inv_r;
492 m_sinPhi=globalAbsCoords.y() * inv_r;
499 m_phi_raw =
static_cast<float> (std::atan2(globalDefCoords.y(),globalDefCoords.x()));
500 m_phi =
static_cast<float> (std::atan2(globalAbsCoords.y(),globalAbsCoords.x()));
503 const double r_raw= sqrt(globalDefCoords.x()*globalDefCoords.x()+globalDefCoords.y()*globalDefCoords.y());
508 const double big_r_raw = std::sqrt(globalDefCoords.x()*globalDefCoords.x()+globalDefCoords.y()*globalDefCoords.y()+globalDefCoords.z()*globalDefCoords.z());
511 m_eta_raw =
static_cast<float> (-std::log((big_r_raw-globalDefCoords.z())/
r_raw));
518 m_phi =
static_cast<float> (std::atan2(globalAbsCoords.y(),globalAbsCoords.x()));
519 m_phi_raw=
static_cast<float> (std::atan2(globalDefCoords.y(),globalDefCoords.x()));
548 m_r=
static_cast<float> (
r);
558 m_sinTh=
static_cast<float> (1/std::cosh(
eta));
562 m_z =
static_cast<float> (
r*std::sinh(
eta));
613(
const std::vector<const CaloDetDescrElement*>& fromelts)
615 if (fromelts.empty())
617 else if (fromelts.size() == 1)
656 return StatusCode::SUCCESS;
690 return StatusCode::SUCCESS;
703(
const std::vector<const CaloDetDescrElement*>& fromelts)
705 bool is_barrel = (fromelts[0]->dr() > 0);
707 double eta_raw_min = 99999;
708 double eta_raw_max = -99999;
709 double phi_raw_min = 99999;
710 double phi_raw_max = -99999;
711 double rz_raw_min = 99999;
712 double rz_raw_max = -99999;
723 double rz, rz_raw, drz;
726 rz_raw = fromelt->r_raw();
731 rz_raw = fromelt->z_raw();
735 eta_raw_min = std::min (eta_raw_min,
736 (
double)fromelt->eta_raw() - fromelt->deta()/2);
737 eta_raw_max = std::max (eta_raw_max,
738 (
double)fromelt->eta_raw() + fromelt->deta()/2);
740 phi_raw_min = std::min (phi_raw_min,
741 (
double)fromelt->phi_raw() - fromelt->dphi()/2);
742 phi_raw_max = std::max (phi_raw_max,
743 (
double)fromelt->phi_raw() + fromelt->dphi()/2);
745 rz_raw_min = std::min (rz_raw_min, rz_raw - drz / 2);
746 rz_raw_max = std::max (rz_raw_min, rz_raw + drz / 2);
748 etasum += fromelt->deta() * fromelt->eta();
749 detasum += fromelt->deta();
751 phisum += fromelt->dphi() * fromelt->phi();
752 dphisum += fromelt->dphi();
757 volume += fromelt->volume();
762 double eta_raw = (eta_raw_min + eta_raw_max) / 2;
763 double phi_raw = (phi_raw_min + phi_raw_max) / 2;
764 double rz_raw = (rz_raw_min + rz_raw_max) / 2;
766 m_deta = eta_raw_max - eta_raw_min;
769 m_dphi = phi_raw_max - phi_raw_min;
777 double eta = etasum / detasum;
778 double phi = phisum / dphisum;
794 m_dr = rz_raw_max - rz_raw_min;
802 double z = rzsum / drzsum;
803 r =
z / std::sinh(
eta);
805 m_dz = rz_raw_max - rz_raw_min;
820 return StatusCode::SUCCESS;
833(
const std::vector<const CaloDetDescrElement*>& fromelts)
835 double x_raw_min = 99999;
836 double x_raw_max = -99999;
837 double y_raw_min = 99999;
838 double y_raw_max = -99999;
839 double z_raw_min = 99999;
840 double z_raw_max = -99999;
857 x_raw_min = std::min (x_raw_min,
858 (
double)fromelt->x_raw() - fromelt->dx()/2);
859 x_raw_max = std::max (x_raw_max,
860 (
double)fromelt->x_raw() + fromelt->dx()/2);
862 y_raw_min = std::min (y_raw_min,
863 (
double)fromelt->y_raw() - fromelt->dy()/2);
864 y_raw_max = std::max (y_raw_max,
865 (
double)fromelt->y_raw() + fromelt->dy()/2);
867 z_raw_min = std::min (z_raw_min,
868 (
double)fromelt->z_raw() - fromelt->dz()/2);
869 z_raw_max = std::max (z_raw_max,
870 (
double)fromelt->z_raw() + fromelt->dz()/2);
873 xsum += fromelt->dx() * fromelt->x();
874 dxsum += fromelt->dx();
876 ysum += fromelt->dy() * fromelt->y();
877 dysum += fromelt->dy();
879 zsum += fromelt->dz() * fromelt->z();
880 dzsum += fromelt->dz();
883 volume += fromelt->volume();
888 double x_raw = (x_raw_min + x_raw_max) / 2;
889 double y_raw = (y_raw_min + y_raw_max) / 2;
890 double z_raw = (z_raw_min + z_raw_max) / 2;
900 m_dx = x_raw_max - x_raw_min;
901 m_dy = y_raw_max - y_raw_min;
902 m_dz = z_raw_max - z_raw_min;
905 double x = xsum / dxsum;
906 double y = ysum / dysum;
907 double z = zsum / dzsum;
909 double x =
m_x_raw + fromelts[0]->x() - fromelts[0]->x_raw();
910 double y =
m_y_raw + fromelts[0]->y() - fromelts[0]->y_raw();
911 double z =
m_z_raw + fromelts[0]->z() - fromelts[0]->z_raw();
921 const double r = hypot (
x,
y);
922 const double inv_r = 1. /
r;
927 const double big_r = std::sqrt (
x*
x +
y*
y +
z*
z);
929 const double inv_big_r = 1. / big_r;
931 m_eta = -std::log ((big_r -
z) * inv_r);
943 return StatusCode::SUCCESS;
960 m_r=
static_cast<float> (
r);
974 m_sinTh=
static_cast<float> (1/std::cosh(
eta));
978 m_z =
static_cast<float> (
r*std::sinh(
eta));
1018 m_dr=
static_cast<float> (
dr);
Scalar phi() const
phi method
Calo Subsystem specific Detector Elements + Dummy element for testing.
CaloPhiRange class declaration.
GeoIntrusivePtr< const EMBCell > EMBCellConstLink
GeoIntrusivePtr< const HECCell > HECCellConstLink
@Class: HECCellConstLink
This class groups all DetDescr information related to a CaloCell.
float cosPhi() const
for fast px py pz computation
void propagateRaw()
In test beam configurations force XXX=XXX_RAW.
float m_dy
cartesian coordinates : delta Y
float sinTh() const
for algorithm working in transverse Energy
float m_x
cartesian coordinates : X
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
float m_volume
cell volume
float y_raw() const
cell y_raw
float m_y
cartesian coordinates : Y
float r_raw() const
cell r_raw
float eta_raw() const
cell eta_raw
float dphi() const
cell dphi
float x_raw() const
cell x_raw
CaloDetDescrElement(const IdentifierHash subcaloHash, const IdentifierHash onl1, const IdentifierHash onl2, const CaloDetDescriptor *descriptor)
Constructor.
float eta() const
cell eta
float m_y_raw
cartesian coordinates : Y raw
float m_dx
cartesian coordinates : delta X
float sinPhi() const
for fast px py pz computation
float m_phi
cylindric coordinates : phi
float phi() const
cell phi
IdentifierHash onl2() const
cell online identifier 2
float m_eta
cylindric coordinates : eta
float m_sinPhi
cache to allow fast px py pz computation
float phi_raw() const
cell phi_raw
float deta() const
cell deta
float m_dz
cartesian coordinates : delta Z
float m_r_raw
cylindric coordinates : r_raw
float m_eta_raw
cylindric coordinates : eta_raw
float m_phi_raw
cylindric coordinates : phi_raw
float volume() const
cell volume
float m_sinTh
this one is cached for algorithm working in transverse Energy
float m_dr
cylindric coordinates : delta r
float m_cosPhi
cache to allow fast px py pz computation
float m_r
cylindric coordinates : r
float z_raw() const
cell z_raw
float m_cosTh
this one is cached for algorithm working in transverse Energy
float m_deta
cylindric coordinates : delta eta
float m_z
cartesian coordinates : Z
float m_x_raw
cartesian coordinates : X raw
float m_z_raw
cartesian coordinates : Z raw
const CaloDetDescriptor * descriptor() const
cell descriptor
IdentifierHash onl1() const
cell online identifier 1
float cosTh() const
for fast px py pz computation
float m_dphi
cylindric coordinates : delta phi
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
StatusCode updateSingle(const CaloDetDescrElement *fromelt)
Copy this element's geometry from the given offline element.
StatusCode updateBE(const std::vector< const CaloDetDescrElement * > &fromelts)
Update this element's geometry from a list of elements.
StatusCode updateFCAL(const std::vector< const CaloDetDescrElement * > &fromelts)
Update this element's geometry from a list of elements.
StatusCode updateNull()
Set this element's geometry to default values.
StatusCode update(const std::vector< const CaloDetDescrElement * > &fromelts)
Update this element's geometry from the given list of offline elements.
DummyDetDescrElement(const IdentifierHash subcaloHash, const IdentifierHash onl1, const IdentifierHash onl2, const CaloDetDescriptor *descriptor)
Constructor, takes all necessary parameters for the base class constructor.
void set_cylindric_raw(double eta_raw, double phi_raw, double r_raw)
set raw cylindric coordinates
void set_cylindric(double eta, double phi, double r)
set cylindric coordinates
void set_cylindric_size(double deta, double dphi, double dr)
set cylindric size deta/dphi/dr
virtual int getLayer() const override
get layer
EMBDetectorElement()=delete
default constructor hidden
EMBCellConstLink m_cell
EMB Cell description from LArReadoutGeometry.
const EMBDetectorRegion * m_region
EMB Region description from LArReadoutGeometry.
void init_description(const GeoAlignmentStore *geoAlignStore, const CaloElementPositionShift *posShift)
initialize base description
Smart Pointer to EMEC Cells.
void init_interpretation()
Fill all missing fields of CaloDetDescrElement which have not been filled by init_description()
const EMECDetectorRegion * m_region
EMEC Region description from LArReadoutGeometry.
virtual int getLayer() const override
get layer
EMECCellConstLink m_cell
EMEC Cell description from LArReadoutGeometry.
void init_description(bool isTestBeam, const GeoAlignmentStore *geoAlignStore, const CaloElementPositionShift *posShift)
initialize base description
EMECDetectorElement()=delete
default constructor hidden
virtual int getLayer() const override
get layer
const FCALTile * m_tile
FCAL Tile description from LArReadoutGeometry.
FCALDetectorElement()=delete
default constructor hidden
void init_description(bool isTestBeam, const GeoAlignmentStore *geoAlignStore, const CaloElementPositionShift *posShift)
initialize base description
const FCALModule * m_module
FCAL Module description from LArReadoutGeometry.
A tile of the forward calorimeter readout geometry.
Ensure that the extensions for the Vector3D are properly loaded.
HECCellConstLink m_cell
HEC Cell description from LArReadoutGeometry.
void init_description(bool isTestBeam, const GeoAlignmentStore *geoAlignStore, const CaloElementPositionShift *posShift)
initialize base description
void init_interpretation()
Fill all missing fields of CaloDetDescrElement which have not been filled by init_description()
const HECDetectorRegion * m_region
HEC Region description from LArReadoutGeometry.
virtual int getLayer() const override
get layer
HECDetectorElement()=delete
default constructor hidden
Description of a region of homogenous granularity in the hadronic endcap calorimeter.
This is a "hash" representation of an Identifier.
MbtsDetectorElement()
Constructor, initializes base class constructor parameters with default values.
virtual Identifier customID() const
void set_cylindric(double eta, double phi, double r)
set cylindric coordinates
TileDetectorElement(const IdentifierHash subcaloHash, const IdentifierHash onl1, const IdentifierHash onl2, const CaloDetDescriptor *descriptor)
Constructor, takes all necessary parameters for the base class constructor.
void set_cylindric_raw(double eta_raw, double phi_raw, double r_raw)
set raw cylindric coordinates
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
df
Printing table to screen.
dx,dy,dz displacement of the calorimeter cell caused by sagging