12 #include "GaudiKernel/ISvcLocator.h"
13 #include "GaudiKernel/Bootstrap.h"
14 #include "GaudiKernel/PhysicalConstants.h"
23 int phiGap(
double radius,
double xhit,
double yhit)
const;
39 const int &PhiC,
int &Num_Straight,
const int &Num_Coude,
45 const int &nabs,
const int &Num_Straight,
const int &Num_Coude);
76 const double dl=0.001;
77 const double inv_dl = 1 /
dl;
78 double cenx[15],ceny[15];
80 double sum1[5000],sumx[5000];
89 const double inv_rint = 1. / rint;
90 const double dt=
dl * inv_rint;
91 const double inv_dt = 1. /
dt;
97 for (
int i=0;
i<15;
i++) {
102 for (
int i=0;
i<15;
i++) {
125 int nstep=
int((phi1-
phi0) * inv_dt)+1;
127 for (
int ii=0;ii<nstep;ii++) {
144 double dx=cenx[
i+1]-cenx[
i];
145 double dy=ceny[
i+1]-ceny[
i];
146 double along=
dx*
dx+
dy*
dy-4.*rint*rint;
148 double x0=0.5*(cenx[
i+1]+cenx[
i]);
149 double y0=0.5*(ceny[
i+1]+ceny[
i]);
156 int nstep=
int(along * inv_dl)+1;
158 for (
int ii=0;ii<nstep;ii++) {
193 double phi_hit=atan2(yhit,xhit);
194 double dphi=phi_hit-phi_0;
196 if (dphi<0) dphi=dphi+m2pi;
197 if (dphi>=m2pi) dphi=dphi-m2pi;
198 dphi=dphi*(1024/m2pi);
199 int ngap=((
int) dphi);
208 ISvcLocator *svcLocator = Gaudi::svcLocator();
213 if(svcLocator->service(
"GeoModelSvc",geoModel) == StatusCode::FAILURE)
214 throw std::runtime_error(
"Error in HECDetectorManager, cannot access GeoModelSvc");
216 if(svcLocator->service(
"GeoDbTagSvc",geoDbTagSvc) == StatusCode::FAILURE)
217 throw std::runtime_error(
"Error in HECDetectorManager, cannot access GeoDbTagSvc");
219 if(svcLocator->service(geoDbTagSvc->getParamSvcName(),rdbAccess) == StatusCode::FAILURE)
220 throw std::runtime_error(
"Error in HECDetectorManager, cannot access RDBAccessSvc");
222 std::string detectorKey, detectorNode;
224 if(geoDbTagSvc->getSqliteReader()==
nullptr) {
226 std::string LArVersion = geoModel->LAr_VersionOverride();
228 detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
229 detectorNode = LArVersion.empty() ?
"ATLAS" :
"LAr";
232 IRDBRecordset_ptr barrelGeometry = rdbAccess->getRecordsetPtr(
"BarrelGeometry",detectorKey,detectorNode);
233 if (barrelGeometry->size()==0) {
234 throw std::runtime_error(
"Cannot find the BarrelGeometry Table");
237 IRDBRecordset_ptr barrelLongDiv = rdbAccess->getRecordsetPtr(
"BarrelLongDiv",detectorKey,detectorNode);
238 if (barrelLongDiv->size()==0) {
239 throw std::runtime_error(
"Cannot find the BarrelLongDiv Table");
243 m_c->
Nbrt = (*barrelGeometry)[0]->getInt(
"NBRT");
247 m_c->
gam0 = (*barrelGeometry)[0]->getDouble(
"PHIFIRST");
252 for (
int idat = 0; idat <
m_c->
Nbrt1 ; idat++)
268 m_c->
NCellTot = (*barrelGeometry)[0]->getInt(
"NCELMX");
301 ISvcLocator* svcLocator = Gaudi::svcLocator();
307 if (
status != StatusCode::SUCCESS)
throw std::runtime_error (
"Cannot locate Storegate");
311 if (
status != StatusCode::SUCCESS)
throw std::runtime_error (
"Cannot locate Straight Absorbers");
324 ISvcLocator* svcLocator = Gaudi::svcLocator();
330 if (
status != StatusCode::SUCCESS)
throw std::runtime_error (
"Cannot locate Storegate");
333 if (
status != StatusCode::SUCCESS)
throw std::runtime_error (
"Cannot locate Straight Electrodes");
364 const double &yhit,
const int &PhiCell,
int &Num_Straight,
365 const int &Num_Coude,
double &xl)
380 Xc[0] = m_coudeelec->XCentCoude(Num_Coude, PhiCell);
381 Xc[1] = m_coudeelec->YCentCoude(Num_Coude, PhiCell);
382 double radfold = sqrt(Xc[0]*Xc[0]+Xc[1]*Xc[1]);
383 double radhit = sqrt(xhit*xhit+yhit*yhit);
387 if (Num_Coude == Num_Straight && radhit <radfold) {
388 if (Num_Straight>0) Num_Straight = Num_Straight-1;
391 if (Num_Coude == (Num_Straight+1) && radhit > radfold) {
392 if (Num_Straight<12) Num_Straight = Num_Straight+1;
398 u[0] = m_electrode->Cosu(Num_Straight, PhiCell);
399 u[1] = m_electrode->Sinu(Num_Straight, PhiCell);
402 Xm[0] = m_electrode->XCentEle(Num_Straight, PhiCell);
403 Xm[1] = m_electrode->YCentEle(Num_Straight, PhiCell);
405 dx = xhit - Xm[0];
dy = yhit - Xm[1];
409 double m_hit =
dx*
u[0] +
dy*
u[1];
415 Half_Elec = m_electrode->HalfLength(Num_Straight,PhiCell);
417 if(fabs(m_hit) < Half_Elec) {
419 DistEle =
u[0]*
dy -
u[1]*
dx;
426 DistEle = (Num_Coude%2 == 0) ? (rint_eleFib-
dr) : (
dr - rint_eleFib);
427 if (Num_Coude==Num_Straight) xl=-1.;