1#include "Recon/BeamElectronLocator.h"
25 ldmx_log(debug) <<
"BeamElectronLocator is using parameters: "
43 ldmx_log(fatal) <<
"Attemping to use non-existing input collection "
45 <<
" to locate electrons! Exiting.";
49 std::vector<ldmx::BeamElectronTruth> beam_electron_info;
54 ldmx_log(info) <<
"Looping through simhits in event "
55 <<
event.getEventNumber() <<
".";
58 for (
const auto &sim_hit : sim_hits) {
60 bool is_matched =
false;
61 std::vector<float> pos = sim_hit.getPosition();
62 for (
auto found_electrons : beam_electron_info) {
64 if (fabs(pos[0] - found_electrons.getX()) <
tolerance_ &&
65 fabs(pos[1] - found_electrons.getY()) <
tolerance_) {
67 ldmx_log(debug) <<
"\tHit at (x_ = " << pos[0] <<
", y_ = " << pos[1]
68 <<
" matches electron found at (x_ = "
69 << found_electrons.getX()
70 <<
", y_ = " << found_electrons.getY()
71 <<
"); skip this simhit";
79 ldmx_log(info) <<
"\tHit at (x_ = " << pos[0] <<
", y_ = " << pos[1]
80 <<
" not formerly matched. Adding to collection.";
83 electron_info.
setXYZ(pos[0], pos[1], pos[2]);
96 beam_electron_info.push_back(electron_info);
106 while (coordinate > min + n * binWidth) {
108 if (min + n * binWidth > max) {
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Implements an event buffer system for storing event data.
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.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Represents the truth information on beam electrons at the target.
void setBarX(double x)
Set x bar number of the found beam electron.
void setBinnedY(double y)
SetBinned y coordinate of the found beam electron.
double getBarX()
Get x bar number of the found beam electron.
double getBarY()
Get y_ bar number of the found beam electron.
void setXYZ(double x, double y, double z)
Set all three spatial coordinates at once.
void setBarY(double y)
Set y_ bar number of the found beam electron.
void setBinnedX(double x)
SetBinned x coordinate of the found beam electron.
Stores simulated calorimeter hit information.
Electron counting processor.
std::string input_coll_
The name of the input collection used for counting electrons.
double max_ymm_
The max value measured by the system (edge) in Y, in mm.
double granularity_ymm_
The granularity of the detector (e.g.
void onProcessStart() override
Prints the configuration to log in debug mode.
void configure(framework::config::Parameters ¶meters) override
Configure the processor using the given user specified parameters.
double tolerance_
The tolerance within which simhits are considered to belong to the same electron.
double min_xmm_
The min value measured by the system (edge) in X, in mm.
virtual ~BeamElectronLocator()
Destructor.
BeamElectronLocator(const std::string &name, framework::Process &process)
Constructor.
std::string input_pass_name_
The pass name of the input collection used for counting electrons.
bool verbose_
Indicate verbose printout to log according to log level.
double min_ymm_
The min value measured by the system (edge) in Y, in mm.
double max_xmm_
The max value measured by the system (edge) in X, in mm.
std::string output_coll_
The name of the output collection used to save some electron counting variables.
double granularity_xmm_
The granularity of the detector (e.g.
int bin(float coordinate, double binWidth, double min, double max)
Bins coordinates according to some given granularity (passed as argument).
void produce(framework::Event &event) override
Process the event and put new data products into it.
All classes in the ldmx-sw project use this namespace.