|
|
Go to the documentation of this file.
43 typedef std::pair<const GeomDet*, TrajectoryStateOnSurface>
DetWithState;
69 std::vector<std::unique_ptr<Particle>>& secondaries,
91 double layerThickness,
127 std::vector<std::unique_ptr<Particle>>& secondaries,
136 if (!doHitsFromInboundParticles_) {
168 if (particle.
charge() == 0) {
175 if (particle.
momentum().Perp2() < minMomentum_ * minMomentum_) {
200 std::map<double, std::unique_ptr<PSimHit>> distAndHits;
212 for (
const auto& detectorWithState : compatibleDetectors) {
218 std::pair<double, std::unique_ptr<PSimHit>> hitPair = createHitOnDetector(particleState,
225 if (hitPair.second) {
226 distAndHits.insert(distAndHits.end(),
std::move(hitPair));
230 for (
const auto component :
detector.components()) {
231 std::pair<double, std::unique_ptr<PSimHit>> hitPair =
232 createHitOnDetector(particleState,
239 if (hitPair.second) {
240 distAndHits.insert(distAndHits.end(),
std::move(hitPair));
247 for (
std::map<
double, std::unique_ptr<PSimHit>>::const_iterator it = distAndHits.begin(); it != distAndHits.end();
249 simHitContainer_->push_back(*(it->second));
257 double layerThickness,
278 std::pair<bool, double>
path = crossing.pathLength(
detector.surface());
287 return std::pair<double, std::unique_ptr<PSimHit>>(0, std::unique_ptr<PSimHit>(
nullptr));
294 double pZ = localMomentum.
z();
296 LocalPoint exit = localPosition + (halfThick / pZ) * localMomentum;
300 double boundX = detectorPlane.
bounds().
width() / 2.;
303 unsigned subdet =
DetId(
detector.geographicalId()).subdetId();
304 if (subdet == 4 || subdet == 6)
305 boundX *= 1. - localPosition.
y() / detectorPlane.
position().
perp();
306 if (fabs(localPosition.
x()) > boundX || fabs(localPosition.
y()) > boundY) {
307 return std::pair<double, std::unique_ptr<PSimHit>>(0, std::unique_ptr<PSimHit>(
nullptr));
314 eLoss *= (2. * halfThick - 0.003) / (9.36 * layerThickness);
319 return std::pair<double, std::unique_ptr<PSimHit>>(
320 (hitPos - refPos).
mag(),
329 localMomentum.
theta(),
330 localMomentum.
phi())));
const double onSurfaceTolerance_
Max distance between particle and active (sub-) module. Otherwise particle has to be propagated.
static constexpr double speedOfLight
Speed of light [cm / ns].
LocalVector localMomentum() const
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
virtual float width() const =0
Geom::Theta< T > theta() const
void registerProducts(edm::ProducesCollector) const override
Register the SimHit collection.
GlobalPoint globalPosition() const
std::pair< double, std::unique_ptr< PSimHit > > createHitOnDetector(const TrajectoryStateOnSurface &particle, int pdgId, double layerThickness, double eLoss, int simTrackId, const GeomDet &detector, GlobalPoint &refPos)
Helper funtion to create the actual SimHit on a detector (sub-) module.
Implementation of a generic detector layer (base class for forward/barrel layers).
int getMotherSimTrackIndex() const
Get index of simTrack of mother particle (only makes sense if mother and daughter charged).
TrackerSimHitProducer(const std::string &name, const edm::ParameterSet &cfg)
Constructor.
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
double transverseCurvature() const
int simTrackIndex() const
Return index of the SimTrack.
Global3DVector GlobalVector
void setEnergyDeposit(double energyDeposit)
Set the energy the particle deposited in the tracker layer that was last hit (ionization).
virtual float length() const =0
Base class for any interaction model between a particle and a tracker layer.
virtual const double getMagneticFieldZ(const math::XYZTLorentzVector &position) const =0
Return magnetic field (field only has Z component!) on the layer.
double getEnergyDeposit() const
Return the energy the particle deposited in the tracker layer that was last hit (ionization).
void setLooper()
This particle is about to do a loop in the tracker or the direction of the momentum is going inwards.
Vector3DBase unit() const
virtual const double getThickness(const math::XYZTLorentzVector &position) const =0
Return thickness of the layer at a given position.
std::unique_ptr< edm::PSimHitContainer > simHitContainer_
The SimHit.
const Bounds & bounds() const
Global3DPoint GlobalPoint
#define DEFINE_EDM_PLUGIN(factory, type, name)
const math::XYZTLorentzVector & position() const
Return position of the particle.
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
~TrackerSimHitProducer() override
Default destructor.
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const =0
virtual float thickness() const =0
LocalPoint localPosition() const
int pdgId() const
Return pdgId of the particle.
void storeProducts(edm::Event &iEvent) override
Store the SimHit collection.
double isLooper() const
Check if this particle is about to do a loop in the tracker or the direction of the momentum is going...
void interact(Particle &particle, const SimplifiedGeometry &layer, std::vector< std::unique_ptr< Particle >> &secondaries, const RandomEngineAndDistribution &random) override
Perform the interaction.
static int position[264][3]
double charge() const
Return charge of the particle.
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
bool doHitsFromInboundParticles_
If not set, incoming particles (negative speed relative to center of detector) don't create a SimHits...
const BasicVectorType & basicVector() const
const PositionType & position() const
GlobalVector globalMomentum() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const DetLayer * getDetLayer() const
Return pointer to the assigned active layer (if any).
Produces SimHits in the tracker layers.
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
virtual bool isForward() const =0
Returns false/true depending if the object is a (non-abstract) barrel/forward layer.
std::vector< PSimHit > PSimHitContainer
double minMomentum_
Set the minimal momentum of incoming particle.
Geom::Phi< T > phi() const