|
|
Handles/tracks (possible) intersections of particle's trajectory and tracker layers.
More...
#include <LayerNavigator.h>
Handles/tracks (possible) intersections of particle's trajectory and tracker layers.
the geometry is described by 2 sets of layers:
- forward layers: flat layers, perpendicular to the z-axis, positioned at a given z these layers have material / instruments between a given materialMinR and materialMaxR no 2 forward layers should have the same z-position
- barrel layers: cylindrically shaped layers, with the z-axis as axis, infinitely long these layers have material / instruments for |z| < materialMaxAbsZ no 2 barrel layers should have the same radius
- forward (barrel) layers are ordered according to increasing z (r)
principle
- neutral particles follow a straight trajectory
- charged particles follow a helix-shaped trajectory: constant speed along the z-axis circular path in the x-y plane => the next layer that the particle will cross is among the following 3 layers
- closest forward layer with
- z >(<) particle.z() for particles moving in the positive(negative) direction
- closest barrel layer with r < particle.r
- closest barrel layer with r > particle.r
algorithm
- find the 3 candidate layers
- find the earliest positive intersection time for each of the 3 candidate layers
- move the particle to the earliest intersection time
- select and return the layer with the earliest positive intersection time
Definition at line 48 of file LayerNavigator.h.
◆ LayerNavigator()
fastsim::LayerNavigator::LayerNavigator |
( |
const Geometry & |
geometry | ) |
|
Constructor.
- Parameters
-
geometry | The geometry of the tracker material. |
Definition at line 60 of file LayerNavigator.cc.
◆ moveParticleToNextLayer()
Move particle along its trajectory to the next intersection with any of the tracker layers.
- Parameters
-
particle | The particle that has to be moved to the next layer. |
layer | The layer to which the particle was moved in the previous call of this function (0 if first call). Returns the layer this particle was then moved to. |
- Returns
- true / false if propagation succeeded / failed.
Definition at line 69 of file LayerNavigator.cc.
75 if (!particle.
isOnLayer(layer->isForward(), layer->index())) {
76 throw cms::Exception(
"FastSimulation") <<
"If layer is provided, particle must be on layer."
77 <<
"\n Layer: " << *layer <<
"\n Particle: " << particle;
88 bool particleMovesInwards =
105 if (particle.
isOnLayer(
false, layer->index()) ||
107 if (particleMovesInwards) {
115 if (particle.
position().Pt() < layer->getRadius()) {
135 if (particle.
position().Z() < layer->getZ()) {
151 if (!particleMovesInwards) {
156 if (particleMovesInwards) {
186 <<
"\n particle between ForwardLayers: "
195 std::vector<const fastsim::SimplifiedGeometry*>
layers;
215 double deltaTimeC = -1;
216 for (
auto _layer :
layers) {
217 double tempDeltaTime =
218 trajectory->nextCrossingTimeC(*_layer, particle.
isOnLayer(_layer->isForward(), _layer->index()));
220 if (tempDeltaTime > 0 && (layer ==
nullptr || tempDeltaTime < deltaTimeC || deltaTimeC < 0)) {
222 deltaTimeC = tempDeltaTime;
227 double properDeltaTimeC = deltaTimeC / particle.
gamma();
232 trajectory->move(deltaTimeC);
233 particle.
position() = trajectory->getPosition();
234 particle.
momentum() = trajectory->getMomentum();
246 trajectory->move(deltaTimeC);
247 particle.
position() = trajectory->getPosition();
248 particle.
momentum() = trajectory->getMomentum();
254 particle.
setOnLayer(layer->isForward(), layer->index());
References funct::abs(), electrons_cff::bool, fastsim::Trajectory::createTrajectory(), MillePedeFileConverter_cfg::e, Exception, fastsim::Particle::gamma(), fastsim::SimplifiedGeometry::getMagneticFieldZ(), fastsim::SimplifiedGeometry::index(), fastsim::SimplifiedGeometry::isForward(), fastsim::Particle::isOnLayer(), fastsim::Particle::isStable(), hgcalTopologyTester_cfi::layers, LogDebug, CaloMaterial_cfi::magneticFieldZ, fastsim::Particle::momentum(), fastsim::Particle::position(), fastsim::Particle::remainingProperLifeTimeC(), fastsim::Particle::resetOnLayer(), fastsim::Particle::setOnLayer(), and fastsim::Particle::setRemainingProperLifeTimeC().
Referenced by FastSimProducer::createFSimTrack(), and FastSimProducer::produce().
◆ geometry_
const Geometry* const fastsim::LayerNavigator::geometry_ |
|
private |
◆ MESSAGECATEGORY
const std::string fastsim::LayerNavigator::MESSAGECATEGORY = "FastSimulation" |
|
staticprivate |
find the next layer that the particle will cross
motivation for a new algorithm
- old algorithm is flawed
- the new algorithm allows to put material and instruments on any plane perpendicular to z, or on any cylinder with the z-axis as axis
- while the old algorith, with the requirement of nested layers, forbids the introduction of long narrow cylinders, required for a decent simulation of material in front of HF
definitions the geometry is described by 2 sets of layers:
- forward layers: flat layers, perpendicular to the z-axis, positioned at a given z these layers have material / instruments between a given materialMinR and materialMaxR no 2 forward layers should have the same z-position
- barrel layers: cylindrically shaped layers, with the z-axis as axis, infinitely long these layers have material / instruments for |z| < materialMaxAbsZ no 2 barrel layers should have the same radius
- forward(barrel) layers are ordered according to increasing z (r)
principle
- neutral particles follow a straight trajectory
- charged particles follow a helix-shaped trajectory: constant speed along the z-axis circular path in the x-y plane => the next layer that the particle will cross is among the following 3 layers
- closest forward layer with
- z >(<) particle.z() for particles moving in the positive(negative) direction
- closest barrel layer with r < particle.r
- closest barrel layer with r > particle.r
algorithm
- find the 3 candidate layers
- find the earliest positive intersection time for each of the 3 candidate layers
- move the particle to the earliest intersection time
- select and return the layer with the earliest positive intersection time
notes
- the implementation of the algorithm can probably be optimised, e.g.
- one can probably gain time in moveToNextLayer if LayerNavigator is aware of the candidate layers of the previous call to moveToNextLayer
- for straight tracks, the optimal strategy to find the next layer might be very different
Definition at line 74 of file LayerNavigator.h.
◆ nextBarrelLayer_
Pointer to the next (direction of the particle's momentum) barrel layer.
Definition at line 67 of file LayerNavigator.h.
◆ nextForwardLayer_
Pointer to the next (direction of the particle's momentum) forward layer.
Definition at line 71 of file LayerNavigator.h.
◆ previousBarrelLayer_
Pointer to the previous (opposite direction of the particle's momentum) barrel layer.
Definition at line 69 of file LayerNavigator.h.
◆ previousForwardLayer_
Pointer to the previous (opposite direction of the particle's momentum) forward layer.
Definition at line 73 of file LayerNavigator.h.
static std::unique_ptr< Trajectory > createTrajectory(const fastsim::Particle &particle, const double magneticFieldZ)
Calls constructor of derived classes.
const BarrelSimplifiedGeometry * nextBarrelLayer_
Pointer to the next (direction of the particle's momentum) barrel layer.
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
const Geometry *const geometry_
The geometry of the tracker material.
const BarrelSimplifiedGeometry * nextLayer(const BarrelSimplifiedGeometry *layer) const
Helps to navigate through the vector of barrel layers.
const ForwardSimplifiedGeometry * nextForwardLayer_
Pointer to the next (direction of the particle's momentum) forward layer.
const std::vector< std::unique_ptr< BarrelSimplifiedGeometry > > & barrelLayers() const
Return the vector of barrel layers.
double getMagneticFieldZ(const math::XYZTLorentzVector &position) const
Initializes the tracker geometry.
const BarrelSimplifiedGeometry * previousLayer(const BarrelSimplifiedGeometry *layer) const
Helps to navigate through the vector of barrel layers.
const math::XYZTLorentzVector & position() const
Return position of the particle.
bool isStable() const
Returns true if particle is considered stable.
void resetOnLayer()
Reset layer this particle is currently on (i.e. particle is not on a layer anyomre)
bool isOnLayer(bool isForward, int index)
Check if particle is on layer.
void setRemainingProperLifeTimeC(double remainingProperLifeTimeC)
Set the particle's remaining proper lifetime if not stable [in ct].
int index() const
Return index of this layer (layers are numbered according to their position in the detector).
const std::vector< std::unique_ptr< ForwardSimplifiedGeometry > > & forwardLayers() const
Return the vector of forward layers (disks).
static const std::string MESSAGECATEGORY
const BarrelSimplifiedGeometry * previousBarrelLayer_
Pointer to the previous (opposite direction of the particle's momentum) barrel layer.
double remainingProperLifeTimeC() const
Return the particle's remaining proper lifetime[in ct].
const ForwardSimplifiedGeometry * previousForwardLayer_
Pointer to the previous (opposite direction of the particle's momentum) forward layer.
Abs< T >::type abs(const T &t)
void setOnLayer(bool isForward, int index)
Set layer this particle is currently on.
double gamma() const
Return Lorentz' gamma factor.