LDMX Software
DigitizationProcessor.h
1#pragma once
2
4#include "Tracking/Reco/TrackingGeometryUser.h"
5
6//--- ACTS ---//
7#include "Acts/Definitions/Units.hpp"
8#include "Acts/Surfaces/RectangleBounds.hpp"
9#include "Acts/Surfaces/Surface.hpp"
10
11//--- LDMX ---//
12#include "Tracking/Digitization/PulseShape.h"
13#include "Tracking/Digitization/SiStripConstants.h"
14#include "Tracking/Digitization/SiStripDigitizer.h"
15#include "Tracking/Event/Measurement.h"
16#include "Tracking/Event/RawSiStripHit.h"
17#include "Tracking/Sim/TrackingUtils.h"
18#include "Tracking/geo/DetectorElement.h"
19
20//--- C++ ---//
21#include <chrono>
22#include <memory>
23#include <random>
24#include <unordered_map>
25#include <utility>
26
27namespace ldmx {
28class Measurement;
29}
30
31namespace tracking::reco {
32
51 public:
52 DigitizationProcessor(const std::string& name, framework::Process& process);
53 virtual ~DigitizationProcessor() = default;
54
55 void onProcessStart() override;
56
57 void configure(framework::config::Parameters& parameters) override;
58
65 void onNewRun(const ldmx::RunHeader& header) override;
66
67 void produce(framework::Event& event) override;
68
79 std::vector<ldmx::Measurement> digitizeHits(
80 const std::vector<ldmx::SimTrackerHit>& sim_hits,
81 std::vector<ldmx::RawSiStripHit>* raw_hits = nullptr);
82
83 // TODO avoid copies and use references
84 bool mergeSimHits(const std::vector<ldmx::SimTrackerHit>& sim_hits,
85 std::vector<ldmx::SimTrackerHit>& merged_hits);
86 bool mergeHits(const std::vector<ldmx::SimTrackerHit>& sihits,
87 std::vector<ldmx::SimTrackerHit>& mergedHits);
88
89 private:
91 std::string hit_collection_;
93 std::string out_collection_;
94
96 double min_e_dep_;
100 bool merge_hits_{false};
101
102 // -------------------------------------------------------------------------
103 // Mode 0: Gaussian smearing
104 // -------------------------------------------------------------------------
106 bool do_smearing_{true};
108 double sigma_u_{0};
110 double sigma_v_{0};
111
112 // -------------------------------------------------------------------------
113 // Mode 1: Realistic charge digitization
114 // -------------------------------------------------------------------------
120 std::unique_ptr<tracking::digitization::SiStripDigitizer> strip_digitizer_;
121
122 // ADC conversion and pulse shaping (Mode 1 only)
124 std::string out_raw_collection_{""};
126 std::unique_ptr<tracking::digitization::PulseShape> pulse_shape_;
127
128 // -------------------------------------------------------------------------
129 // Lorentz angle computation (Mode 1, optional)
130 // -------------------------------------------------------------------------
133 bool use_lorentz_{true};
136 std::string field_map_{""};
138 std::unordered_map<unsigned int, std::pair<double, double>>
140
141 void buildLorentzCache();
142
143 // -------------------------------------------------------------------------
144 // Common
145 // -------------------------------------------------------------------------
148
150 std::string dump_geo_csv_{""};
151
152 std::default_random_engine generator_;
153 std::shared_ptr<std::normal_distribution<float>> normal_;
154}; // DigitizationProcessor
155
156} // namespace tracking::reco
Conditions object for random number seeds.
Implements an event buffer system for storing event data.
Definition Event.h:42
Class which represents the process under execution.
Definition Process.h:37
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:57
Digitization processor for the silicon strip tracker.
std::unique_ptr< tracking::digitization::PulseShape > pulse_shape_
The constructed pulse shape (created in onProcessStart).
std::string out_collection_
Output measurement collection name.
std::string hit_collection_
Input hit collection to digitize.
tracking::digitization::SiStripDigitizer::SensorParams sensor_params_
Parameters forwarded to SiStripDigitizer.
std::unordered_map< unsigned int, std::pair< double, double > > lorentz_tan_cache_
Per-layer cached Lorentz tangents: layer_id → {tan_electron, tan_hole}.
bool do_smearing_
Flag to enable/disable smearing in Mode 0.
void produce(framework::Event &event) override
Process the event and put new data products into it.
bool use_charge_digitization_
If true, use the full SiStripDigitizer instead of simple smearing.
void onProcessStart() override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
void onNewRun(const ldmx::RunHeader &header) override
Before the run starts (but after the conditions are configured) set up the random seeds for this run.
std::string dump_geo_csv_
If non-empty, write a CSV of all ACTS surface transforms to this path.
bool use_lorentz_
If false, skip Lorentz angle calculation and drift carriers straight (equivalent to zero magnetic fie...
std::string tracker_hit_passname_
Input collection pass name.
double min_e_dep_
Minimum energy deposition cut [MeV].
int track_id_
Select a particular track ID (-1 = accept all).
double sigma_u_
u-direction smearing sigma [mm].
std::vector< ldmx::Measurement > digitizeHits(const std::vector< ldmx::SimTrackerHit > &sim_hits, std::vector< ldmx::RawSiStripHit > *raw_hits=nullptr)
Digitize a collection of SimTrackerHits into Measurements.
std::unique_ptr< tracking::digitization::SiStripDigitizer > strip_digitizer_
The charge digitizer (constructed in onProcessStart).
std::string field_map_
Path to the magnetic field map file.
void configure(framework::config::Parameters &parameters) override
Callback for the EventProcessor to configure itself from the given set of parameters.
bool merge_hits_
Merge sim hits on the same sensor before digitizing.
double sigma_v_
v-direction smearing sigma [mm].
std::string out_raw_collection_
Output raw hit collection name (empty = don't save raw hits).
a helper base class providing some methods to shorten access to common conditions used within the tra...
All parameters describing one silicon strip sensor layer.