14 #include "CLHEP/Geometry/Point3D.h"
15 #include "CLHEP/Geometry/Transform3D.h"
18 using HepGeom::Point3D;
20 using CLHEP::Hep3Vector;
25 , m_embManager(nullptr)
26 , m_accordionDetails(nullptr)
27 , m_absorberSections(nullptr)
29 if (
verbose) { G4cout << GetName() <<
"::initialize()" << G4endl; }
31 throw std::runtime_error(
"Could not retrieve EMB manager");
46 Point3D<double> localPosition = globalPosition.z()<0 ? xfNeg*globalPosition : xfPos*globalPosition;
47 int zIndex = globalPosition.z() <0 ? 0:1;
48 double eta = localPosition.getEta();
49 double phi = localPosition.getPhi();
50 double r = localPosition.perp();
52 bool implementWaves=
true;
59 const CellBinning & etaBinning=regionDescriptor->
getEtaBinning();
60 if (
eta>etaBinning.getStart() &&
eta<etaBinning.getEnd()) {
61 unsigned int etaIndex =
int((
eta - etaBinning.getStart())/etaBinning.getDelta()) + etaBinning.getFirstDivisionNumber();
66 if (
r>rmin &&
r<rmax) {
67 const CellBinning & phiBinning=regionDescriptor->
getPhiBinning();
68 double minPhi=
std::min(phiBinning.getStart(), phiBinning.getEnd());
69 double maxPhi=
std::max(phiBinning.getStart(), phiBinning.getEnd());
75 unsigned int phiIndex =
int((
phi - phiBinning.getStart())/phiBinning.getDelta()) + phiBinning.getFirstDivisionNumber();
78 if (samplingIndex!=0) {
81 double delta=-2.0*
M_PI/1024/2;
83 double phiLocalUpper=cellPtr->getPhiLocalUpper()-delta;
84 double phiLocalLower=cellPtr->getPhiLocalLower()-delta;
86 while (phiLocalLower<0) phiLocalLower += 2.0*
M_PI;
87 while (phiLocalUpper<0) phiLocalUpper += 2.0*
M_PI;
88 while (phiLocalLower>2*
M_PI) phiLocalLower -= 2.0*
M_PI;
89 while (phiLocalUpper>2*
M_PI) phiLocalUpper -= 2.0*
M_PI;
91 int accordionIndexUpper=
int(phiLocalUpper/(2*
M_PI)*1024+0.25);
if (accordionIndexUpper==1024) accordionIndexUpper=0;
92 int accordionIndexLower=
int(phiLocalLower/(2*
M_PI)*1024+0.25);
if (accordionIndexLower==1024) accordionIndexLower=0;
102 Point3D<double> P0=Point3D<double>(localPosition.x(), localPosition.y(),0)-A0;
103 int stackIndex=
int(A1.dot(P0)/A1.mag2()*22.0 + 3.0)/2 ;
105 if (stackIndex<0 || stackIndex>13) {
106 G4cout <<
"Warning, bad stack index " << stackIndex <<
' ' << rmin <<
' ' <<
r <<
' ' << A0.perp() <<
' ' << A0 <<
' ' << A1 <<
' ' << P0 << G4endl;
107 if (implementWaves)
return;
115 Point3D<double>
u(xcent-halfLength*cosU, ycent-halfLength*sinU,0);
116 Point3D<double>
v(xcent+halfLength*cosU, ycent+halfLength*sinU,0);
117 Point3D<double>
x=
v-
u,
y=Hep3Vector(localPosition.x(),localPosition.y(),0)-
u;
119 if (implementWaves) {
130 Point3D<double>
u(xcent-halfLength*cosU, ycent-halfLength*sinU,0);
131 Point3D<double>
v(xcent+halfLength*cosU, ycent+halfLength*sinU,0);
132 Point3D<double>
x=
v-
u,
y=Hep3Vector(localPosition.x(),localPosition.y(),0)-
u;
134 if (implementWaves) {