45 typedef std::pair<const GeomDet*,TrajectoryStateOnSurface>
DetWithState;
201 std::map<double, std::unique_ptr<PSimHit>> distAndHits;
212 for (
const auto & detectorWithState : compatibleDetectors)
220 std::pair<double, std::unique_ptr<PSimHit>> hitPair =
createHitOnDetector(particleState, pdgId, layer.
getThickness(particle.
position()), energyDeposit, simTrackId, detector, positionOutside);
222 distAndHits.insert(distAndHits.end(),
std::move(hitPair));
228 for(
const auto component : detector.
components())
230 std::pair<double, std::unique_ptr<PSimHit>> hitPair =
createHitOnDetector(particleState, pdgId,layer.
getThickness(particle.
position()), energyDeposit, simTrackId, *component, positionOutside);
232 distAndHits.insert(distAndHits.end(),
std::move(hitPair));
239 for(
std::map<
double, std::unique_ptr<PSimHit>>::const_iterator it = distAndHits.begin(); it != distAndHits.end(); it++){
266 std::pair<bool,double>
path = crossing.pathLength(detector.
surface());
277 return std::pair<double, std::unique_ptr<PSimHit>>(0, std::unique_ptr<PSimHit>(
nullptr));
284 double pZ = localMomentum.
z();
286 LocalPoint exit = localPosition + (halfThick / pZ) * localMomentum;
290 double boundX = detectorPlane.
bounds().
width() / 2.;
294 if (subdet == 4 || subdet == 6)
295 boundX *= 1. - localPosition.
y() / detectorPlane.
position().
perp();
296 if(fabs(localPosition.
x()) > boundX || fabs(localPosition.
y()) > boundY )
298 return std::pair<double, std::unique_ptr<PSimHit>>(0, std::unique_ptr<PSimHit>(
nullptr));
305 eLoss *= (2. * halfThick - 0.003) / (9.36 * layerThickness);
310 return std::pair<double, std::unique_ptr<PSimHit>>((hitPos-refPos).
mag(),
311 std::unique_ptr<PSimHit>(
new PSimHit(entry, exit, localMomentum.
mag(), tof, eLoss,
pdgId,
313 localMomentum.
theta(),
314 localMomentum.
phi())));
320 "fastsim::TrackerSimHitProducer" BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
virtual float length() const =0
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
TrackerSimHitProducer(const std::string &name, const edm::ParameterSet &cfg)
Constructor.
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const =0
Implementation of a generic detector layer (base class for forward/barrel layers).
const math::XYZTLorentzVector & position() const
Return position of the particle.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
LocalPoint localPosition() const
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
static double constexpr speedOfLight
Speed of light [cm / ns].
virtual bool isForward() const =0
Returns false/true depending if the object is a (non-abstract) barrel/forward layer.
const Bounds & bounds() const
int pdgId() const
Return pdgId of the particle.
std::unique_ptr< edm::PSimHitContainer > simHitContainer_
The SimHit.
void interact(Particle &particle, const SimplifiedGeometry &layer, std::vector< std::unique_ptr< Particle > > &secondaries, const RandomEngineAndDistribution &random) override
Perform the interaction.
double isLooper() const
Check if this particle is about to do a loop in the tracker or the direction of the momentum is going...
const Plane & surface() const
The nominal surface of the GeomDet.
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Geom::Theta< T > theta() const
uint32_t rawId() const
get the raw id
LocalVector localMomentum() const
~TrackerSimHitProducer() override
Default destructor.
virtual float width() const =0
Base class for any interaction model between a particle and a tracker layer.
Produces SimHits in the tracker layers.
void setLooper()
This particle is about to do a loop in the tracker or the direction of the momentum is going inwards...
bool doHitsFromInboundParticles_
If not set, incoming particles (negative speed relative to center of detector) don't create a SimHits...
virtual const double getMagneticFieldZ(const math::XYZTLorentzVector &position) const =0
Return magnetic field (field only has Z component!) on the layer.
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.
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
DetId geographicalId() const
The label of this GeomDet.
virtual bool isLeaf() const
is a Unit
int simTrackIndex() const
Return index of the SimTrack.
virtual std::vector< const GeomDet * > components() const
Returns direct components, if any.
Vector3DBase unit() const
void registerProducts(edm::ProducerBase &producer) const override
Register the SimHit collection.
virtual float thickness() const =0
double minMomentum_
Set the minimal momentum of incoming particle.
void storeProducts(edm::Event &iEvent) override
Store the SimHit collection.
double charge() const
Return charge of the particle.
virtual const double getThickness(const math::XYZTLorentzVector &position) const =0
Return thickness of the layer at a given position.
const DetLayer * getDetLayer() const
Return pointer to the assigned active layer (if any).
GlobalVector globalMomentum() const
static int position[264][3]
double getEnergyDeposit() const
Return the energy the particle deposited in the tracker layer that was last hit (ionization).
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
int getMotherSimTrackIndex() const
Get index of simTrack of mother particle (only makes sense if mother and daughter charged)...
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< PSimHit > PSimHitContainer
const BasicVectorType & basicVector() const
const PositionType & position() const
void setEnergyDeposit(double energyDeposit)
Set the energy the particle deposited in the tracker layer that was last hit (ionization).
Global3DVector GlobalVector
const double onSurfaceTolerance_
Max distance between particle and active (sub-) module. Otherwise particle has to be propagated...
double transverseCurvature() const