29#include "Tracking/Sim/LdmxSpacePoint.h"
32#include "Tracking/Event/Track.h"
35#include "Acts/Definitions/Algebra.hpp"
36#include "Acts/Definitions/PdgParticle.hpp"
37#include "Acts/Definitions/TrackParametrization.hpp"
38#include "Acts/Definitions/Units.hpp"
39#include "Acts/EventData/TrackParameters.hpp"
40#include "Acts/Surfaces/PerigeeSurface.hpp"
41#include "Acts/Surfaces/PlaneSurface.hpp"
42#include "Tracking/Event/Measurement.h"
76 unsigned int sensorId = 0;
77 unsigned int layerId = 0;
106 unsigned int index = vol * 1000 + layerId * 100 + sensorId;
109 std::cout <<
"LdmxSpacePointConverter::Check index::" << vol <<
"--"
110 << layerId <<
"--" << sensorId <<
"==>" << index << std::endl;
130 double sigma_v = 1.) {
131 unsigned int index = getSensorID(hit);
139 index, hit.
getEdep(), sigma_u * sigma_u,
140 sigma_v * sigma_v, hit.
getID());
146inline void flatCov(Acts::BoundSquareMatrix cov, std::vector<double>& v_cov) {
148 v_cov.reserve(cov.rows() * (cov.rows() + 1) / 2);
149 for (
int i = 0; i < cov.rows(); i++)
150 for (
int j = i; j < cov.cols(); j++) v_cov.push_back(cov(i, j));
153inline Acts::BoundSquareMatrix unpackCov(
const std::vector<double>& v_cov) {
154 Acts::BoundSquareMatrix cov;
156 for (
int i = 0; i < cov.rows(); i++)
157 for (
int j = i; j < cov.cols(); j++) {
158 cov(i, j) = v_cov.at(e);
159 cov(j, i) = cov(i, j);
173inline Acts::Vector3 Ldmx2Acts(Acts::Vector3 ldmx_v) {
175 Acts::SquareMatrix3 acts_rot;
176 acts_rot << 0., 0., 1., 1., 0., 0., 0., 1, 0.;
178 return acts_rot * ldmx_v;
183inline Acts::FreeVector toFreeParameters(Acts::Vector3 pos, Acts::Vector3 mom,
184 Acts::ActsScalar q) {
185 Acts::FreeVector free_params;
186 Acts::ActsScalar p = mom.norm() * Acts::UnitConstants::MeV;
188 free_params[Acts::eFreePos0] = pos(Acts::ePos0) * Acts::UnitConstants::mm;
189 free_params[Acts::eFreePos1] = pos(Acts::ePos1) * Acts::UnitConstants::mm;
190 free_params[Acts::eFreePos2] = pos(Acts::ePos2) * Acts::UnitConstants::mm;
191 free_params[Acts::eFreeTime] = 0.;
192 free_params[Acts::eFreeDir0] = mom(0) / mom.norm();
193 free_params[Acts::eFreeDir1] = mom(1) / mom.norm();
194 free_params[Acts::eFreeDir2] = mom(2) / mom.norm();
195 free_params[Acts::eFreeQOverP] =
196 (q != Acts::ActsScalar(0)) ? (q / p) : 0.;
204inline std::vector<double> convertActsToLdmxPars(Acts::BoundVector acts_par) {
205 std::vector<double> v_ldmx(
206 acts_par.data(), acts_par.data() + acts_par.rows() * acts_par.cols());
210inline Acts::BoundVector boundState(
const ldmx::Track& trk) {
211 Acts::BoundVector paramVec;
212 paramVec << trk.getD0(), trk.getZ0(), trk.getPhi(), trk.getTheta(),
213 trk.getQoP(), trk.getT();
218 Acts::BoundVector paramVec;
219 paramVec << ts.params[0], ts.params[1], ts.params[2], ts.params[3],
220 ts.params[4], ts.params[5];
224inline Acts::BoundTrackParameters boundTrackParameters(
225 const ldmx::Track& trk, std::shared_ptr<Acts::PerigeeSurface> perigee) {
226 Acts::BoundVector paramVec = boundState(trk);
227 Acts::BoundSquareMatrix covMat = unpackCov(trk.getPerigeeCov());
228 auto partHypo{Acts::SinglyChargedParticleHypothesis::electron()};
233 return Acts::BoundTrackParameters(perigee, paramVec, std::move(covMat),
238 std::shared_ptr<Acts::Surface> surf,
240 Acts::BoundVector paramVec = boundState(ts);
241 Acts::BoundSquareMatrix covMat = unpackCov(ts.cov);
242 auto partHypo{Acts::SinglyChargedParticleHypothesis::electron()};
245 return Acts::BoundTrackParameters(surf, paramVec, std::move(covMat),
250inline const std::shared_ptr<Acts::PlaneSurface> unboundSurface(
251 double xloc,
double yloc = 0.,
double zloc = 0.) {
258 Acts::RotationMatrix3 surf_rotation = Acts::RotationMatrix3::Zero();
260 surf_rotation(1, 0) = 1;
262 surf_rotation(2, 1) = 1;
264 surf_rotation(0, 2) = 1;
266 Acts::Vector3 pos(xloc, yloc, zloc);
267 Acts::Translation3 surf_translation(pos);
268 Acts::Transform3 surf_transform(surf_translation * surf_rotation);
271 const std::shared_ptr<Acts::PlaneSurface> target_surface =
272 Acts::Surface::makeShared<Acts::PlaneSurface>(surf_transform);
274 return Acts::Surface::makeShared<Acts::PlaneSurface>(surf_transform);
Class which encapsulates information from a hit in a simulated tracking detector.
Represents a simulated tracker hit in the simulation.
int getModuleID() const
Get the module ID associated with a hit.
float getEdep() const
Get the energy deposited on the hit [MeV].
std::vector< float > getPosition() const
Get the XYZ position of the hit [mm].
int getID() const
Get the detector ID of the hit.
float getTime() const
Get the global time of the hit [ns].
int getLayerID() const
Get the geometric layer ID of the hit.
Implementation of a track object.
The measurement calibrator can be a function or a class/struct able to retrieve the sim hits containe...