LDMX Software
dqm::EcalSPElectronKinematics Class Reference

Extracts and histograms the kinematics of the primary electron at the ECal front-face scoring plane. More...

#include <EcalSPElectronKinematics.h>

Public Member Functions

 EcalSPElectronKinematics (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &ps) override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
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 onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
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 ecal_sp_coll_name_
 
std::string ecal_sp_pass_name_
 

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

Extracts and histograms the kinematics of the primary electron at the ECal front-face scoring plane.

Searches EcalScoringPlaneHits for the primary beam electron (track ID 1, PDG ID 11) crossing plane 31 (ECal front face) in the forward direction. The hit energy, three-momentum, and transverse position are stored in the event tree and histogrammed.

Products

EcalSPEnergy - total energy at ECal front face [MeV] EcalSP{Px,Py,Pz} - momentum components [MeV] EcalSP{X,Y} - transverse position at ECal front face [mm]

Definition at line 24 of file EcalSPElectronKinematics.h.

Constructor & Destructor Documentation

◆ EcalSPElectronKinematics()

dqm::EcalSPElectronKinematics::EcalSPElectronKinematics ( const std::string & name,
framework::Process & process )
inline

Definition at line 26 of file EcalSPElectronKinematics.h.

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 dqm::EcalSPElectronKinematics::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 10 of file EcalSPElectronKinematics.cxx.

10 {
11 ecal_sp_coll_name_ = ps.get<std::string>("ecal_sp_coll_name");
12 ecal_sp_pass_name_ = ps.get<std::string>("ecal_sp_pass_name");
13}

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

◆ produce()

void dqm::EcalSPElectronKinematics::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 15 of file EcalSPElectronKinematics.cxx.

15 {
17
18 if (!event.exists(ecal_sp_coll_name_, ecal_sp_pass_name_)) return;
19
20 const auto& sp_hits{event.getCollection<ldmx::SimTrackerHit>(
21 ecal_sp_coll_name_, ecal_sp_pass_name_)};
22
23 for (const auto& hit : sp_hits) {
24 ldmx::SimSpecialID hit_id(hit.getID());
25 // Plane 31 is the ECal front face; require forward-going particle
26 if (hit_id.plane() != 31) continue;
27 const auto p = hit.getMomentum();
28 if (p[2] <= 0) continue;
29 // Only the primary beam electron
30 if (hit.getTrackID() != 1 || hit.getPdgID() != 11) continue;
31
32 float energy = hit.getEnergy();
33 float px = static_cast<float>(p[0]);
34 float py = static_cast<float>(p[1]);
35 float pz = static_cast<float>(p[2]);
36 const auto pos = hit.getPosition();
37 float x = pos[0], y = pos[1];
38 float pt = std::sqrt(px * px + py * py);
39
40 event.add("EcalSPEnergy", energy);
41 event.add("EcalSPPx", px);
42 event.add("EcalSPPy", py);
43 event.add("EcalSPPz", pz);
44 event.add("EcalSPX", x);
45 event.add("EcalSPY", y);
46
47 histograms_.fill("energy", energy);
48 histograms_.fill("pt", pt);
49 histograms_.fill("px", px);
50 histograms_.fill("py", py);
51 histograms_.fill("x", x);
52 histograms_.fill("y", y);
53
54 // Use only the first matching hit
55 break;
56 }
57}
HistogramPool histograms_
helper object for making and filling histograms
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:105
ldmx::EventHeader & getEventHeader()
Get the event header.
Definition Event.h:59
void setWeight(double w)
Set the weight for filling the histograms.
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
double getWeight() const
Get the event weight (default of 1.0).
Definition EventHeader.h:98
Implements detector ids for special simulation-derived hits like scoring planes.
Represents a simulated tracker hit in the simulation.

References framework::Event::exists(), framework::HistogramPool::fill(), framework::Event::getEventHeader(), ldmx::EventHeader::getWeight(), framework::EventProcessor::histograms_, ldmx::SimSpecialID::plane(), and framework::HistogramPool::setWeight().

Member Data Documentation

◆ ecal_sp_coll_name_

std::string dqm::EcalSPElectronKinematics::ecal_sp_coll_name_
private

Definition at line 35 of file EcalSPElectronKinematics.h.

◆ ecal_sp_pass_name_

std::string dqm::EcalSPElectronKinematics::ecal_sp_pass_name_
private

Definition at line 36 of file EcalSPElectronKinematics.h.


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