38 if (std::fabs(deltaPosition.
GetZ()) > std::numeric_limits<float>::epsilon())
39 return (deltaPosition.
GetZ() > std::numeric_limits<float>::epsilon());
41 if (std::fabs(deltaPosition.
GetX()) > std::numeric_limits<float>::epsilon())
42 return (deltaPosition.
GetX() > std::numeric_limits<float>::epsilon());
44 if (std::fabs(deltaPosition.
GetY()) > std::numeric_limits<float>::epsilon())
45 return (deltaPosition.
GetY() > std::numeric_limits<float>::epsilon());
53 m_positionVector(parameters.m_positionVector.Get()),
55 m_expectedDirection(parameters.m_expectedDirection.Get().GetUnitVector()),
56 m_cellNormalVector(parameters.m_cellNormalVector.Get().GetUnitVector()),
57 m_cellGeometry(parameters.m_cellGeometry.Get()),
58 m_cellSize0(parameters.m_cellSize0.Get()),
59 m_cellSize1(parameters.m_cellSize1.Get()),
60 m_cellThickness(parameters.m_cellThickness.Get()),
61 m_nCellRadiationLengths(parameters.m_nCellRadiationLengths.Get()),
62 m_nCellInteractionLengths(parameters.m_nCellInteractionLengths.Get()),
63 m_time(parameters.m_time.Get()),
64 m_inputEnergy(parameters.m_inputEnergy.Get()),
65 m_mipEquivalentEnergy(parameters.m_mipEquivalentEnergy.Get()),
66 m_electromagneticEnergy(parameters.m_electromagneticEnergy.Get()),
67 m_hadronicEnergy(parameters.m_hadronicEnergy.Get()),
68 m_isDigital(parameters.m_isDigital.Get()),
69 m_hitType(parameters.m_hitType.Get()),
70 m_hitRegion(parameters.m_hitRegion.Get()),
71 m_layer(parameters.m_layer.Get()),
72 m_isInOuterSamplingLayer(parameters.m_isInOuterSamplingLayer.Get()),
73 m_cellLengthScale(0.f),
74 m_isPossibleMip(false),
78 m_pParentAddress(parameters.m_pParentAddress.Get())
86 m_positionVector(parameters.m_pOriginalCaloHit->m_positionVector),
87 m_x0(parameters.m_pOriginalCaloHit->m_x0),
88 m_expectedDirection(parameters.m_pOriginalCaloHit->m_expectedDirection),
89 m_cellNormalVector(parameters.m_pOriginalCaloHit->m_cellNormalVector),
90 m_cellGeometry(parameters.m_pOriginalCaloHit->m_cellGeometry),
91 m_cellSize0(parameters.m_pOriginalCaloHit->m_cellSize0),
92 m_cellSize1(parameters.m_pOriginalCaloHit->m_cellSize1),
93 m_cellThickness(parameters.m_pOriginalCaloHit->m_cellThickness),
94 m_nCellRadiationLengths(parameters.m_pOriginalCaloHit->m_nCellRadiationLengths),
95 m_nCellInteractionLengths(parameters.m_pOriginalCaloHit->m_nCellInteractionLengths),
96 m_time(parameters.m_pOriginalCaloHit->m_time),
97 m_inputEnergy(parameters.m_weight.Get() * parameters.m_pOriginalCaloHit->m_inputEnergy),
98 m_mipEquivalentEnergy(parameters.m_weight.Get() * parameters.m_pOriginalCaloHit->m_mipEquivalentEnergy),
99 m_electromagneticEnergy(parameters.m_weight.Get() * parameters.m_pOriginalCaloHit->m_electromagneticEnergy),
100 m_hadronicEnergy(parameters.m_weight.Get() * parameters.m_pOriginalCaloHit->m_hadronicEnergy),
101 m_isDigital(parameters.m_pOriginalCaloHit->m_isDigital),
102 m_hitType(parameters.m_pOriginalCaloHit->m_hitType),
103 m_hitRegion(parameters.m_pOriginalCaloHit->m_hitRegion),
104 m_layer(parameters.m_pOriginalCaloHit->m_layer),
105 m_pseudoLayer(parameters.m_pOriginalCaloHit->m_pseudoLayer),
106 m_isInOuterSamplingLayer(parameters.m_pOriginalCaloHit->m_isInOuterSamplingLayer),
107 m_cellLengthScale(parameters.m_pOriginalCaloHit->m_cellLengthScale),
108 m_isPossibleMip(parameters.m_pOriginalCaloHit->m_isPossibleMip),
109 m_isIsolated(parameters.m_pOriginalCaloHit->m_isIsolated),
110 m_isAvailable(parameters.m_pOriginalCaloHit->m_isAvailable),
111 m_weight(parameters.m_weight.Get() * parameters.m_pOriginalCaloHit->m_weight),
112 m_mcParticleWeightMap(parameters.m_pOriginalCaloHit->m_mcParticleWeightMap),
113 m_pParentAddress(parameters.m_pOriginalCaloHit->m_pParentAddress)
116 mapEntry.second = mapEntry.second * parameters.m_weight.Get();
129 if (metadata.m_x0.IsInitialized())
131 const float oldX0(
m_x0);
132 m_x0 = metadata.m_x0.Get();
136 if (metadata.m_isPossibleMip.IsInitialized())
139 if (metadata.m_isIsolated.IsInitialized())
142 return STATUS_CODE_SUCCESS;
150 return STATUS_CODE_NOT_INITIALIZED;
152 return STATUS_CODE_SUCCESS;
179 float radius(0.f), phi(0.f), theta(0.f);
181 const float centralEta(-1.f * std::log(std::tan(theta / 2.f)));
184 const float thetaMin(2.f * std::atan(std::exp(-1.f * etaMin))), thetaMax(2.f * std::atan(std::exp(-1.f * etaMax)));
186 return std::sqrt(std::fabs(radius * this->
GetCellSize1() * radius * (thetaMax - thetaMin)));
208 cartesianPointVector.push_back(
CartesianVector(position - dirU - dirV - normal));
209 cartesianPointVector.push_back(
CartesianVector(position + dirU - dirV - normal));
210 cartesianPointVector.push_back(
CartesianVector(position + dirU + dirV - normal));
211 cartesianPointVector.push_back(
CartesianVector(position - dirU + dirV - normal));
213 cartesianPointVector.push_back(
CartesianVector(position - dirU - dirV + normal));
214 cartesianPointVector.push_back(
CartesianVector(position + dirU - dirV + normal));
215 cartesianPointVector.push_back(
CartesianVector(position + dirU + dirV + normal));
216 cartesianPointVector.push_back(
CartesianVector(position - dirU + dirV + normal));
223 float radius(0.f), phi(0.f), theta(0.f);
225 const float centralEta(-1.f * std::log(std::tan(theta / 2.f)));
230 const float thetaMin(2.f * std::atan(std::exp(-1.f * etaMin))), thetaMax(2.f * std::atan(std::exp(-1.f * etaMax)));
232 const float sinTheta(std::sin(theta)), cosTheta(std::cos(theta));
233 const float sinThetaMin(std::sin(thetaMin)), cosThetaMin(std::cos(thetaMin)), sinPhiMin(std::sin(phiMin)), cosPhiMin(std::cos(phiMin));
234 const float sinThetaMax(std::sin(thetaMax)), cosThetaMax(std::cos(thetaMax)), sinPhiMax(std::sin(phiMax)), cosPhiMax(std::cos(phiMax));
236 float thetaMinRScale(1.f), thetaMaxRScale(1.f);
240 if (std::fabs(sinThetaMin) > std::numeric_limits<float>::epsilon())
241 thetaMinRScale = std::fabs(sinTheta / sinThetaMin);
243 if (std::fabs(sinThetaMax) > std::numeric_limits<float>::epsilon())
244 thetaMaxRScale = std::fabs(sinTheta / sinThetaMax);
248 if (std::fabs(cosThetaMin) > std::numeric_limits<float>::epsilon())
249 thetaMinRScale = std::fabs(cosTheta / cosThetaMin);
251 if (std::fabs(cosThetaMax) > std::numeric_limits<float>::epsilon())
252 thetaMaxRScale = std::fabs(cosTheta / cosThetaMax);
255 const float rMinAtThetaMin(thetaMinRScale * rMin), rMinAtThetaMax(thetaMaxRScale * rMin);
256 const float rMaxAtThetaMin(thetaMinRScale * rMax), rMaxAtThetaMax(thetaMaxRScale * rMax);
258 cartesianPointVector.push_back(
CartesianVector(rMinAtThetaMin * sinThetaMin * cosPhiMin, rMinAtThetaMin * sinThetaMin * sinPhiMin, rMinAtThetaMin * cosThetaMin));
259 cartesianPointVector.push_back(
CartesianVector(rMinAtThetaMax * sinThetaMax * cosPhiMin, rMinAtThetaMax * sinThetaMax * sinPhiMin, rMinAtThetaMax * cosThetaMax));
260 cartesianPointVector.push_back(
CartesianVector(rMinAtThetaMax * sinThetaMax * cosPhiMax, rMinAtThetaMax * sinThetaMax * sinPhiMax, rMinAtThetaMax * cosThetaMax));
261 cartesianPointVector.push_back(
CartesianVector(rMinAtThetaMin * sinThetaMin * cosPhiMax, rMinAtThetaMin * sinThetaMin * sinPhiMax, rMinAtThetaMin * cosThetaMin));
263 cartesianPointVector.push_back(
CartesianVector(rMaxAtThetaMin * sinThetaMin * cosPhiMin, rMaxAtThetaMin * sinThetaMin * sinPhiMin, rMaxAtThetaMin * cosThetaMin));
264 cartesianPointVector.push_back(
CartesianVector(rMaxAtThetaMax * sinThetaMax * cosPhiMin, rMaxAtThetaMax * sinThetaMax * sinPhiMin, rMaxAtThetaMax * cosThetaMax));
265 cartesianPointVector.push_back(
CartesianVector(rMaxAtThetaMax * sinThetaMax * cosPhiMax, rMaxAtThetaMax * sinThetaMax * sinPhiMax, rMaxAtThetaMax * cosThetaMax));
266 cartesianPointVector.push_back(
CartesianVector(rMaxAtThetaMin * sinThetaMin * cosPhiMax, rMaxAtThetaMin * sinThetaMin * sinPhiMax, rMaxAtThetaMin * cosThetaMin));
Header file for the calo hit class.
void GetPointingCellCorners(CartesianPointVector &cartesianPointVector) const
Get the list of cartesian coordinates for pointing cell corners.
CellGeometry GetCellGeometry() const
Get the cell geometry.
HitRegion GetHitRegion() const
Get the region of the detector in which the calo hit is located.
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
bool m_isIsolated
Whether the calo hit is isolated.
virtual ~CaloHit()
Destructor.
float CalculateCellLengthScale() const
Calculate the typical length scale of the cell, units mm.
void SetMCParticleWeightMap(const MCParticleWeightMap &mcParticleWeightMap)
Set the mc particles associated with the calo hit.
CaloHit(const object_creation::CaloHit::Parameters ¶meters)
Constructor.
CartesianVector m_positionVector
Position vector of center of calorimeter cell, units mm.
InputUInt m_pseudoLayer
The pseudo layer to which the calo hit has been assigned.
void GetCellCorners(CartesianPointVector &cartesianPointVector) const
Get the list of cartesian coordinates for the cell corners.
float m_x0
For LArTPC usage, the x-coordinate shift associated with a drift time t0 shift, units mm.
bool m_isPossibleMip
Whether the calo hit is a possible mip hit.
float GetCellThickness() const
Get the thickness of cell, units mm.
float GetCellSize1() const
Get the cell size 1 [pointing: phi, rectangular: perpendicular to size 0 and thickness,...
void GetRectangularCellCorners(CartesianPointVector &cartesianPointVector) const
Get the list of cartesian coordinates for rectangular cell corners.
StatusCode AlterMetadata(const object_creation::CaloHit::Metadata &metadata)
Alter the metadata information stored in a calo hit.
float GetCellSize0() const
Get the cell size 0 [pointing: eta, rectangular: up in ENDCAP, along beam in BARREL,...
bool operator<(const CaloHit &rhs) const
operator< sorting by position, then energy
const CartesianVector & GetCellNormalVector() const
Get the unit vector normal to the sampling layer, pointing outwards from the origin.
float GetInputEnergy() const
Get the corrected energy of the calorimeter cell, units GeV, as supplied by the user.
float m_cellLengthScale
Typical length scale [pointing: measured at cell mid-point, rectangular: std::sqrt(cellSize0 * cellSi...
MCParticleWeightMap m_mcParticleWeightMap
The mc particle weight map.
void RemoveMCParticles()
Remove the mc particles associated with the calo hit.
StatusCode SetPseudoLayer(const unsigned int pseudoLayer)
Set the mc pseudo layer for the calo hit.
float GetX() const
Get the cartesian x coordinate.
void GetSphericalCoordinates(float &radius, float &phi, float &theta) const
Get the spherical coordinates of the cartesian vector.
float GetZ() const
Get the cartesian z coordinate.
CartesianVector GetCrossProduct(const CartesianVector &rhs) const
Get the cross product of the cartesian vector with a second cartesian vector.
float GetY() const
Get the cartesian y coordinate.
StatusCodeException class.
std::unordered_map< const MCParticle *, float > MCParticleWeightMap
std::vector< CartesianVector > CartesianPointVector
StatusCode
The StatusCode enum.