LDMX Software
tracking::reco::StripFitProcessor Class Reference

Fits a pulse shape to each RawSiStripHit and produces FittedSiStripHits. More...

#include <StripFitProcessor.h>

Public Member Functions

 StripFitProcessor (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
void onProcessStart () override
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
void produce (framework::Event &event) override
 Process the event and put new data products into it.
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for a Producer is calling produce.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header)
 Callback for Producers to add parameters to the run header before conditions are initialized.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

std::string in_collection_ {"RawSiStripHits"}
 
std::string in_pass_ {""}
 
std::string out_collection_ {"FittedSiStripHits"}
 
double t_scan_min_ns_ {-50.0}
 
double t_scan_max_ns_ {150.0}
 
double t_scan_step_ns_ {1.0}
 
double max_chi2_ndf_ {-1.0}
 
std::unique_ptr< tracking::digitization::PulseShapepulse_shape_
 
std::unique_ptr< tracking::digitization::StripPulseFitterfitter_
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Fits a pulse shape to each RawSiStripHit and produces FittedSiStripHits.

This processor is intended to run on both real and simulated data; it requires only the RawSiStripHit collection and knowledge of the readout pulse shape.

Input : collection of ldmx::RawSiStripHit Output : collection of ldmx::FittedSiStripHit

Configuration parameters

in_collection Name of the RawSiStripHit input collection. in_pass Pass name for the input collection. out_collection Name of the FittedSiStripHit output collection. pulse_shape "CRRC" (default) or "FourPole". tp Peaking time tp [ns] (default 45). tp2 Second time constant [ns] for FourPole (default 10). t0_offset_ns Time of sample 0 relative to the hit frame [ns] (default 0). sampling_interval_ns Sample spacing [ns] (default 25). pedestal_adc Per-sample pedestal [ADC counts] (default 0). noise_sigma_adc Per-sample noise RMS [ADC counts] used for χ² (default 5). t_scan_min_ns Lower bound of the hit-time scan [ns] (default −50). t_scan_max_ns Upper bound of the hit-time scan [ns] (default 150). t_scan_step_ns Step size of the coarse scan [ns] (default 1). max_chi2_ndf If > 0, discard fits with χ²/ndf above this value (default −1 = off).

Definition at line 43 of file StripFitProcessor.h.

Constructor & Destructor Documentation

◆ StripFitProcessor()

tracking::reco::StripFitProcessor::StripFitProcessor ( const std::string & name,
framework::Process & process )

Definition at line 10 of file StripFitProcessor.cxx.

Base class for a module which produces a data product.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ configure()

void tracking::reco::StripFitProcessor::configure ( framework::config::Parameters & parameters)
overridevirtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has class_name equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 14 of file StripFitProcessor.cxx.

14 {
15 in_collection_ =
16 parameters.get<std::string>("in_collection", "RawSiStripHits");
17 in_pass_ = parameters.get<std::string>("in_pass", "");
18 out_collection_ =
19 parameters.get<std::string>("out_collection", "FittedSiStripHits");
20
21 t_scan_min_ns_ = parameters.get<double>("t_scan_min_ns", -50.0);
22 t_scan_max_ns_ = parameters.get<double>("t_scan_max_ns", 150.0);
23 t_scan_step_ns_ = parameters.get<double>("t_scan_step_ns", 1.0);
24
25 max_chi2_ndf_ = parameters.get<double>("max_chi2_ndf", -1.0);
26}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

References framework::config::Parameters::get().

◆ onProcessStart()

void tracking::reco::StripFitProcessor::onProcessStart ( )
overridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.

Reimplemented from framework::EventProcessor.

Definition at line 28 of file StripFitProcessor.cxx.

28 {
29 using namespace tracking::digitization;
30
31 pulse_shape_ = PulseShape::make(std::string(PULSE_SHAPE_NAME),
32 PEAKING_TIME_NS, SECOND_TIME_CONST_NS);
33
34 fitter_ = std::make_unique<tracking::digitization::StripPulseFitter>(
35 *pulse_shape_, T0_OFFSET_NS, SAMPLING_INTERVAL_NS,
36 static_cast<double>(ADC_PEDESTAL), NOISE_SIGMA_ADC, t_scan_min_ns_,
37 t_scan_max_ns_, t_scan_step_ns_);
38
39 ldmx_log(info) << "StripFitProcessor configured:" << " shape="
40 << PULSE_SHAPE_NAME << " tp=" << PEAKING_TIME_NS << " ns"
41 << " pedestal=" << ADC_PEDESTAL << " ADC"
42 << " noise_σ=" << NOISE_SIGMA_ADC << " ADC" << " T scan ["
43 << t_scan_min_ns_ << ", " << t_scan_max_ns_ << "] ns"
44 << " step=" << t_scan_step_ns_ << " ns";
45}

◆ produce()

void tracking::reco::StripFitProcessor::produce ( framework::Event & event)
overridevirtual

Process the event and put new data products into it.

Parameters
eventThe Event to process.

Implements framework::Producer.

Definition at line 47 of file StripFitProcessor.cxx.

47 {
48 const auto& raw_hits =
49 event.getCollection<ldmx::RawSiStripHit>(in_collection_, in_pass_);
50
51 std::vector<ldmx::FittedSiStripHit> fitted_hits;
52 fitted_hits.reserve(raw_hits.size());
53
54 ldmx_log(debug) << "Fitting " << raw_hits.size() << " RawSiStripHits";
55
56 for (const auto& raw : raw_hits) {
57 const auto result = fitter_->fit(raw.getSamples());
58
59 if (!result.converged) {
60 ldmx_log(trace) << "Fit did not converge for layer=" << raw.getLayerID()
61 << " strip=" << raw.getStripID() << " — skipping";
62 continue;
63 }
64
65 if (max_chi2_ndf_ > 0.0 && result.ndf > 0) {
66 const double reduced_chi2 = result.chi2 / result.ndf;
67 if (reduced_chi2 > max_chi2_ndf_) {
68 ldmx_log(trace) << "χ²/ndf=" << reduced_chi2
69 << " exceeds cut=" << max_chi2_ndf_ << " — skipping";
70 continue;
71 }
72 }
73
74 fitted_hits.emplace_back(
75 raw.getLayerID(), raw.getStripID(),
76 static_cast<float>(result.amplitude), static_cast<float>(result.t0),
77 static_cast<float>(result.chi2), result.ndf, raw.getTrackID(),
78 raw.getPdgID(), raw.getSimHitID(), raw.getEdep());
79
80 ldmx_log(trace) << "Fitted: layer=" << raw.getLayerID()
81 << " strip=" << raw.getStripID()
82 << " amp=" << result.amplitude << " t0=" << result.t0
83 << " ns" << " chi2/ndf=" << result.chi2 << "/"
84 << result.ndf;
85 }
86
87 ldmx_log(debug) << "Produced " << fitted_hits.size() << " FittedSiStripHits";
88
89 event.add(out_collection_, fitted_hits);
90}
Implementation of a raw digitized hit from a silicon strip detector.

Member Data Documentation

◆ fitter_

std::unique_ptr<tracking::digitization::StripPulseFitter> tracking::reco::StripFitProcessor::fitter_
private

Definition at line 70 of file StripFitProcessor.h.

◆ in_collection_

std::string tracking::reco::StripFitProcessor::in_collection_ {"RawSiStripHits"}
private

Definition at line 56 of file StripFitProcessor.h.

56{"RawSiStripHits"};

◆ in_pass_

std::string tracking::reco::StripFitProcessor::in_pass_ {""}
private

Definition at line 57 of file StripFitProcessor.h.

57{""};

◆ max_chi2_ndf_

double tracking::reco::StripFitProcessor::max_chi2_ndf_ {-1.0}
private

Definition at line 66 of file StripFitProcessor.h.

66{-1.0};

◆ out_collection_

std::string tracking::reco::StripFitProcessor::out_collection_ {"FittedSiStripHits"}
private

Definition at line 58 of file StripFitProcessor.h.

58{"FittedSiStripHits"};

◆ pulse_shape_

std::unique_ptr<tracking::digitization::PulseShape> tracking::reco::StripFitProcessor::pulse_shape_
private

Definition at line 69 of file StripFitProcessor.h.

◆ t_scan_max_ns_

double tracking::reco::StripFitProcessor::t_scan_max_ns_ {150.0}
private

Definition at line 62 of file StripFitProcessor.h.

62{150.0};

◆ t_scan_min_ns_

double tracking::reco::StripFitProcessor::t_scan_min_ns_ {-50.0}
private

Definition at line 61 of file StripFitProcessor.h.

61{-50.0};

◆ t_scan_step_ns_

double tracking::reco::StripFitProcessor::t_scan_step_ns_ {1.0}
private

Definition at line 63 of file StripFitProcessor.h.

63{1.0};

The documentation for this class was generated from the following files: