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 | beforeNewRun (ldmx::RunHeader &header) |
Handle allowing producers to modify run headers before the run begins. | |
Public Member Functions inherited from framework::EventProcessor | |
EventProcessor (const std::string &name, Process &process) | |
Class constructor. | |
virtual | ~EventProcessor () |
Class destructor. | |
virtual void | onFileOpen (EventFile &eventFile) |
Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened. | |
virtual void | onFileClose (EventFile &eventFile) |
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 | overlayFileName_ |
Pileup overlay events input file name. | |
std::unique_ptr< framework::EventFile > | overlayFile_ |
Pileup overlay events input file. | |
framework::Event | overlayEvent_ |
The overlay ldmx event bus. | |
std::vector< std::string > | caloCollections_ |
List of SimCalorimeterHit collection(s) to loop over and add hits from, combining sim and pileup. | |
std::vector< std::string > | trackerCollections_ |
List of SimTrackerHit collection(s) to loop over and add hits from, combining sim and pileup. | |
std::string | overlayPassName_ |
Pileup overlay events input pass name. | |
std::string | simPassName_ |
To use for finding the sim event bus passengers, mostly a disambiguation. | |
bool | doPoissonIT_ {false} |
Let the total number of in-time events be poisson distributed, or fix at the chosen value, poissonMu_. | |
bool | doPoissonOOT_ {false} |
Let the total number of out-of-time events be poisson distributed, or fix at the chosen value, poissonMu_. | |
double | poissonMu_ {0.} |
(average) total number of events | |
std::unique_ptr< TRandom2 > | rndm_ |
Random number generator for number of overlaid events. | |
std::unique_ptr< TRandom2 > | rndmTime_ |
Random number generator for pileup event time offset. | |
double | timeSigma_ {0.} |
Width of pileup bunch spread in time (in [ns]), specified as a sigma of a Gaussian distribution. | |
double | timeMean_ {0.} |
Average position in time (in [ns]) of pileup bunches, relative to the sim event. | |
double | bunchSpacing_ {0.} |
Spacing in time (in [ns]) between electron bunches. | |
int | nEarlier_ {0} |
Number of bunches before the sim event to pull pileup events from. | |
int | nLater_ {0} |
Number of bunches after the sim event to pull pileup events from. | |
int | verbosity_ |
Local control of processor verbosity. | |
int | overlayIncidentID_ {-1000} |
For Ecal, overlay hits should be added as contribs. | |
int | overlayTrackID_ {-1000} |
int | overlayPdgCode_ {0} |
Additional Inherited Members | |
Static Public Member Functions inherited from framework::EventProcessor | |
static void | declare (const std::string &classname, int classtype, EventProcessorMaker *) |
Internal function which is part of the PluginFactory machinery. | |
Static Public Attributes inherited from framework::Producer | |
static const int | CLASSTYPE {1} |
Constant used to track EventProcessor types by the PluginFactory. | |
Protected Member Functions inherited from framework::EventProcessor | |
void | abortEvent () |
Abort the event immediately. | |
Protected Attributes inherited from framework::EventProcessor | |
HistogramHelper | histograms_ |
Interface class for making and filling histograms. | |
NtupleManager & | ntuple_ {NtupleManager::getInstance()} |
Manager for any ntuples. | |
logging::logger | theLog_ |
The logger for this EventProcessor. | |
Class to overlay in-time pile-up events from an overlay file.
Definition at line 23 of file OverlayProducer.h.
|
inline |
Definition at line 25 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 9 of file OverlayProducer.cxx.
References bunchSpacing_, caloCollections_, doPoissonIT_, doPoissonOOT_, framework::config::Parameters::getParameter(), nEarlier_, nLater_, overlayFileName_, overlayPassName_, params_, poissonMu_, simPassName_, timeMean_, timeSigma_, trackerCollections_, and verbosity_.
|
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 60 of file OverlayProducer.cxx.
References framework::RandomNumberSeedService::CONDITIONS_OBJECT_NAME, framework::Event::getEventHeader(), overlayEvent_, overlayFile_, rndm_, and ldmx::EventHeader::setEventNumber().
|
overridevirtual |
At the start of processing, the pileup overlay file is set up.
Reimplemented from framework::EventProcessor.
Definition at line 391 of file OverlayProducer.cxx.
References overlayEvent_, overlayFile_, overlayFileName_, params_, and verbosity_.
|
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 bunchSpacing_, caloCollections_, framework::RandomNumberSeedService::CONDITIONS_OBJECT_NAME, doPoissonIT_, doPoissonOOT_, framework::Event::getCollection(), framework::Event::getEventHeader(), ldmx::EventHeader::getEventNumber(), nEarlier_, nLater_, overlayEvent_, overlayFile_, overlayIncidentID_, overlayPassName_, poissonMu_, ldmx::SimCalorimeterHit::Print(), ldmx::SimTrackerHit::Print(), rndm_, rndmTime_, simPassName_, timeMean_, timeSigma_, trackerCollections_, and verbosity_.
|
private |
Spacing in time (in [ns]) between electron bunches.
Definition at line 154 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 89 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 111 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 117 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 161 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 168 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
The overlay ldmx event bus.
Definition at line 83 of file OverlayProducer.h.
Referenced by onNewRun(), onProcessStart(), and produce().
|
private |
Pileup overlay events input file.
Definition at line 78 of file OverlayProducer.h.
Referenced by onNewRun(), onProcessStart(), and produce().
|
private |
Pileup overlay events input file name.
Definition at line 73 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 181 of file OverlayProducer.h.
Referenced by produce().
|
private |
Pileup overlay events input pass name.
Definition at line 100 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Definition at line 183 of file OverlayProducer.h.
|
private |
Definition at line 182 of file OverlayProducer.h.
|
private |
The parameters used to configure this producer.
Definition at line 68 of file OverlayProducer.h.
Referenced by configure(), and onProcessStart().
|
private |
(average) total number of events
Definition at line 122 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 129 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 136 of file OverlayProducer.h.
Referenced by produce().
|
private |
To use for finding the sim event bus passengers, mostly a disambiguation.
Definition at line 105 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
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 149 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 142 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 95 of file OverlayProducer.h.
Referenced by configure(), and produce().
|
private |
Local control of processor verbosity.
Definition at line 173 of file OverlayProducer.h.
Referenced by configure(), onProcessStart(), and produce().