1#include "Tracking/Sim/PropagatorStepWriter.h"
4#include <Acts/Geometry/GeometryIdentifier.hpp>
5#include <Acts/Propagator/ConstrainedStep.hpp>
7#include "Framework/Exception/Exception.h"
17 : m_cfg_(cfg), m_output_file_(cfg.root_file_) {
19 EXCEPTION_RAISE(
"InvalidArgument",
"Missing tree name");
33 "TTree from RootPropagationStepsWriter");
71bool PropagatorStepWriter::writeSteps(
73 const std::vector<PropagationSteps>& stepCollection,
74 const std::vector<ldmx::Measurement>& measurements,
75 const Acts::Vector3& start_pos,
const Acts::Vector3& start_mom) {
94 for (
auto& meas : measurements) {
95 m_hit_x_.push_back(meas.getGlobalPosition()[0]);
96 m_hit_y_.push_back(meas.getGlobalPosition()[1]);
97 m_hit_z_.push_back(meas.getGlobalPosition()[2]);
100 for (
unsigned int i = 0; i < 3; i++) {
106 for (
auto& steps : stepCollection) {
126 for (
auto& step : steps) {
129 Acts::GeometryIdentifier::Value boundary_id = 0;
130 Acts::GeometryIdentifier::Value layer_id = 0;
131 Acts::GeometryIdentifier::Value approach_id = 0;
132 Acts::GeometryIdentifier::Value sensitive_id = 0;
135 auto geo_id = step.surface->geometryId();
137 boundary_id = geo_id.boundary();
138 layer_id = geo_id.layer();
139 approach_id = geo_id.approach();
140 sensitive_id = geo_id.sensitive();
155 m_x_.push_back(step.position.x());
156 m_y_.push_back(step.position.y());
157 m_z_.push_back(step.position.z());
158 auto direction = step.momentum.normalized();
159 m_dx_.push_back(direction.x());
160 m_dy_.push_back(direction.y());
161 m_dz_.push_back(direction.z());
165 double accuracy = step.stepSize.accuracy();
166 double actor = step.stepSize.value(Acts::ConstrainedStep::Type::Actor);
168 step.stepSize.value(Acts::ConstrainedStep::Type::Navigator);
169 double user = step.stepSize.value(Acts::ConstrainedStep::Type::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< 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