16#include "GaudiKernel/Bootstrap.h"
17#include "GaudiKernel/ISvcLocator.h"
28#include "CLHEP/Geometry/Point3D.h"
29#include "CLHEP/Geometry/Transform3D.h"
32using HepGeom::Point3D;
33using HepGeom::Transform3D;
44 if (
verbose) { G4cout << GetName() <<
"::initialize()" << G4endl; }
46 throw std::runtime_error(
"Could not retrieve EMEC manager");
51 ISvcLocator* svcLocator = Gaudi::svcLocator();
54 SmartIF<IGeoModelSvc> geoModel{svcLocator->service (
"GeoModelSvc")};
57 "LArWheelSliceSolid",
"AccessGeoModel", FatalException,
58 "createSolid cannot access GeoModelSvc");
61 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service (
"GeoDbTagSvc")};
64 "LArWheelSliceSolid",
"AccessDbTagSvc", FatalException,
65 "createSolid cannot access DbTagSvc");
69 SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service(geoDbTagSvc->getParamSvcName())};
72 "LArWheelSliceSolid",
"AccessAccessSvc", FatalException,
73 "createSolid cannot access AccessSvc");
97 Point3D<double> localPosition = globalPosition.z()<0 ? xfNeg*globalPosition : xfPos*globalPosition;
98 Point3D<double> shiftedLocalPosition = localPosition + Point3D<double>(0.0,0.0,
m_emecManager->getFocalToRef()+
m_emecManager->getRefToActive());
99 int zIndex = globalPosition.z()<0 ? 0:1;
100 double eta = shiftedLocalPosition.getEta();
101 double phi = localPosition.getPhi();
102 double z = localPosition.z();
109 const CellBinning & etaBinning=regionDescriptor->
getEtaBinning();
110 if (
eta>etaBinning.getStart() &&
eta<etaBinning.getEnd()) {
112 unsigned int etaIndex = int((
eta - etaBinning.getStart())/etaBinning.getDelta()) + etaBinning.getFirstDivisionNumber();
113 unsigned int phiIndex = 0;
117 if (
z>zmin &&
z<zmax) {
118 const CellBinning & phiBinning=regionDescriptor->
getPhiBinning();
119 double minPhi=std::min(phiBinning.getStart(), phiBinning.getEnd());
120 double maxPhi=std::max(phiBinning.getStart(), phiBinning.getEnd());
128 int sWheel = zIndex==0 ? -wheel: wheel;
134 int nBins= phiBinning.getNumDivisions();
135 int gapsPerBin = nGaps/nBins;
151 throw std::runtime_error(
"Error, unknown wheel in EndcapFastSimDedicatedSD");
154 int phiBin = wheelCalc->
GetPhiGap(localPosition)/gapsPerBin;
157 phiBin = (nBins-2)/2 - phiBin;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Eigen::Affine3d Transform3D
Definition of the abstract IRDBAccessSvc interface.
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Smart Pointer to EMEC Cells.
Descriptor for regions of the electromagnetic endcap calorimeter.
const CellBinning & getEtaBinning() const
The Binning in Eta.
const CellBinning & getPhiBinning() const
The Binning in Phi.
std::vector< constEMECDetectorRegion * >::const_iterator DetectorRegionConstIterator
EMECCellConstLink getEMECCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int getRadialIndex() const
Returns the Radial (Outer Wheel=0,InnerWheel=1) Index.
unsigned int getRegionIndex() const
Returns the Region Index.
EMECDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
const EMECDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
EMECDetectorManager * m_emecManager
void ProcessSpot(const EnergySpot &spot, double weight) override final
ProcessHitsMethod.
EndcapFastSimDedicatedSD(StoreGateSvc *, bool verbose)
LArWheelCalculator * m_innerWheelCalculatorNeg
LArWheelCalculator * m_outerWheelCalculatorNeg
LArG4Identifier m_larID
My LAr identifier.
LArWheelCalculator * m_outerWheelCalculatorPos
LArWheelCalculator * m_innerWheelCalculatorPos
G4ThreeVector GetPosition() const
G4double GetEnergy() const
IFastSimDedicatedSD(const std::string &name, StoreGateSvc *detStore)
Simple constructor and destructor.
G4bool SimpleHit(const LArG4Identifier &lar_id, G4double time, G4double energy)
First method translates to this - also for fast sims.
This class separates some of the geometry details of the LAr endcap.
int GetPhiGap(const CLHEP::Hep3Vector &p) const
The Athena Transient Store API.
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
EMECData toEMECData(IRDBAccessSvc *rdbAccess, const DecodeVersionKey &larVersionKey)