1#include "Tracking/Sim/PropagatorStepWriter.h"
4#include <Acts/Geometry/GeometryIdentifier.hpp>
5#include <Acts/Geometry/TrackingVolume.hpp>
6#include <Acts/Propagator/ConstrainedStep.hpp>
7#include <Acts/Surfaces/Surface.hpp>
9#include "Acts/Geometry/DetectorElementBase.hpp"
19 : m_cfg(cfg), m_outputFile(cfg.rootFile) {
21 throw std::invalid_argument(
"Missing tree name");
28 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
filePath);
34 "TTree from RootPropagationStepsWriter");
72bool PropagatorStepWriter::WriteSteps(
74 const std::vector<PropagationSteps>& stepCollection,
75 const std::vector<ldmx::Measurement>& measurements,
76 const Acts::Vector3& start_pos,
const Acts::Vector3& start_mom) {
95 for (
auto& meas : measurements) {
96 m_hit_x.push_back(meas.getGlobalPosition()[0]);
97 m_hit_y.push_back(meas.getGlobalPosition()[1]);
98 m_hit_z.push_back(meas.getGlobalPosition()[2]);
101 for (
unsigned int i = 0; i < 3; i++) {
107 for (
auto& steps : stepCollection) {
127 for (
auto& step : steps) {
130 Acts::GeometryIdentifier::Value boundaryID = 0;
131 Acts::GeometryIdentifier::Value layerID = 0;
132 Acts::GeometryIdentifier::Value approachID = 0;
133 Acts::GeometryIdentifier::Value sensitiveID = 0;
136 auto geoID = step.surface->geometryId();
138 boundaryID = geoID.boundary();
139 layerID = geoID.layer();
140 approachID = geoID.approach();
141 sensitiveID = geoID.sensitive();
156 m_x.push_back(step.position.x());
157 m_y.push_back(step.position.y());
158 m_z.push_back(step.position.z());
159 auto direction = step.momentum.normalized();
160 m_dx.push_back(direction.x());
161 m_dy.push_back(direction.y());
162 m_dz.push_back(direction.z());
166 double accuracy = step.stepSize.accuracy();
167 double actor = step.stepSize.value(Acts::ConstrainedStep::actor);
168 double aborter = step.stepSize.value(Acts::ConstrainedStep::aborter);
169 double user = step.stepSize.value(Acts::ConstrainedStep::user);
170 double act2 = actor * actor;
171 double acc2 = accuracy * accuracy;
172 double abo2 = aborter * aborter;
173 double usr2 = user * user;
176 if (act2 < acc2 && act2 < abo2 && act2 < usr2) {
178 }
else if (acc2 < abo2 && acc2 < usr2) {
180 }
else if (abo2 < usr2) {
Implements an event buffer system for storing event data.
std::vector< int > m_boundaryID
boundary identifier
PropagatorStepWriter(const Config &cfg)
Constructor with.
std::vector< int > m_step_type
step type
std::vector< float > m_x
global x
int m_eventNr
the event number of
std::vector< float > m_step_act
actor check
std::vector< float > m_hit_x
hit location X
TFile * m_outputFile
the output file name
std::vector< float > m_step_usr
user
std::vector< int > m_sensitiveID
surface identifier
std::vector< float > m_dz
global direction z
std::vector< float > m_hit_z
hit location Z
std::vector< int > m_approachID
surface identifier
TTree * m_outputTree
the output tree
std::vector< float > m_dx
global direction x
std::vector< float > m_start_pos
start position of the particle propagated
std::vector< float > m_dy
global direction y
std::vector< float > m_y
global y
std::vector< float > m_z
global z
std::vector< int > m_layerID
layer identifier if
std::vector< float > m_start_mom
start momentum of the particle propagated
std::vector< float > m_step_acc
accuracy
std::vector< float > m_step_abt
aborter
std::mutex m_writeMutex
protect multi-threaded writes
std::vector< float > m_hit_y
hit location Y
Config m_cfg
the configuration object
The measurement calibrator can be a function or a class/struct able to retrieve the sim hits containe...
TFile * rootFile
common root file
std::string filePath
path of the output file
std::string fileMode
file access mode
std::string treeName
name of the output tree