22 declareInterface<IModuleStepper>(
this);
35 return StatusCode::SUCCESS;
41 return StatusCode::SUCCESS;
51 std::vector<Trk::DigitizationStep> cSteps;
54 const auto& stepSurfaces = dmodule.
stepSurfaces(startPoint,endPoint);
60 std::vector<Trk::Intersection> stepIntersections;
61 stepIntersections.reserve(stepSurfaces.size()+1);
64 for (
const auto& sSurface : stepSurfaces){
66 Trk::Intersection sIntersection = sSurface->straightLineIntersection(startPoint,trackDirection,
true,
true);
67 if (sIntersection.
valid) {
69 stepIntersections.push_back(sIntersection);
74 stepIntersections.emplace_back(endPoint,(startPoint-endPoint).
mag(),
true);
75 std::sort(stepIntersections.begin(),stepIntersections.end());
79 cSteps.reserve(stepIntersections.size());
80 for (
auto& sIntersection : stepIntersections){
82 cSteps.push_back( dmodule.
digitizationStep(lastPosition,sIntersection.position));
83 lastPosition = sIntersection.position;
100 Amg::Vector3D intersection3D(moduleIntersection.x(),moduleIntersection.y(),0.);
103 std::vector< Trk::Intersection > boundaryIntersections;
105 for (
const auto& bSurface : boundarySurfaces){
109 Trk::Intersection bIntersection = bSurface->straightLineIntersection(intersection3D,trackDirection,
false,
true);
110 if (bIntersection.
valid) {
112 boundaryIntersections.push_back(bIntersection);
116 if (attempts == 2 && boundaryIntersections.size() == attempts)
break;
117 else if (attempts > 2 && boundaryIntersections.size()==3)
break;
120 if (boundaryIntersections.size() > 2){
121 ATH_MSG_VERBOSE(
"More than 2 Boundary Surfaces intersected, this is an edge case, resolving ... ");
122 std::sort(boundaryIntersections.begin(),boundaryIntersections.end());
123 if (boundaryIntersections[0].pathLength*boundaryIntersections[1].pathLength < 0.) boundaryIntersections.pop_back();
124 else boundaryIntersections.erase(boundaryIntersections.begin());
127 return cellSteps(dmodule, boundaryIntersections[0].position, boundaryIntersections[1].position);
Scalar mag() const
mag method
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
#define ATH_MSG_VERBOSE(x)
Class that holds the surfaces for a planar digitization detector module.
const std::vector< std::shared_ptr< const Surface > > stepSurfaces(const Amg::Vector3D &start, const Amg::Vector3D &end) const
return the test surfaces between these points
const std::vector< std::shared_ptr< const Surface > > & boundarySurfaces() const
return the bounding surfaces at top and bottom
const DigitizationStep digitizationStep(const Amg::Vector3D &start, const Amg::Vector3D &end) const
Fill the associated digitsation cell from this start and end position, correct for lorentz effect if ...
StatusCode initialize() override
AlgTool initialize method.
virtual ~PlanarModuleStepper()
Destructor.
StatusCode finalize() override
AlgTool finalize method.
std::vector< DigitizationStep > cellSteps(const DigitizationModule &dmodule, const Amg::Vector3D &startPosition, const Amg::Vector3D &endPosition) const override
calculate the steps caused by this track - full simulation interface
PlanarModuleStepper(const std::string &, const std::string &, const IInterface *)
Constructor.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.