16#include "GaudiKernel/Bootstrap.h"
17#include "GaudiKernel/ISvcLocator.h"
28#include "CLHEP/Geometry/Point3D.h"
29#include "CLHEP/Geometry/Transform3D.h"
34using HepGeom::Point3D;
35using HepGeom::Transform3D;
39 std::string hitCollectionName,
42 std::move(hitCollectionName))
49 if (
verbose) { G4cout << GetName() <<
"::initialize()" << G4endl; }
51 throw std::runtime_error(
"Could not retrieve EMEC manager");
56 ISvcLocator* svcLocator = Gaudi::svcLocator();
59 SmartIF<IGeoModelSvc> geoModel{svcLocator->service (
"GeoModelSvc")};
62 "LArWheelSliceSolid",
"AccessGeoModel", FatalException,
63 "createSolid cannot access GeoModelSvc");
66 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service (
"GeoDbTagSvc")};
69 "LArWheelSliceSolid",
"AccessDbTagSvc", FatalException,
70 "createSolid cannot access DbTagSvc");
74 SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service(geoDbTagSvc->getParamSvcName())};
77 "LArWheelSliceSolid",
"AccessAccessSvc", FatalException,
78 "createSolid cannot access AccessSvc");
102 Point3D<double> localPosition = globalPosition.z()<0 ? xfNeg*globalPosition : xfPos*globalPosition;
103 Point3D<double> shiftedLocalPosition = localPosition + Point3D<double>(0.0,0.0,
m_emecManager->getFocalToRef()+
m_emecManager->getRefToActive());
104 int zIndex = globalPosition.z()<0 ? 0:1;
105 double eta = shiftedLocalPosition.getEta();
106 double phi = localPosition.getPhi();
107 double z = localPosition.z();
114 const CellBinning & etaBinning=regionDescriptor->
getEtaBinning();
115 if (
eta>etaBinning.getStart() &&
eta<etaBinning.getEnd()) {
117 unsigned int etaIndex = int((
eta - etaBinning.getStart())/etaBinning.getDelta()) + etaBinning.getFirstDivisionNumber();
118 unsigned int phiIndex = 0;
122 if (
z>zmin &&
z<zmax) {
123 const CellBinning & phiBinning=regionDescriptor->
getPhiBinning();
124 double minPhi=std::min(phiBinning.getStart(), phiBinning.getEnd());
125 double maxPhi=std::max(phiBinning.getStart(), phiBinning.getEnd());
133 int sWheel = zIndex==0 ? -wheel: wheel;
139 int nBins= phiBinning.getNumDivisions();
140 int gapsPerBin = nGaps/nBins;
156 throw std::runtime_error(
"Error, unknown wheel in EndcapFastSimDedicatedSD");
159 int phiBin = wheelCalc->
GetPhiGap(localPosition)/gapsPerBin;
162 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 *, std::string hitCollectionName, 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, std::string hitCollectionName)
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.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
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)