|
LDMX Software
|
Class to overlay in-time pile-up events from an overlay file. More...
#include <OverlayProducer.h>
Public Member Functions | |
| OverlayProducer (const std::string &name, framework::Process &process) | |
| void | configure (framework::config::Parameters ¶meters) override |
| Configure the processor with input parameters from the python cofig. | |
| 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, using the RNSS. | |
| void | produce (framework::Event &event) override |
| Based on the list of collections to overlay, and the desired number of events, loop through all relevant collections and copy the sim event (once), and then add the corresponding collection from the pileup 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. | |
| void | onProcessStart () override |
| At the start of processing, the pileup overlay file is set up. | |
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 | 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 | |
| framework::config::Parameters | params_ |
| The parameters used to configure this producer. | |
| std::string | overlay_filename_ |
| Pileup overlay events input file name. | |
| std::unique_ptr< framework::EventFile > | overlay_file_ |
| Pileup overlay events input file. | |
| framework::Event | overlay_event_ |
| The overlay ldmx event bus. | |
| std::vector< std::string > | calo_collections_ |
| List of SimCalorimeterHit collection(s) to loop over and add hits from, combining sim and pileup. | |
| std::vector< std::string > | tracker_collections_ |
| List of SimTrackerHit collection(s) to loop over and add hits from, combining sim and pileup. | |
| std::vector< std::string > | particle_collections_ |
| List of SimParticle collection(s) to loop over and add hits from, combining sim and pileup. | |
| std::vector< std::string > | contrib_collections_ |
| List of SimCalorimeterHit collections which keep track of hit contribs. | |
| std::string | overlay_passname_ |
| Pileup overlay events input pass name. | |
| std::string | sim_passname_ |
| To use for finding the sim event bus passengers, mostly a disambiguation. | |
| std::string | out_coll_postfix_ |
| Postfix to add to the collection name of the overlayed collections. | |
| bool | do_poisson_in_time_ {false} |
| Let the total number of in-time events be poisson distributed, or fix at the chosen value, poissonMu_. | |
| bool | do_poisson_out_of_time_ {false} |
| Let the total number of out-of-time events be poisson distributed, or fix at the chosen value, poissonMu_. | |
| double | poisson_mu_ {0.} |
| (average) total number of events | |
| std::unique_ptr< TRandom2 > | rndm_ |
| Random number generator for number of overlaid events. | |
| std::unique_ptr< TRandom2 > | rndm_time_ |
| Random number generator for pileup event time offset. | |
| double | time_sigma_ {0.} |
| Width of pileup bunch spread in time (in [ns]), specified as a sigma of a Gaussian distribution. | |
| double | time_mean_ {0.} |
| Average position in time (in [ns]) of pileup bunches, relative to the sim event. | |
| double | bunch_spacing_ {0.} |
| Spacing in time (in [ns]) between electron bunches. | |
| int | n_earlier_ {0} |
| Number of bunches before the sim event to pull pileup events from. | |
| int | n_later_ {0} |
| Number of bunches after the sim event to pull pileup events from. | |
| int | start_event_min_ {1} |
| Minimum event number to start overlaying from. | |
| int | start_event_max_ {10000} |
| Maximum event number to start overlaying from. | |
| unsigned | track_id_encoding_ {0} |
| Track ID encoding scheme version. | |
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 | |
| NtupleManager & | ntuple_ {NtupleManager::getInstance()} |
| Manager for any ntuples. | |
| logging::logger | the_log_ |
| The logger for this EventProcessor. | |
Class to overlay in-time pile-up events from an overlay file.
Definition at line 30 of file OverlayProducer.h.
|
inline |
Definition at line 32 of file OverlayProducer.h.
|
overridevirtual |
Configure the processor with input parameters from the python cofig.
Print the parameters actually set. Helpful in case of typos.
Reimplemented from framework::EventProcessor.
Definition at line 5 of file OverlayProducer.cxx.
References bunch_spacing_, calo_collections_, contrib_collections_, do_poisson_in_time_, do_poisson_out_of_time_, framework::config::Parameters::get(), n_earlier_, n_later_, out_coll_postfix_, overlay_filename_, overlay_passname_, params_, particle_collections_, poisson_mu_, sim_passname_, start_event_max_, start_event_min_, time_mean_, time_sigma_, track_id_encoding_, and tracker_collections_.
| int recon::OverlayProducer::encodeTrack | ( | int | track_id, |
| const unsigned int | encoding_version, | ||
| const unsigned int | event_index = 0 ) |
Encode track ID with overlay event information.
Performs bitwise encoding on track ID integer with version and event index.
VERSION DESCRIPTION
Definition at line 534 of file OverlayProducer.cxx.
Referenced by produce().
|
overridevirtual |
At the start of the run, the pileup overlay file is set up, and the starting event number is chosen, using the RNSS.
set up random seeds
Reimplemented from framework::EventProcessor.
Definition at line 81 of file OverlayProducer.cxx.
References framework::RandomNumberSeedService::CONDITIONS_OBJECT_NAME, framework::EventProcessor::getCondition(), framework::Event::getEventHeader(), overlay_event_, overlay_file_, rndm_, rndm_time_, ldmx::EventHeader::setEventNumber(), start_event_max_, and start_event_min_.
|
overridevirtual |
At the start of processing, the pileup overlay file is set up.
Reimplemented from framework::EventProcessor.
Definition at line 592 of file OverlayProducer.cxx.
References overlay_event_, overlay_file_, overlay_filename_, and params_.
|
overridevirtual |
Based on the list of collections to overlay, and the desired number of events, loop through all relevant collections and copy the sim event (once), and then add the corresponding collection from the pileup overlay file.
The event loop is the outer loop, and the inner loop is over the list of collections.
The collections have to be specified separately as a list of SimCalorimeterHit collections and a list of SimTrackerHit collections.
The collection name is parsed for "Ecal" to be flagged as a collection which needs overlay hits to be added as contribs. This is currently hardwired.
The resulting collections inherit the input collection name, with an appended string "Overlay". This name is also currently hardwired.
Go to next overlay event This overlay file has been configured to loop back to the beginning of the TTree when it reaches the end. This means nextEvent() will only return false if an error is occurred or if the overlay file is mis-configured.
Implements framework::Producer.
Definition at line 102 of file OverlayProducer.cxx.
References bunch_spacing_, calo_collections_, contrib_collections_, do_poisson_in_time_, do_poisson_out_of_time_, encodeTrack(), framework::Event::getCollection(), framework::Event::getMap(), n_earlier_, n_later_, out_coll_postfix_, overlay_event_, overlay_file_, overlay_passname_, particle_collections_, poisson_mu_, rndm_, rndm_time_, sim_passname_, time_mean_, time_sigma_, track_id_encoding_, and tracker_collections_.
|
private |
Spacing in time (in [ns]) between electron bunches.
Definition at line 191 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
List of SimCalorimeterHit collection(s) to loop over and add hits from, combining sim and pileup.
Definition at line 109 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
List of SimCalorimeterHit collections which keep track of hit contribs.
Definition at line 126 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Let the total number of in-time events be poisson distributed, or fix at the chosen value, poissonMu_.
Definition at line 148 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Let the total number of out-of-time events be poisson distributed, or fix at the chosen value, poissonMu_.
Definition at line 154 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Number of bunches before the sim event to pull pileup events from.
Defaults to 0 --> all events occur in the same bunch as the sim event.
Definition at line 198 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Number of bunches after the sim event to pull pileup events from.
Defaults to 0 --> all events occur in the same bunch as the sim event.
Definition at line 205 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Postfix to add to the collection name of the overlayed collections.
This is currently set to "Overlay".
Definition at line 142 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
The overlay ldmx event bus.
Definition at line 103 of file OverlayProducer.h.
Referenced by onNewRun(), onProcessStart(), and produce().
|
private |
Pileup overlay events input file.
Definition at line 98 of file OverlayProducer.h.
Referenced by onNewRun(), onProcessStart(), and produce().
|
private |
Pileup overlay events input file name.
Definition at line 93 of file OverlayProducer.h.
Referenced by configure(), and onProcessStart().
|
private |
Pileup overlay events input pass name.
Definition at line 131 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
The parameters used to configure this producer.
Definition at line 88 of file OverlayProducer.h.
Referenced by configure(), and onProcessStart().
|
private |
List of SimParticle collection(s) to loop over and add hits from, combining sim and pileup.
Definition at line 121 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
(average) total number of events
Definition at line 159 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Random number generator for number of overlaid events.
TRandom2 slightly (~10%) faster than TRandom3; shorter period but our input files will have way shorter period anyway.
Definition at line 166 of file OverlayProducer.h.
Referenced by onNewRun(), and produce().
|
private |
Random number generator for pileup event time offset.
TRandom2 slightly (~10%) faster than TRandom3; shorter period but our input files will have way shorter period anyway.
Definition at line 173 of file OverlayProducer.h.
Referenced by onNewRun(), and produce().
|
private |
To use for finding the sim event bus passengers, mostly a disambiguation.
Definition at line 136 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Maximum event number to start overlaying from.
Inclusive.
Definition at line 217 of file OverlayProducer.h.
Referenced by configure(), and onNewRun().
|
private |
Minimum event number to start overlaying from.
Inclusive.
Definition at line 211 of file OverlayProducer.h.
Referenced by configure(), and onNewRun().
|
private |
Average position in time (in [ns]) of pileup bunches, relative to the sim event.
Should realistically be 0. Using a non-zero mean and sigma = 0 is however useful for validation.
Definition at line 186 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Width of pileup bunch spread in time (in [ns]), specified as a sigma of a Gaussian distribution.
Definition at line 179 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Track ID encoding scheme version.
Version is stored in first 4 bits after the sign bit in the track ID int variables (i.e. bits 28-31)
If this variable is left as the hardcoded default 0, then the OverlayProducer will default to not managing track IDs, instead setting all equal to nonsense values as was the case before the introduction of this track ID management.
Definition at line 229 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
List of SimTrackerHit collection(s) to loop over and add hits from, combining sim and pileup.
Definition at line 115 of file OverlayProducer.h.
Referenced by configure(), and produce().