LDMX Software
OverlayProducer.h
1#ifndef RECON_OVERLAYPRODUCER_H
2#define RECON_OVERLAYPRODUCER_H
3
4//---< C++ StdLib >---//
5#include <algorithm>
6#include <bitset>
7#include <map>
8#include <memory>
9#include <string>
10#include <vector>
11
12//---< ROOT >---//
13#include "TFile.h"
14#include "TRandom2.h"
15
16//---< Framework >---//
17#include "Framework/Configure/Parameters.h"
18#include "Framework/EventFile.h"
20#include "Framework/Exception/Exception.h"
24
25namespace recon {
26
31 public:
32 OverlayProducer(const std::string &name, framework::Process &process)
33 : framework::Producer(name, process), overlay_event_{"overlay"} {}
34
35 // Destructor
36 virtual ~OverlayProducer() = default;
37
41 void configure(framework::config::Parameters &parameters) override;
42
47 void onNewRun(const ldmx::RunHeader &) override; // ); //
48
66 void produce(framework::Event &event) override;
67
78 int encodeTrack(int track_id, const unsigned int encoding_version,
79 const unsigned int event_index = 0);
80
84 void onProcessStart() override;
85
86 private:
89
93 std::string overlay_filename_;
94
98 std::unique_ptr<framework::EventFile> overlay_file_;
99
104
109 std::vector<std::string> calo_collections_;
110
115 std::vector<std::string> tracker_collections_;
116
121 std::vector<std::string> particle_collections_;
122
126 std::vector<std::string> contrib_collections_;
127
131 std::string overlay_passname_;
132
136 std::string sim_passname_;
137
142 std::string out_coll_postfix_;
143
149
155
159 double poisson_mu_{0.};
160
166 std::unique_ptr<TRandom2> rndm_;
167
173 std::unique_ptr<TRandom2> rndm_time_;
174
179 double time_sigma_{0.};
180
186 double time_mean_{0.};
187
191 double bunch_spacing_{0.};
192
199
205 int n_later_{0};
206
212
218
230};
231} // namespace recon
232
233#endif /* RECON_OVERLAY_OVERLAYPRODUCER_H */
Base classes for all user event processing components to extend.
Conditions object for random number seeds.
Class which stores simulated calorimeter hit information.
Class which encapsulates information from a hit in a simulated tracking detector.
Implements an event buffer system for storing event data.
Definition Event.h:42
Class which represents the process under execution.
Definition Process.h:37
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.
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
Class to overlay in-time pile-up events from an overlay file.
int encodeTrack(int track_id, const unsigned int encoding_version, const unsigned int event_index=0)
Encode track ID with overlay event information.
int start_event_max_
Maximum event number to start overlaying from.
std::vector< std::string > particle_collections_
List of SimParticle collection(s) to loop over and add hits from, combining sim and pileup.
std::string overlay_filename_
Pileup overlay events input file name.
std::unique_ptr< framework::EventFile > overlay_file_
Pileup overlay events input file.
bool do_poisson_in_time_
Let the total number of in-time events be poisson distributed, or fix at the chosen value,...
int n_later_
Number of bunches after the sim event to pull pileup events from.
std::string overlay_passname_
Pileup overlay events input pass name.
bool do_poisson_out_of_time_
Let the total number of out-of-time events be poisson distributed, or fix at the chosen value,...
void onNewRun(const ldmx::RunHeader &) override
At the start of the run, the pileup overlay file is set up, and the starting event number is chosen,...
std::vector< std::string > tracker_collections_
List of SimTrackerHit collection(s) to loop over and add hits from, combining sim and pileup.
framework::config::Parameters params_
The parameters used to configure this producer.
std::vector< std::string > contrib_collections_
List of SimCalorimeterHit collections which keep track of hit contribs.
double bunch_spacing_
Spacing in time (in [ns]) between electron bunches.
std::string sim_passname_
To use for finding the sim event bus passengers, mostly a disambiguation.
std::vector< std::string > calo_collections_
List of SimCalorimeterHit collection(s) to loop over and add hits from, combining sim and pileup.
std::unique_ptr< TRandom2 > rndm_time_
Random number generator for pileup event time offset.
std::unique_ptr< TRandom2 > rndm_
Random number generator for number of overlaid events.
void produce(framework::Event &event) override
Based on the list of collections to overlay, and the desired number of events, loop through all relev...
double poisson_mu_
(average) total number of events
void configure(framework::config::Parameters &parameters) override
Configure the processor with input parameters from the python cofig.
unsigned track_id_encoding_
Track ID encoding scheme version.
std::string out_coll_postfix_
Postfix to add to the collection name of the overlayed collections.
void onProcessStart() override
At the start of processing, the pileup overlay file is set up.
double time_sigma_
Width of pileup bunch spread in time (in [ns]), specified as a sigma of a Gaussian distribution.
int start_event_min_
Minimum event number to start overlaying from.
framework::Event overlay_event_
The overlay ldmx event bus.
double time_mean_
Average position in time (in [ns]) of pileup bunches, relative to the sim event.
int n_earlier_
Number of bunches before the sim event to pull pileup events from.