LDMX Software
DigitizationProcessor.h
1#pragma once
2
3#include "Tracking/Reco/TrackingGeometryUser.h"
4
5//--- ACTS ---//
6
7//--- LDMX ---//
8#include "Tracking/Digitization/PulseShape.h"
9#include "Tracking/Digitization/SiStripDigitizer.h"
10#include "Tracking/Event/Measurement.h"
11#include "Tracking/Event/SimSiStripHit.h"
12
13//--- C++ ---//
14#include <memory>
15#include <random>
16#include <unordered_map>
17#include <utility>
18
19namespace ldmx {
20class Measurement;
21}
22
23namespace tracking::reco {
24
43 public:
44 DigitizationProcessor(const std::string& name, framework::Process& process);
45 virtual ~DigitizationProcessor() = default;
46
47 void onProcessStart() override;
48
49 void configure(framework::config::Parameters& parameters) override;
50
57 void onNewRun(const ldmx::RunHeader& header) override;
58
59 void produce(framework::Event& event) override;
60
71 std::vector<ldmx::Measurement> digitizeHits(
72 const std::vector<ldmx::SimTrackerHit>& sim_hits,
73 std::vector<ldmx::SimSiStripHit>* raw_hits = nullptr);
74
75 // TODO avoid copies and use references
76 bool mergeSimHits(const std::vector<ldmx::SimTrackerHit>& sim_hits,
77 std::vector<ldmx::SimTrackerHit>& merged_hits);
78 bool mergeHits(const std::vector<ldmx::SimTrackerHit>& sihits,
79 std::vector<ldmx::SimTrackerHit>& mergedHits);
80
81 private:
83 std::string hit_collection_;
85 std::string out_collection_;
86
88 double min_e_dep_;
92 bool merge_hits_{false};
93
94 // -------------------------------------------------------------------------
95 // Mode 0: Gaussian smearing
96 // -------------------------------------------------------------------------
98 bool do_smearing_{true};
100 double sigma_u_{0};
102 double sigma_v_{0};
103
104 // -------------------------------------------------------------------------
105 // Mode 1: Realistic charge digitization
106 // -------------------------------------------------------------------------
112 std::unique_ptr<tracking::digitization::SiStripDigitizer> strip_digitizer_;
113
114 // ADC conversion and pulse shaping (Mode 1 only)
116 std::string out_raw_collection_{""};
118 std::unique_ptr<tracking::digitization::PulseShape> pulse_shape_;
119
120 // -------------------------------------------------------------------------
121 // Lorentz angle computation (Mode 1, optional)
122 // -------------------------------------------------------------------------
125 bool use_lorentz_{true};
128 std::string field_map_{""};
130 std::unordered_map<unsigned int, std::pair<double, double>>
132
133 void buildLorentzCache();
134
135 // -------------------------------------------------------------------------
136 // Common
137 // -------------------------------------------------------------------------
140
142 std::string dump_geo_csv_{""};
143
144 std::default_random_engine generator_;
145 std::shared_ptr<std::normal_distribution<float>> normal_;
146}; // DigitizationProcessor
147
148} // namespace tracking::reco
Implements an event buffer system for storing event data.
Definition Event.h:40
Class which represents the process under execution.
Definition Process.h:34
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:26
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:68
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).
std::vector< ldmx::Measurement > digitizeHits(const std::vector< ldmx::SimTrackerHit > &sim_hits, std::vector< ldmx::SimSiStripHit > *raw_hits=nullptr)
Digitize a collection of SimTrackerHits into Measurements.
double sigma_u_
u-direction smearing sigma [mm].
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.