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_output_file_(cfg.root_file_) {
21 throw std::invalid_argument(
"Missing tree name");
35 "TTree from RootPropagationStepsWriter");
73bool PropagatorStepWriter::writeSteps(
75 const std::vector<PropagationSteps>& stepCollection,
76 const std::vector<ldmx::Measurement>& measurements,
77 const Acts::Vector3& start_pos,
const Acts::Vector3& start_mom) {
96 for (
auto& meas : measurements) {
97 m_hit_x_.push_back(meas.getGlobalPosition()[0]);
98 m_hit_y_.push_back(meas.getGlobalPosition()[1]);
99 m_hit_z_.push_back(meas.getGlobalPosition()[2]);
102 for (
unsigned int i = 0; i < 3; i++) {
108 for (
auto& steps : stepCollection) {
128 for (
auto& step : steps) {
131 Acts::GeometryIdentifier::Value boundary_id = 0;
132 Acts::GeometryIdentifier::Value layer_id = 0;
133 Acts::GeometryIdentifier::Value approach_id = 0;
134 Acts::GeometryIdentifier::Value sensitive_id = 0;
137 auto geo_id = step.surface->geometryId();
139 boundary_id = geo_id.boundary();
140 layer_id = geo_id.layer();
141 approach_id = geo_id.approach();
142 sensitive_id = geo_id.sensitive();
157 m_x_.push_back(step.position.x());
158 m_y_.push_back(step.position.y());
159 m_z_.push_back(step.position.z());
160 auto direction = step.momentum.normalized();
161 m_dx_.push_back(direction.x());
162 m_dy_.push_back(direction.y());
163 m_dz_.push_back(direction.z());
167 double accuracy = step.stepSize.accuracy();
168 double actor = step.stepSize.value(Acts::ConstrainedStep::actor);
169 double aborter = step.stepSize.value(Acts::ConstrainedStep::aborter);
170 double user = step.stepSize.value(Acts::ConstrainedStep::user);
171 double act2 = actor * actor;
172 double acc2 = accuracy * accuracy;
173 double abo2 = aborter * aborter;
174 double usr2 = user * user;
177 if (act2 < acc2 && act2 < abo2 && act2 < usr2) {
179 }
else if (acc2 < abo2 && acc2 < usr2) {
181 }
else if (abo2 < usr2) {
Implements an event buffer system for storing event data.
std::vector< float > m_dx_
global direction x_
PropagatorStepWriter(const Config &cfg)
Constructor with.
std::vector< float > m_x_
global x_
std::vector< float > m_start_mom_
start momentum of the particle propagated
std::vector< float > m_start_pos_
start position of the particle propagated
TFile * m_output_file_
the output file name
std::vector< float > m_hit_x_
hit location X
std::vector< float > m_z_
global z_
int m_event_nr_
the event number of
std::vector< float > m_y_
global y_
std::mutex m_write_mutex_
protect multi-threaded writes
std::vector< float > m_step_usr_
user
std::vector< float > m_step_abt_
aborter
TTree * m_output_tree_
the output tree
std::vector< float > m_hit_y_
hit location Y
std::vector< float > m_hit_z_
hit location Z
std::vector< int > m_approach_id_
surface identifier
Config m_cfg_
the configuration object
std::vector< int > m_sensitive_id_
surface identifier
std::vector< float > m_dz_
global direction z_
std::vector< float > m_dy_
global direction y_
std::vector< float > m_step_act_
actor check
std::vector< int > m_boundary_id_
boundary identifier
std::vector< int > m_layer_id_
layer identifier if
std::vector< float > m_step_acc_
accuracy
std::vector< int > m_step_type_
step type
The measurement calibrator can be a function or a class/struct able to retrieve the sim hits containe...
std::string tree_name_
name of the output tree
std::string file_mode_
file access mode
std::string file_path_
path of the output file
TFile * root_file_
common root file