1#include "Recon/BeamElectronLocator.h"
25 ldmx_log(debug) <<
"BeamElectronLocator is using parameters: "
32 <<
" \n\tmin_X_mm = " <<
minXmm_
33 <<
" \n\tmax_X_mm = " <<
maxXmm_
34 <<
" \n\tmin_Y_mm = " <<
minYmm_
35 <<
" \n\tmax_Y_mm = " <<
maxYmm_
43 ldmx_log(fatal) <<
"Attemping to use non-existing input collection "
45 <<
" to locate electrons! Exiting.";
49 std::vector<ldmx::BeamElectronTruth> beamElectronInfo;
54 ldmx_log(info) <<
"Looping through simhits in event "
55 <<
event.getEventNumber() <<
".";
58 for (
const auto &simHit : simHits) {
60 bool isMatched =
false;
61 std::vector<float> pos = simHit.getPosition();
62 for (
auto foundElectrons : beamElectronInfo) {
64 if (fabs(pos[0] - foundElectrons.getX()) <
tolerance_ &&
65 fabs(pos[1] - foundElectrons.getY()) <
tolerance_) {
67 ldmx_log(debug) <<
"\tHit at (x = " << pos[0] <<
", y = " << pos[1]
68 <<
" matches electron found at (x = "
69 << foundElectrons.getX()
70 <<
", y = " << foundElectrons.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 electronInfo.
setXYZ(pos[0], pos[1], pos[2]);
96 beamElectronInfo.push_back(electronInfo);
106 while (coordinate > min + n * binWidth) {
108 if (min + n * binWidth > max) {
#define DECLARE_PRODUCER_NS(NS, 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.
T getParameter(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.
double granularityYmm_
The granularity of the detector (e.g.
double minXmm_
The min value measured by the system (edge) in X, in mm.
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.
virtual ~BeamElectronLocator()
Destructor.
std::string outputColl_
The name of the output collection used to save some electron counting variables.
BeamElectronLocator(const std::string &name, framework::Process &process)
Constructor.
std::string inputPassName_
The pass name of the input collection used for counting electrons.
bool verbose_
Indicate verbose printout to log according to log level.
double minYmm_
The min value measured by the system (edge) in Y, in mm.
std::string inputColl_
The name of the input collection used for counting electrons.
double maxYmm_
The max value measured by the system (edge) in Y, in mm.
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.
double granularityXmm_
The granularity of the detector (e.g.
double maxXmm_
The max value measured by the system (edge) in X, in mm.
All classes in the ldmx-sw project use this namespace.