|
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. | |
| 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::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. | |
| int | overlay_incident_id_ {-1000} |
| For Ecal, overlay hits should be added as contribs. | |
| int | overlay_track_id_ {-1000} |
| int | overlay_pdg_code_ {0} |
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 26 of file OverlayProducer.h.
|
inline |
Definition at line 28 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_, 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_, poisson_mu_, sim_passname_, start_event_max_, start_event_min_, time_mean_, time_sigma_, and tracker_collections_.
|
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 59 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 367 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 80 of file OverlayProducer.cxx.
References bunch_spacing_, calo_collections_, do_poisson_in_time_, do_poisson_out_of_time_, framework::Event::getCollection(), n_earlier_, n_later_, out_coll_postfix_, overlay_event_, overlay_file_, overlay_incident_id_, overlay_passname_, poisson_mu_, rndm_, rndm_time_, sim_passname_, time_mean_, time_sigma_, and tracker_collections_.
|
private |
Spacing in time (in [ns]) between electron bunches.
Definition at line 163 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 92 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 120 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 126 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 170 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 177 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 114 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
The overlay ldmx event bus.
Definition at line 86 of file OverlayProducer.h.
Referenced by onNewRun(), onProcessStart(), and produce().
|
private |
Pileup overlay events input file.
Definition at line 81 of file OverlayProducer.h.
Referenced by onNewRun(), onProcessStart(), and produce().
|
private |
Pileup overlay events input file name.
Definition at line 76 of file OverlayProducer.h.
Referenced by configure(), and onProcessStart().
|
private |
For Ecal, overlay hits should be added as contribs.
But these are required to be unique, by the Ecal rconstruction code. So assign a nonsensical trackID, incidentID, and PDG ID to the contribs from overlay. These are hardwired right here.
Definition at line 197 of file OverlayProducer.h.
Referenced by produce().
|
private |
Pileup overlay events input pass name.
Definition at line 103 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Definition at line 199 of file OverlayProducer.h.
|
private |
Definition at line 198 of file OverlayProducer.h.
|
private |
The parameters used to configure this producer.
Definition at line 71 of file OverlayProducer.h.
Referenced by configure(), and onProcessStart().
|
private |
(average) total number of events
Definition at line 131 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 138 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 145 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 108 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Maximum event number to start overlaying from.
Inclusive.
Definition at line 189 of file OverlayProducer.h.
Referenced by configure(), and onNewRun().
|
private |
Minimum event number to start overlaying from.
Inclusive.
Definition at line 183 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 158 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 151 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 98 of file OverlayProducer.h.
Referenced by configure(), and produce().