LDMX Software
ecal::EcalVetoProcessor Class Reference

Determines if event is vetoable using ECAL hit information. More...

#include <EcalVetoProcessor.h>

Public Types

typedef std::pair< ldmx::EcalID, float > CellEnergyPair
 
typedef std::pair< float, float > XYCoords
 

Public Member Functions

 EcalVetoProcessor (const std::string &name, framework::Process &process)
 
void onNewRun (const ldmx::RunHeader &rh) override
 onNewRun is the first function called for each processor after the conditions are fully configured and accessible.
 
void onProcessEnd () override
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified 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 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.
 
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 Member Functions

void clearProcessor ()
 
ldmx::EcalID getShowerCentroidIdAndRms (const std::vector< ldmx::EcalHit > &ecal_rec_hits, float &shower_rms)
 
void fillHitMap (const std::vector< ldmx::EcalHit > &ecal_rec_hits, std::map< ldmx::EcalID, float > &cell_map_)
 Function to load up empty vector of hit maps.
 
void fillIsolatedHitMap (const std::vector< ldmx::EcalHit > &ecal_rec_hits, ldmx::EcalID global_centroid, std::map< ldmx::EcalID, float > &cell_map, std::map< ldmx::EcalID, float > &cell_map_iso, bool doTight=false)
 
std::vector< XYCoords > getTrajectory (std::array< float, 3 > momentum, std::array< float, 3 > position)
 
void buildBDTFeatureVector (const ldmx::EcalVetoResult &result)
 

Private Attributes

int nevents_ {0}
 
float processing_time_ {0.}
 
std::map< std::string, float > profiling_map_
 
std::map< ldmx::EcalID, float > cell_map_
 
std::map< ldmx::EcalID, float > cell_map_tight_iso_
 
std::vector< float > ecal_layer_edep_raw_
 
std::vector< float > ecal_layer_edep_readout_
 
std::vector< float > ecal_layer_time_
 
std::vector< std::vector< float > > roc_range_values_
 
int n_ecal_layers_ {0}
 
int n_readout_hits_ {0}
 
int deepest_layer_hit_ {0}
 
float summed_det_ {0}
 
float summed_tight_iso_ {0}
 
float max_cell_dep_ {0}
 
float shower_rms_ {0}
 
float x_std_ {0}
 
float y_std_ {0}
 
float avg_layer_hit_ {0}
 
float std_layer_hit_ {0}
 
float ecal_back_energy_ {0}
 
int n_tracking_hits_ {0}
 Number of hits outside of the electron roc in the Ecal or if the electron trajectory is missing, all the hits in the Ecal.
 
float ep_ang_ {0}
 Angular separation between the projected photon and electron trajectories as projected at ECAL.
 
float ep_ang_at_target_ {0}
 Angular separation between the projected photon and electron trajectories as at Target.
 
float ep_sep_ {0}
 Distance between the projected photon and electron trajectories at the ECal face.
 
float ep_dot_ {0}
 Dot product of the photon and electron momenta unit vectors at Ecal.
 
float ep_dot_at_target_ {0}
 Dot product of the photon and electron momenta unit vectors at Target.
 
float bdt_cut_val_ {0}
 
float beam_energy_mev_ {0}
 
std::string bdt_file_name_
 
std::string bdt_feature_config_
 
std::string roc_file_name_
 
std::vector< float > bdt_features_
 
std::string feature_list_name_
 
std::string ecal_sp_coll_name_
 
std::string target_sp_coll_name_
 
std::string sp_pass_name_
 
std::string rec_pass_name_
 
std::string rec_coll_name_
 
bool recoil_from_tracking_
 
std::string track_pass_name_
 
std::string track_collection_
 
std::string sim_particles_coll_name_
 
std::string sim_particles_passname_
 
bool inverse_skim_ {false}
 
std::string collection_name_ {"EcalVeto"}
 Name of the collection which will containt the results.
 
std::unique_ptr< ldmx::ort::ONNXRuntimert_
 
const ldmx::EcalGeometrygeometry_
 handle to current geometry (to share with member functions)
 

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

Determines if event is vetoable using ECAL hit information.

Definition at line 45 of file EcalVetoProcessor.h.

Member Typedef Documentation

◆ CellEnergyPair

std::pair<ldmx::EcalID, float> ecal::EcalVetoProcessor::CellEnergyPair

Definition at line 47 of file EcalVetoProcessor.h.

◆ XYCoords

std::pair<float, float> ecal::EcalVetoProcessor::XYCoords

Definition at line 49 of file EcalVetoProcessor.h.

Constructor & Destructor Documentation

◆ EcalVetoProcessor()

ecal::EcalVetoProcessor::EcalVetoProcessor ( const std::string & name,
framework::Process & process )
inline

Definition at line 51 of file EcalVetoProcessor.h.

52 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

◆ ~EcalVetoProcessor()

virtual ecal::EcalVetoProcessor::~EcalVetoProcessor ( )
inlinevirtual

Definition at line 54 of file EcalVetoProcessor.h.

54{}

Member Function Documentation

◆ buildBDTFeatureVector()

void ecal::EcalVetoProcessor::buildBDTFeatureVector ( const ldmx::EcalVetoResult & result)
private

Electron RoC variables

Photon RoC variables

Outside RoC variables

Definition at line 17 of file EcalVetoProcessor.cxx.

18 {
19 // Base variables
20 bdt_features_.push_back(result.getNReadoutHits());
21 bdt_features_.push_back(result.getSummedDet());
22 bdt_features_.push_back(result.getSummedTightIso());
23 bdt_features_.push_back(result.getMaxCellDep());
24 bdt_features_.push_back(result.getShowerRMS());
25 bdt_features_.push_back(result.getXStd());
26 bdt_features_.push_back(result.getYStd());
27 bdt_features_.push_back(result.getAvgLayerHit());
28 bdt_features_.push_back(result.getStdLayerHit());
29 bdt_features_.push_back(result.getDeepestLayerHit());
30 bdt_features_.push_back(result.getEcalBackEnergy());
31 // MIP tracking
32 if (bdt_feature_config_ == "segmip") {
33 bdt_features_.push_back(-1.); // NStraight
34 bdt_features_.push_back(-1.); // FirstNearPHLayer
35 bdt_features_.push_back(-1.); // NNearPHHits
36 bdt_features_.push_back(-1.); // PhotonTerritoryHits
37 }
38
39 // bdt_features_.push_back(result.getNStraightTracks());
40 // bdt_features_.push_back(result.getFirstNearPhLayer());
41 // bdt_features_.push_back(result.getNNearPhHits());
42 // bdt_features_.push_back(result.getPhotonTerritoryHits());
43 if (bdt_feature_config_ == "wab_recrem") {
44 bdt_features_.push_back(result.getNTrackingHits());
45 }
46 bdt_features_.push_back(result.getEPSep());
47 bdt_features_.push_back(result.getEPDot());
48 // Longitudinal segment variables
49 bdt_features_.push_back(result.getEnergySeg()[0]);
50 bdt_features_.push_back(result.getXMeanSeg()[0]);
51 bdt_features_.push_back(result.getYMeanSeg()[0]);
52 bdt_features_.push_back(result.getLayerMeanSeg()[0]);
53 bdt_features_.push_back(result.getEnergySeg()[1]);
54 bdt_features_.push_back(result.getYMeanSeg()[2]);
56 bdt_features_.push_back(result.getEleContEnergy()[0][0]);
57 bdt_features_.push_back(result.getEleContEnergy()[1][0]);
58 bdt_features_.push_back(result.getEleContYMean()[0][0]);
59 bdt_features_.push_back(result.getEleContEnergy()[0][1]);
60 bdt_features_.push_back(result.getEleContEnergy()[1][1]);
61 bdt_features_.push_back(result.getEleContYMean()[0][1]);
63 bdt_features_.push_back(result.getPhContNHits()[0][0]);
64 bdt_features_.push_back(result.getPhContYMean()[0][0]);
65 bdt_features_.push_back(result.getPhContNHits()[0][1]);
67 bdt_features_.push_back(result.getOutContEnergy()[0][0]);
68 bdt_features_.push_back(result.getOutContEnergy()[1][0]);
69 bdt_features_.push_back(result.getOutContEnergy()[2][0]);
70 bdt_features_.push_back(result.getOutContNHits()[0][0]);
71 bdt_features_.push_back(result.getOutContXMean()[0][0]);
72 bdt_features_.push_back(result.getOutContYMean()[0][0]);
73 bdt_features_.push_back(result.getOutContYMean()[1][0]);
74 bdt_features_.push_back(result.getOutContYStd()[0][0]);
75 bdt_features_.push_back(result.getOutContEnergy()[0][1]);
76 bdt_features_.push_back(result.getOutContEnergy()[1][1]);
77 bdt_features_.push_back(result.getOutContEnergy()[2][1]);
78 bdt_features_.push_back(result.getOutContLayerMean()[0][1]);
79 bdt_features_.push_back(result.getOutContLayerStd()[0][1]);
80 bdt_features_.push_back(result.getOutContEnergy()[0][2]);
81 bdt_features_.push_back(result.getOutContLayerMean()[0][2]);
82}

Referenced by produce().

◆ clearProcessor()

void ecal::EcalVetoProcessor::clearProcessor ( )
private

Definition at line 144 of file EcalVetoProcessor.cxx.

144 {
145 cell_map_.clear();
146 cell_map_tight_iso_.clear();
147 bdt_features_.clear();
148
149 n_readout_hits_ = 0;
150 summed_det_ = 0;
151 summed_tight_iso_ = 0;
152 max_cell_dep_ = 0;
153 shower_rms_ = 0;
154 x_std_ = 0;
155 y_std_ = 0;
156 avg_layer_hit_ = 0;
157 std_layer_hit_ = 0;
158 deepest_layer_hit_ = 0;
159 ecal_back_energy_ = 0;
161 ep_ang_ = 0;
163 ep_sep_ = 0;
164 ep_dot_ = 0;
166
167 std::fill(ecal_layer_edep_raw_.begin(), ecal_layer_edep_raw_.end(), 0);
168 std::fill(ecal_layer_edep_readout_.begin(), ecal_layer_edep_readout_.end(),
169 0);
170 std::fill(ecal_layer_time_.begin(), ecal_layer_time_.end(), 0);
171}
float ep_ang_
Angular separation between the projected photon and electron trajectories as projected at ECAL.
float ep_ang_at_target_
Angular separation between the projected photon and electron trajectories as at Target.
float ep_dot_
Dot product of the photon and electron momenta unit vectors at Ecal.
float ep_sep_
Distance between the projected photon and electron trajectories at the ECal face.
int n_tracking_hits_
Number of hits outside of the electron roc in the Ecal or if the electron trajectory is missing,...
float ep_dot_at_target_
Dot product of the photon and electron momenta unit vectors at Target.

◆ configure()

void ecal::EcalVetoProcessor::configure ( framework::config::Parameters & parameters)
overridevirtual

Configure the processor using the given user specified parameters.

Parameters
parametersSet of parameters used to configure this processor.

Reimplemented from framework::EventProcessor.

Definition at line 84 of file EcalVetoProcessor.cxx.

84 {
85 feature_list_name_ = parameters.get<std::string>("feature_list_name");
86 bdt_feature_config_ = parameters.get<std::string>("bdt_feature_config");
87
88 sim_particles_passname_ =
89 parameters.get<std::string>("sim_particles_passname");
90 // Load BDT ONNX file
91 rt_ = std::make_unique<ldmx::ort::ONNXRuntime>(
92 parameters.get<std::string>("bdt_file"));
93
94 // Read in arrays holding 68% containment radius_ per layer_
95 // for different bins in momentum/angle
96 roc_file_name_ = parameters.get<std::string>("roc_file");
97 if (!std::ifstream(roc_file_name_).good()) {
98 EXCEPTION_RAISE(
99 "EcalVetoProcessor",
100 "The specified RoC file '" + roc_file_name_ + "' does not exist!");
101 } else {
102 std::ifstream rocfile(roc_file_name_);
103 std::string line, value;
104
105 // Extract the first line in the file
106 std::getline(rocfile, line);
107 std::vector<float> values;
108
109 // Read data, line by line
110 while (std::getline(rocfile, line)) {
111 std::stringstream ss(line);
112 values.clear();
113 while (std::getline(ss, value, ',')) {
114 float f_value = (value != "") ? std::stof(value) : -1.0;
115 values.push_back(f_value);
116 }
117 roc_range_values_.push_back(values);
118 }
119 }
120
121 n_ecal_layers_ = parameters.get<int>("num_ecal_layers");
122
123 bdt_cut_val_ = parameters.get<double>("disc_cut");
124 ecal_layer_edep_raw_.resize(n_ecal_layers_, 0);
125 ecal_layer_edep_readout_.resize(n_ecal_layers_, 0);
126 ecal_layer_time_.resize(n_ecal_layers_, 0);
127
128 beam_energy_mev_ = parameters.get<double>("beam_energy");
129 // Set the collection name as defined in the configuration
130 ecal_sp_coll_name_ = parameters.get<std::string>("ecal_sp_coll_name");
131 target_sp_coll_name_ = parameters.get<std::string>("target_sp_coll_name");
132 sp_pass_name_ = parameters.get<std::string>("sp_pass_name");
133 sim_particles_coll_name_ =
134 parameters.get<std::string>("sim_particles_coll_name");
135 collection_name_ = parameters.get<std::string>("collection_name");
136 rec_pass_name_ = parameters.get<std::string>("rec_pass_name");
137 rec_coll_name_ = parameters.get<std::string>("rec_coll_name");
138 recoil_from_tracking_ = parameters.get<bool>("recoil_from_tracking");
139 track_collection_ = parameters.get<std::string>("track_collection");
140 track_pass_name_ = parameters.get<std::string>("track_pass_name", "");
141 inverse_skim_ = parameters.get<bool>("inverse_skim");
142}
std::string collection_name_
Name of the collection which will containt the results.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

References collection_name_, and framework::config::Parameters::get().

◆ fillHitMap()

void ecal::EcalVetoProcessor::fillHitMap ( const std::vector< ldmx::EcalHit > & ecal_rec_hits,
std::map< ldmx::EcalID, float > & cell_map_ )
private

Function to load up empty vector of hit maps.

Definition at line 1033 of file EcalVetoProcessor.cxx.

1035 {
1036 for (const ldmx::EcalHit& hit : ecal_rec_hits) {
1037 ldmx::EcalID id(hit.getID());
1038 cellMap.emplace(id, hit.getEnergy());
1039 }
1040}
Stores reconstructed hit information from the ECAL.
Definition EcalHit.h:19
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20

Referenced by produce().

◆ fillIsolatedHitMap()

void ecal::EcalVetoProcessor::fillIsolatedHitMap ( const std::vector< ldmx::EcalHit > & ecal_rec_hits,
ldmx::EcalID global_centroid,
std::map< ldmx::EcalID, float > & cell_map,
std::map< ldmx::EcalID, float > & cell_map_iso,
bool doTight = false )
private

Definition at line 1042 of file EcalVetoProcessor.cxx.

1045 {
1046 for (const ldmx::EcalHit& hit : ecal_rec_hits) {
1047 auto isolated_hit = std::make_pair(true, ldmx::EcalID());
1048 ldmx::EcalID id(hit.getID());
1049 if (do_tight) {
1050 // Disregard hits_ that are on the centroid.
1051 if (id == global_centroid) continue;
1052
1053 // Skip hits_ that are on centroid inner ring
1054 if (geometry_->isNN(global_centroid, id)) {
1055 continue;
1056 }
1057 }
1058
1059 // Skip hits_ that have a readout neighbor
1060 // Get neighboring cell id's and try to look them up in the full cell map
1061 // (constant speed algo.)
1062 // these ideas are only cell/module_ (must ignore layer_)
1063 std::vector<ldmx::EcalID> cell_nbr_ids = geometry_->getNN(id);
1064
1065 for (int k = 0; k < cell_nbr_ids.size(); k++) {
1066 // update neighbor ID to the current layer_
1067 cell_nbr_ids[k] = ldmx::EcalID(id.layer(), cell_nbr_ids[k].module(),
1068 cell_nbr_ids[k].cell());
1069 // look in cell hit map to see if it is there
1070 if (cellMap.find(cell_nbr_ids[k]) != cellMap.end()) {
1071 isolated_hit = std::make_pair(false, cell_nbr_ids[k]);
1072 break;
1073 }
1074 }
1075 if (!isolated_hit.first) {
1076 continue;
1077 }
1078 // Insert isolated hit
1079 cellMapIso.emplace(id, hit.getEnergy());
1080 }
1081}
const ldmx::EcalGeometry * geometry_
handle to current geometry (to share with member functions)
std::vector< EcalID > getNN(EcalID id) const
Get the Nearest Neighbors of the input ID.
bool isNN(EcalID centroid, EcalID probe) const
Check if the probe id is one of the nearest neightbors of the centroid id.

◆ getShowerCentroidIdAndRms()

ldmx::EcalID ecal::EcalVetoProcessor::getShowerCentroidIdAndRms ( const std::vector< ldmx::EcalHit > & ecal_rec_hits,
float & shower_rms )
private

Definition at line 983 of file EcalVetoProcessor.cxx.

984 {
985 auto wgt_centroid_coords = std::make_pair<float, float>(0., 0.);
986 float sum_edep = 0;
987 ldmx::EcalID return_cell_id;
988
989 // Calculate Energy Weighted Centroid
990 for (const ldmx::EcalHit& hit : ecal_rec_hits) {
991 ldmx::EcalID id(hit.getID());
992 CellEnergyPair cell_energy_pair = std::make_pair(id, hit.getEnergy());
993 auto [rechit_x, rechit_y, rechit_z] = geometry_->getPosition(id);
994 XYCoords centroid_coords = std::make_pair(rechit_x, rechit_y);
995 wgt_centroid_coords.first = wgt_centroid_coords.first +
996 centroid_coords.first * cell_energy_pair.second;
997 wgt_centroid_coords.second =
998 wgt_centroid_coords.second +
999 centroid_coords.second * cell_energy_pair.second;
1000 sum_edep += cell_energy_pair.second;
1001 } // end loop over rec hits
1002 wgt_centroid_coords.first = (sum_edep > 1E-6)
1003 ? wgt_centroid_coords.first / sum_edep
1004 : wgt_centroid_coords.first;
1005 wgt_centroid_coords.second = (sum_edep > 1E-6)
1006 ? wgt_centroid_coords.second / sum_edep
1007 : wgt_centroid_coords.second;
1008 // Find Nearest Cell to Centroid
1009 float max_dist = 1e6;
1010 for (const ldmx::EcalHit& hit : ecal_rec_hits) {
1011 auto [rechit_x, rechit_y, rechit_z] = geometry_->getPosition(hit.getID());
1012 XYCoords centroid_coords = std::make_pair(rechit_x, rechit_y);
1013
1014 float delta_r =
1015 sqrt(((centroid_coords.first - wgt_centroid_coords.first) *
1016 (centroid_coords.first - wgt_centroid_coords.first)) +
1017 ((centroid_coords.second - wgt_centroid_coords.second) *
1018 (centroid_coords.second - wgt_centroid_coords.second)));
1019 shower_rms += delta_r * hit.getEnergy();
1020 if (delta_r < max_dist) {
1021 max_dist = delta_r;
1022 return_cell_id = ldmx::EcalID(hit.getID());
1023 }
1024 }
1025 if (sum_edep > 0) shower_rms = shower_rms / sum_edep;
1026 // flatten
1027 return ldmx::EcalID(0, return_cell_id.module(), return_cell_id.cell());
1028}
std::tuple< double, double, double > getPosition(EcalID id) const
Get a cell's position from its ID number.
int cell() const
Get the value of the cell field from the ID.
Definition EcalID.h:111
int module() const
Get the value of the module field from the ID.
Definition EcalID.h:87

◆ getTrajectory()

std::vector< std::pair< float, float > > ecal::EcalVetoProcessor::getTrajectory ( std::array< float, 3 > momentum,
std::array< float, 3 > position )
private

Definition at line 1085 of file EcalVetoProcessor.cxx.

1086 {
1087 std::vector<XYCoords> positions;
1088 for (int i_layer = 0; i_layer < n_ecal_layers_; i_layer++) {
1089 float pos_x =
1090 position[0] + (momentum[0] / momentum[2]) *
1091 (geometry_->getZPosition(i_layer) - position[2]);
1092 float pos_y =
1093 position[1] + (momentum[1] / momentum[2]) *
1094 (geometry_->getZPosition(i_layer) - position[2]);
1095 positions.push_back(std::make_pair(pos_x, pos_y));
1096 }
1097 return positions;
1098}
double getZPosition(int layer) const
Get the z-coordinate given the layer id.

◆ onNewRun()

void ecal::EcalVetoProcessor::onNewRun ( const ldmx::RunHeader & rh)
overridevirtual

onNewRun is the first function called for each processor after the conditions are fully configured and accessible.

This is where you could create single-processors, multi-event calculation objects.

Reimplemented from framework::EventProcessor.

Definition at line 5 of file EcalVetoProcessor.cxx.

5 {
6 profiling_map_["setup"] = 0.;
7 profiling_map_["recoil_electron"] = 0.;
8 profiling_map_["trajectories"] = 0.;
9 profiling_map_["roc_var"] = 0.;
10 profiling_map_["fill_hitmaps"] = 0.;
11 profiling_map_["containment_var"] = 0.;
12 profiling_map_["mip_tracking_setup"] = 0.;
13 profiling_map_["set_variables"] = 0.;
14 profiling_map_["bdt_variables"] = 0.;
15}

◆ onProcessEnd()

void ecal::EcalVetoProcessor::onProcessEnd ( )
overridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.

Reimplemented from framework::EventProcessor.

Definition at line 943 of file EcalVetoProcessor.cxx.

943 {
944 ldmx_log(info) << "AVG Time/Event: " << std::fixed << std::setprecision(2)
945 << processing_time_ / nevents_ << " ms";
946
947 ldmx_log(info) << "Breakdown::";
948
949 ldmx_log(info) << "setup Avg Time/Event = " << std::fixed
950 << std::setprecision(3) << profiling_map_["setup"] / nevents_
951 << " ms";
952
953 ldmx_log(info) << "recoil_electron Avg Time/Event = " << std::fixed
954 << std::setprecision(3)
955 << profiling_map_["recoil_electron"] / nevents_ << " ms";
956 ldmx_log(info) << "trajectories Avg Time/Event = " << std::fixed
957 << std::setprecision(3)
958 << profiling_map_["trajectories"] / nevents_ << " ms";
959
960 ldmx_log(info) << "roc_var Avg Time/Event = " << std::fixed
961 << std::setprecision(3) << profiling_map_["roc_var"] / nevents_
962 << " ms";
963
964 ldmx_log(info) << "fill_hitmaps Avg Time/Event = " << std::fixed
965 << std::setprecision(3)
966 << profiling_map_["fill_hitmaps"] / nevents_ << " ms";
967 ldmx_log(info) << "containment_var Avg Time/Event = " << std::fixed
968 << std::setprecision(3)
969 << profiling_map_["containment_var"] / nevents_ << " ms";
970 ldmx_log(info) << "mip_tracking_setup Avg Time/Event = " << std::fixed
971 << std::setprecision(3)
972 << profiling_map_["mip_tracking_setup"] / nevents_ << " ms";
973
974 ldmx_log(info) << "set_variables Avg Time/Event = " << std::fixed
975 << std::setprecision(3)
976 << profiling_map_["set_variables"] / nevents_ << " ms";
977
978 ldmx_log(info) << "bdt_variables Avg Time/Event = " << std::fixed
979 << std::setprecision(3)
980 << profiling_map_["bdt_variables"] / nevents_ << " ms";
981}

◆ produce()

void ecal::EcalVetoProcessor::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 173 of file EcalVetoProcessor.cxx.

173 {
174 auto start = std::chrono::high_resolution_clock::now();
175 nevents_++;
176
177 // Get the Ecal Geometry
179 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
180
182
183 clearProcessor();
184
185 // Get the collection of Ecal scoring plane hits_. If it doesn't exist,
186 // don't bother adding any truth tracking information.
187
188 std::array<float, 3> recoil_p = {0., 0., 0.};
189 std::array<float, 3> recoil_pos = {-9999., -9999., -9999.};
190 std::array<float, 3> recoil_p_at_target = {0., 0., 0.};
191 std::array<float, 3> recoil_pos_at_target = {-9999., -9999., -9999.};
192
193 auto setup = std::chrono::high_resolution_clock::now();
194 profiling_map_["setup"] +=
195 std::chrono::duration<float, std::milli>(setup - start).count();
196
197 if (!recoil_from_tracking_ &&
198 event.exists(ecal_sp_coll_name_, sp_pass_name_)) {
199 ldmx_log(trace) << " Loop through all of the sim particles and find the "
200 "recoil electron";
201 //
202 // Loop through all of the sim particles and find the recoil electron.
203 //
204
205 // Get the collection of simulated particles from the event
206 auto particle_map{event.getMap<int, ldmx::SimParticle>(
207 sim_particles_coll_name_, sim_particles_passname_)};
208
209 // Search for the recoil electron
210 auto [recoil_track_id, recoil_electron] = analysis::getRecoil(particle_map);
211
212 // Find ECAL SP hit for recoil electron
213 auto ecal_sp_hits{event.getCollection<ldmx::SimTrackerHit>(
214 ecal_sp_coll_name_, sp_pass_name_)};
215 float pmax = 0;
216 for (ldmx::SimTrackerHit& sp_hit : ecal_sp_hits) {
217 ldmx::SimSpecialID hit_id(sp_hit.getID());
218 auto ecal_sp_momentum = sp_hit.getMomentum();
219 auto ecal_sp_position = sp_hit.getPosition();
220 if (hit_id.plane() != 31 || ecal_sp_momentum[2] <= 0) continue;
221
222 if (sp_hit.getTrackID() == recoil_track_id) {
223 // A*A is faster than pow(A,2)
224 if (sqrt((ecal_sp_momentum[0] * ecal_sp_momentum[0]) +
225 (ecal_sp_momentum[1] * ecal_sp_momentum[1]) +
226 (ecal_sp_momentum[2] * ecal_sp_momentum[2])) > pmax) {
227 recoil_p = {static_cast<float>(ecal_sp_momentum[0]),
228 static_cast<float>(ecal_sp_momentum[1]),
229 static_cast<float>(ecal_sp_momentum[2])};
230 recoil_pos = {(ecal_sp_position[0]), (ecal_sp_position[1]),
231 (ecal_sp_position[2])};
232 pmax = sqrt(recoil_p[0] * recoil_p[0] + recoil_p[1] * recoil_p[1] +
233 recoil_p[2] * recoil_p[2]);
234 }
235 }
236 }
237
238 // Find target SP hit for recoil electron
239 if (event.exists(target_sp_coll_name_, sp_pass_name_)) {
240 std::vector<ldmx::SimTrackerHit> target_sp_hits =
241 event.getCollection<ldmx::SimTrackerHit>(target_sp_coll_name_,
242 sp_pass_name_);
243 pmax = 0;
244 for (ldmx::SimTrackerHit& sp_hit : target_sp_hits) {
245 ldmx::SimSpecialID hit_id(sp_hit.getID());
246 auto target_sp_momentum = sp_hit.getMomentum();
247 auto target_sp_position = sp_hit.getPosition();
248 if (hit_id.plane() != 1 || target_sp_momentum[2] <= 0) continue;
249
250 if (sp_hit.getTrackID() == recoil_track_id) {
251 if (sqrt((target_sp_momentum[0] * target_sp_momentum[0]) +
252 (target_sp_momentum[1] * target_sp_momentum[1]) +
253 (target_sp_momentum[2] * target_sp_momentum[2])) > pmax) {
254 recoil_p_at_target = {static_cast<float>(target_sp_momentum[0]),
255 static_cast<float>(target_sp_momentum[1]),
256 static_cast<float>(target_sp_momentum[2])};
257 recoil_pos_at_target = {target_sp_position[0],
258 target_sp_position[1],
259 target_sp_position[2]};
260 // (A*A) is faster than pow(A,2)
261 pmax = sqrt((recoil_p_at_target[0] * recoil_p_at_target[0]) +
262 (recoil_p_at_target[1] * recoil_p_at_target[1]) +
263 (recoil_p_at_target[2] * recoil_p_at_target[2]));
264 }
265 }
266 } // end loop on target SP hits_
267 } // end condition on target SP
268 } // end condition on ecal SP
269
270 // Get recoil_pos using recoil tracking
271 bool fiducial_in_tracker{false};
272 if (recoil_from_tracking_) {
273 ldmx_log(trace) << " Get recoil tracks collection";
274
275 // Get the recoil track collection
276 auto recoil_tracks{
277 event.getCollection<ldmx::Track>(track_collection_, track_pass_name_)};
278
279 ldmx_log(trace) << " Propagate the recoil ele to the ECAL";
280 ldmx::TrackStateType ts_type = ldmx::AtECAL;
281 auto recoil_track_states_ecal =
282 ecal::trackProp(recoil_tracks, ts_type, "ecal");
283 ldmx_log(trace) << " Propagate the recoil ele to the Target";
284 ldmx::TrackStateType ts_type_target = ldmx::AtTarget;
285 auto recoil_track_states_target =
286 ecal::trackProp(recoil_tracks, ts_type_target, "target");
287
288 ldmx_log(trace) << " Set recoil_pos and recoil_p";
289 // Redefining recoil_pos now to come from the track state
290 // track_state_loc0 is recoil_pos[0] and track_state_loc1 is recoil_pos[1]
291 if (!recoil_track_states_ecal.empty()) {
292 fiducial_in_tracker = true;
293 recoil_pos = {recoil_track_states_ecal[0], recoil_track_states_ecal[1],
294 recoil_track_states_ecal[2]};
295 recoil_p = {(recoil_track_states_ecal[3]), (recoil_track_states_ecal[4]),
296 (recoil_track_states_ecal[5])};
297 } else {
298 ldmx_log(trace) << " No recoil track at ECAL";
299 fiducial_in_tracker = false;
300 }
301 ldmx_log(debug) << " Set recoil_p = (" << recoil_p[0] << ", "
302 << recoil_p[1] << ", " << recoil_p[2]
303 << ") and recoil_pos = (" << recoil_pos[0] << ", "
304 << recoil_pos[1] << ", " << recoil_pos[2] << ")";
305
306 // Repeat the above but now for the taget states
307 if (!recoil_track_states_target.empty()) {
308 recoil_pos_at_target = {(recoil_track_states_target[0]),
309 (recoil_track_states_target[1]),
310 (recoil_track_states_target[2])};
311 recoil_p_at_target = {recoil_track_states_target[3],
312 recoil_track_states_target[4],
313 recoil_track_states_target[5]};
314 }
315 ldmx_log(debug) << " Set recoil_p_at_target = (" << recoil_p_at_target[0]
316 << ", " << recoil_p_at_target[1] << ", "
317 << recoil_p_at_target[2] << ") and recoil_pos_at_target = ("
318 << recoil_pos_at_target[0] << ", "
319 << recoil_pos_at_target[1] << ", "
320 << recoil_pos_at_target[2] << ")";
321 } // condition to do recoil information from tracking
322
323 ldmx_log(trace) << " Get projected trajectories for electron and photon";
324
325 auto recoil_electron = std::chrono::high_resolution_clock::now();
326 profiling_map_["recoil_electron"] +=
327 std::chrono::duration<float, std::milli>(recoil_electron - setup).count();
328
329 // Get projected trajectories for electron and photon
330 std::vector<XYCoords> ele_trajectory, photon_trajectory,
331 ele_trajectory_at_target;
332 // Require that z_-momentum is positive (which will also exclude the default
333 // initializaton) Require that the positions are not the default initializaton
334 if ((recoil_p[2] > 0.) && (recoil_p_at_target[2] > 0.) &&
335 (recoil_pos[0] != -9999.) && (recoil_pos_at_target[0] != -9999.)) {
336 ele_trajectory = getTrajectory(recoil_p, recoil_pos);
337 ele_trajectory_at_target =
338 getTrajectory(recoil_p_at_target, recoil_pos_at_target);
339 // Get the photon projection. This does not require that the photon exists
340 // tho
341 std::array<float, 3> photon_proj_momentum = {
342 -recoil_p_at_target[0], -recoil_p_at_target[1],
343 beam_energy_mev_ - recoil_p_at_target[2]};
344 photon_trajectory =
345 getTrajectory(photon_proj_momentum, recoil_pos_at_target);
346 } else {
347 ldmx_log(trace) << "Ele / photon trajectory cannot be determined, pZ = "
348 << recoil_p[2] << " pZAtTarget = " << recoil_p_at_target[2]
349 << " X = " << recoil_pos[0]
350 << " XAtTarget = " << recoil_pos_at_target[0];
351 }
352
353 float recoil_p_mag = (recoil_p[2] > 0.) ? sqrt((recoil_p[0] * recoil_p[0]) +
354 (recoil_p[1] * recoil_p[1]) +
355 (recoil_p[2] * recoil_p[2]))
356 : -1.0;
357 float recoil_theta =
358 recoil_p_mag > 0 ? acos(recoil_p[2] / recoil_p_mag) * 180.0 / M_PI : -1.0;
359
360 ldmx_log(trace) << " Build Radii of containment (ROC)";
361
362 auto trajectories = std::chrono::high_resolution_clock::now();
363 profiling_map_["trajectories"] +=
364 std::chrono::duration<float, std::milli>(trajectories - recoil_electron)
365 .count();
366
367 // Use the appropriate containment radii for the recoil electron
368 std::vector<float> roc_values_bin_0(roc_range_values_[0].begin() + 4,
369 roc_range_values_[0].end());
370 std::vector<float> ele_radii = roc_values_bin_0;
371 float theta_min, theta_max, p_min, p_max;
372 bool inrange;
373
374 for (int i = 0; i < roc_range_values_.size(); i++) {
375 theta_min = roc_range_values_[i][0];
376 theta_max = roc_range_values_[i][1];
377 p_min = roc_range_values_[i][2];
378 p_max = roc_range_values_[i][3];
379 inrange = true;
380
381 if (theta_min != -1.0) {
382 inrange = inrange && (recoil_theta >= theta_min);
383 }
384 if (theta_max != -1.0) {
385 inrange = inrange && (recoil_theta < theta_max);
386 }
387 if (p_min != -1.0) {
388 inrange = inrange && (recoil_p_mag >= p_min);
389 }
390 if (p_max != -1.0) {
391 inrange = inrange && (recoil_p_mag < p_max);
392 }
393 if (inrange) {
394 std::vector<float> roc_values_bini(roc_range_values_[i].begin() + 4,
395 roc_range_values_[i].end());
396 ele_radii = roc_values_bini;
397 }
398 }
399 // Use default RoC bin for photon
400 std::vector<float> photon_radii = roc_values_bin_0;
401
402 auto roc_var = std::chrono::high_resolution_clock::now();
403 profiling_map_["roc_var"] +=
404 std::chrono::duration<float, std::milli>(roc_var - trajectories).count();
405
406 // Get the collection of digitized Ecal hits_ from the event.
407 const std::vector<ldmx::EcalHit> ecal_rec_hits =
408 event.getCollection<ldmx::EcalHit>(rec_coll_name_, rec_pass_name_);
409
410 ldmx::EcalID global_centroid =
411 getShowerCentroidIdAndRms(ecal_rec_hits, shower_rms_);
412 /* ~~ Fill the hit map ~~ O(n) */
413 fillHitMap(ecal_rec_hits, cell_map_);
414 bool do_tight = true;
415 /* ~~ Fill the isolated hit maps ~~ O(n) */
416 fillIsolatedHitMap(ecal_rec_hits, global_centroid, cell_map_,
417 cell_map_tight_iso_, do_tight);
418
419 auto fill_hitmaps = std::chrono::high_resolution_clock::now();
420 profiling_map_["fill_hitmaps"] +=
421 std::chrono::duration<float, std::milli>(fill_hitmaps - roc_var).count();
422
423 // Loop over the hits_ from the event to calculate the rest of the important
424 // quantities
425
426 float w_avg_layer_hit = 0;
427 float x_mean = 0;
428 float y_mean = 0;
429
430 // Containment variables
431 unsigned int n_regions = 5;
432 std::vector<float> electron_containment_energy(n_regions, 0.0);
433 std::vector<float> photon_containment_energy(n_regions, 0.0);
434 std::vector<float> outside_containment_energy(n_regions, 0.0);
435 std::vector<int> outside_containment_n_hits(n_regions, 0);
436 std::vector<float> outside_containment_x_mean(n_regions, 0.0);
437 std::vector<float> outside_containment_y_mean(n_regions, 0.0);
438 std::vector<float> outside_containment_x_std(n_regions, 0.0);
439 std::vector<float> outside_containment_y_std(n_regions, 0.0);
440 // Longitudinal segmentation
441 std::vector<int> seg_layers = {0, 6, 17, 32};
442 unsigned int n_segments = seg_layers.size() - 1;
443 std::vector<float> energy_seg(n_segments, 0.0);
444 std::vector<float> x_mean_seg(n_segments, 0.0);
445 std::vector<float> x_std_seg(n_segments, 0.0);
446 std::vector<float> y_mean_seg(n_segments, 0.0);
447 std::vector<float> y_std_seg(n_segments, 0.0);
448 std::vector<float> layer_mean_seg(n_segments, 0.0);
449 std::vector<float> layer_std_seg(n_segments, 0.0);
450 std::vector<std::vector<float>> e_cont_energy(
451 n_regions, std::vector<float>(n_segments, 0.0));
452 std::vector<std::vector<float>> e_cont_x_mean(
453 n_regions, std::vector<float>(n_segments, 0.0));
454 std::vector<std::vector<float>> e_cont_y_mean(
455 n_regions, std::vector<float>(n_segments, 0.0));
456 std::vector<std::vector<float>> g_cont_energy(
457 n_regions, std::vector<float>(n_segments, 0.0));
458 std::vector<std::vector<int>> g_cont_n_hits(n_regions,
459 std::vector<int>(n_segments, 0));
460 std::vector<std::vector<float>> g_cont_x_mean(
461 n_regions, std::vector<float>(n_segments, 0.0));
462 std::vector<std::vector<float>> g_cont_y_mean(
463 n_regions, std::vector<float>(n_segments, 0.0));
464 std::vector<std::vector<float>> o_cont_energy(
465 n_regions, std::vector<float>(n_segments, 0.0));
466 std::vector<std::vector<int>> o_cont_n_hits(n_regions,
467 std::vector<int>(n_segments, 0));
468 std::vector<std::vector<float>> o_cont_x_mean(
469 n_regions, std::vector<float>(n_segments, 0.0));
470 std::vector<std::vector<float>> o_cont_y_mean(
471 n_regions, std::vector<float>(n_segments, 0.0));
472 std::vector<std::vector<float>> o_cont_x_std(
473 n_regions, std::vector<float>(n_segments, 0.0));
474 std::vector<std::vector<float>> o_cont_y_std(
475 n_regions, std::vector<float>(n_segments, 0.0));
476 std::vector<std::vector<float>> o_cont_layer_mean(
477 n_regions, std::vector<float>(n_segments, 0.0));
478 std::vector<std::vector<float>> o_cont_layer_std(
479 n_regions, std::vector<float>(n_segments, 0.0));
480
481 auto containment_var = std::chrono::high_resolution_clock::now();
482 profiling_map_["containment_var"] +=
483 std::chrono::duration<float, std::milli>(containment_var - fill_hitmaps)
484 .count();
485
486 // MIP tracking: vector of hits_ to be used in the MIP tracking algorithm.
487 // All hits_ inside the electron ROC (or all hits_ in the ECal if the event is
488 // missing an electron) will be included.
489 std::vector<ldmx::HitData> tracking_hit_list;
490
491 ldmx_log(trace)
492 << " Loop over the hits_ from the event to calculate the BDT features";
493
494 for (const ldmx::EcalHit& hit : ecal_rec_hits) {
495 // Layer-wise quantities
496 ldmx::EcalID id(hit.getID());
497 ecal_layer_edep_raw_[id.layer()] =
498 ecal_layer_edep_raw_[id.layer()] + hit.getEnergy();
499 if (id.layer() >= 20) ecal_back_energy_ += hit.getEnergy();
500 if (max_cell_dep_ < hit.getEnergy()) max_cell_dep_ = hit.getEnergy();
501 if (hit.getEnergy() <= 0) {
502 ldmx_log(fatal)
503 << "ECal hit has negative or zero energy, this should never happen, "
504 "check the threshold settings in HgcrocEmulator";
505 continue;
506 }
507 n_readout_hits_++;
508 ecal_layer_edep_readout_[id.layer()] += hit.getEnergy();
509 ecal_layer_time_[id.layer()] += (hit.getEnergy()) * hit.getTime();
510 auto [rechit_x, rechit_y, rechit_z] = geometry_->getPosition(id);
511 x_mean += rechit_x * hit.getEnergy();
512 y_mean += rechit_y * hit.getEnergy();
513 avg_layer_hit_ += id.layer();
514 w_avg_layer_hit += id.layer() * hit.getEnergy();
515 if (deepest_layer_hit_ < id.layer()) {
516 deepest_layer_hit_ = id.layer();
517 }
518 XYCoords xy_pair = std::make_pair(rechit_x, rechit_y);
519 float distance_ele_trajectory =
520 ele_trajectory.size()
521 ? sqrt((xy_pair.first - ele_trajectory[id.layer()].first) *
522 (xy_pair.first - ele_trajectory[id.layer()].first) +
523 (xy_pair.second - ele_trajectory[id.layer()].second) *
524 (xy_pair.second - ele_trajectory[id.layer()].second))
525 : -1.0;
526 float distance_photon_trajectory =
527 photon_trajectory.size()
528 ? sqrt((xy_pair.first - photon_trajectory[id.layer()].first) *
529 (xy_pair.first - photon_trajectory[id.layer()].first) +
530 (xy_pair.second - photon_trajectory[id.layer()].second) *
531 (xy_pair.second - photon_trajectory[id.layer()].second))
532 : -1.0;
533
534 // Decide which longitudinal segment the hit is in and add to sums
535 for (unsigned int iseg = 0; iseg < n_segments; iseg++) {
536 if (id.layer() >= seg_layers[iseg] &&
537 id.layer() <= seg_layers[iseg + 1] - 1) {
538 energy_seg[iseg] += hit.getEnergy();
539 x_mean_seg[iseg] += xy_pair.first * hit.getEnergy();
540 y_mean_seg[iseg] += xy_pair.second * hit.getEnergy();
541 layer_mean_seg[iseg] += id.layer() * hit.getEnergy();
542
543 // Decide which containment region the hit is in and add to sums
544 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
545 if (distance_ele_trajectory >= ireg * ele_radii[id.layer()] &&
546 distance_ele_trajectory < (ireg + 1) * ele_radii[id.layer()]) {
547 e_cont_energy[ireg][iseg] += hit.getEnergy();
548 e_cont_x_mean[ireg][iseg] += xy_pair.first * hit.getEnergy();
549 e_cont_y_mean[ireg][iseg] += xy_pair.second * hit.getEnergy();
550 }
551 if (distance_photon_trajectory >= ireg * photon_radii[id.layer()] &&
552 distance_photon_trajectory <
553 (ireg + 1) * photon_radii[id.layer()]) {
554 g_cont_energy[ireg][iseg] += hit.getEnergy();
555 g_cont_n_hits[ireg][iseg] += 1;
556 g_cont_x_mean[ireg][iseg] += xy_pair.first * hit.getEnergy();
557 g_cont_y_mean[ireg][iseg] += xy_pair.second * hit.getEnergy();
558 }
559 if (distance_ele_trajectory > (ireg + 1) * ele_radii[id.layer()] &&
560 distance_photon_trajectory >
561 (ireg + 1) * photon_radii[id.layer()]) {
562 o_cont_energy[ireg][iseg] += hit.getEnergy();
563 o_cont_n_hits[ireg][iseg] += 1;
564 o_cont_x_mean[ireg][iseg] += xy_pair.first * hit.getEnergy();
565 o_cont_y_mean[ireg][iseg] += xy_pair.second * hit.getEnergy();
566 o_cont_layer_mean[ireg][iseg] += id.layer() * hit.getEnergy();
567 }
568 }
569 }
570 }
571
572 // Decide which containment region the hit is in and add to sums
573 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
574 if (distance_ele_trajectory >= ireg * ele_radii[id.layer()] &&
575 distance_ele_trajectory < (ireg + 1) * ele_radii[id.layer()])
576 electron_containment_energy[ireg] += hit.getEnergy();
577 if (distance_photon_trajectory >= ireg * photon_radii[id.layer()] &&
578 distance_photon_trajectory < (ireg + 1) * photon_radii[id.layer()])
579 photon_containment_energy[ireg] += hit.getEnergy();
580 if (distance_ele_trajectory > (ireg + 1) * ele_radii[id.layer()] &&
581 distance_photon_trajectory > (ireg + 1) * photon_radii[id.layer()]) {
582 outside_containment_energy[ireg] += hit.getEnergy();
583 outside_containment_n_hits[ireg] += 1;
584 outside_containment_x_mean[ireg] += xy_pair.first * hit.getEnergy();
585 outside_containment_y_mean[ireg] += xy_pair.second * hit.getEnergy();
586 }
587 }
588
589 // MIP tracking: Decide whether hit should be added to tracking_hit_list
590 // If inside e- RoC or if etraj is missing, use the hit for tracking:
591 if (distance_ele_trajectory >= ele_radii[id.layer()] ||
592 distance_ele_trajectory == -1.0) {
593 ldmx::HitData hd;
594 hd.pos_ = ROOT::Math::XYZVector(xy_pair.first, xy_pair.second,
595 geometry_->getZPosition(id.layer()));
596 hd.layer_ = id.layer();
597 tracking_hit_list.push_back(hd);
598 }
599 } // end loop over rechits
600
601 n_tracking_hits_ = tracking_hit_list.size();
602
603 for (const auto& [id, energy] : cell_map_tight_iso_) {
604 if (energy > 0) summed_tight_iso_ += energy;
605 }
606
607 for (int i_layer = 0; i_layer < ecal_layer_edep_readout_.size(); i_layer++) {
608 ecal_layer_time_[i_layer] =
609 ecal_layer_time_[i_layer] / ecal_layer_edep_readout_[i_layer];
610 summed_det_ += ecal_layer_edep_readout_[i_layer];
611 }
612
613 if (n_readout_hits_ > 0) {
614 avg_layer_hit_ /= n_readout_hits_;
615 w_avg_layer_hit /= summed_det_;
616 x_mean /= summed_det_;
617 y_mean /= summed_det_;
618 } else {
619 w_avg_layer_hit = 0;
620 avg_layer_hit_ = 0;
621 x_mean = 0;
622 y_mean = 0;
623 }
624
625 // If necessary, quotient out the total energy from the means
626 for (unsigned int iseg = 0; iseg < n_segments; iseg++) {
627 if (energy_seg[iseg] > 0) {
628 x_mean_seg[iseg] /= energy_seg[iseg];
629 y_mean_seg[iseg] /= energy_seg[iseg];
630 layer_mean_seg[iseg] /= energy_seg[iseg];
631 }
632 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
633 if (e_cont_energy[ireg][iseg] > 0) {
634 e_cont_x_mean[ireg][iseg] /= e_cont_energy[ireg][iseg];
635 e_cont_y_mean[ireg][iseg] /= e_cont_energy[ireg][iseg];
636 }
637 if (g_cont_energy[ireg][iseg] > 0) {
638 g_cont_x_mean[ireg][iseg] /= g_cont_energy[ireg][iseg];
639 g_cont_y_mean[ireg][iseg] /= g_cont_energy[ireg][iseg];
640 }
641 if (o_cont_energy[ireg][iseg] > 0) {
642 o_cont_x_mean[ireg][iseg] /= o_cont_energy[ireg][iseg];
643 o_cont_y_mean[ireg][iseg] /= o_cont_energy[ireg][iseg];
644 o_cont_layer_mean[ireg][iseg] /= o_cont_energy[ireg][iseg];
645 }
646 }
647 }
648
649 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
650 if (outside_containment_energy[ireg] > 0) {
651 outside_containment_x_mean[ireg] /= outside_containment_energy[ireg];
652 outside_containment_y_mean[ireg] /= outside_containment_energy[ireg];
653 }
654 }
655
656 // Loop over hits_ a second time to find the standard deviations.
657 for (const ldmx::EcalHit& hit : ecal_rec_hits) {
658 ldmx::EcalID id(hit.getID());
659 auto [rechit_x, rechit_y, rechit_z] = geometry_->getPosition(id);
660 if (hit.getEnergy() > 0) {
661 x_std_ += pow((rechit_x - x_mean), 2) * hit.getEnergy();
662 y_std_ += pow((rechit_y - y_mean), 2) * hit.getEnergy();
663 std_layer_hit_ +=
664 pow((id.layer() - w_avg_layer_hit), 2) * hit.getEnergy();
665 }
666 XYCoords xy_pair = std::make_pair(rechit_x, rechit_y);
667 float distance_ele_trajectory =
668 ele_trajectory.size()
669 ? sqrt(pow((xy_pair.first - ele_trajectory[id.layer()].first), 2) +
670 pow((xy_pair.second - ele_trajectory[id.layer()].second), 2))
671 : -1.0;
672 float distance_photon_trajectory =
673 photon_trajectory.size()
674 ? sqrt(pow((xy_pair.first - photon_trajectory[id.layer()].first),
675 2) +
676 pow((xy_pair.second - photon_trajectory[id.layer()].second),
677 2))
678 : -1.0;
679
680 for (unsigned int iseg = 0; iseg < n_segments; iseg++) {
681 if (id.layer() >= seg_layers[iseg] &&
682 id.layer() <= seg_layers[iseg + 1] - 1) {
683 x_std_seg[iseg] +=
684 pow((xy_pair.first - x_mean_seg[iseg]), 2) * hit.getEnergy();
685 y_std_seg[iseg] +=
686 pow((xy_pair.second - y_mean_seg[iseg]), 2) * hit.getEnergy();
687 layer_std_seg[iseg] +=
688 pow((id.layer() - layer_mean_seg[iseg]), 2) * hit.getEnergy();
689
690 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
691 if (distance_ele_trajectory > (ireg + 1) * ele_radii[id.layer()] &&
692 distance_photon_trajectory >
693 (ireg + 1) * photon_radii[id.layer()]) {
694 o_cont_x_std[ireg][iseg] +=
695 pow((xy_pair.first - o_cont_x_mean[ireg][iseg]), 2) *
696 hit.getEnergy();
697 o_cont_y_std[ireg][iseg] +=
698 pow((xy_pair.second - o_cont_y_mean[ireg][iseg]), 2) *
699 hit.getEnergy();
700 o_cont_layer_std[ireg][iseg] +=
701 pow((id.layer() - o_cont_layer_mean[ireg][iseg]), 2) *
702 hit.getEnergy();
703 }
704 }
705 }
706 }
707
708 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
709 if (distance_ele_trajectory > (ireg + 1) * ele_radii[id.layer()] &&
710 distance_photon_trajectory > (ireg + 1) * photon_radii[id.layer()]) {
711 outside_containment_x_std[ireg] +=
712 pow((xy_pair.first - outside_containment_x_mean[ireg]), 2) *
713 hit.getEnergy();
714 outside_containment_y_std[ireg] +=
715 pow((xy_pair.second - outside_containment_y_mean[ireg]), 2) *
716 hit.getEnergy();
717 }
718 }
719 } // end loop over rechits (2nd time)
720
721 if (n_readout_hits_ > 0) {
722 x_std_ = sqrt(x_std_ / summed_det_);
723 y_std_ = sqrt(y_std_ / summed_det_);
724 std_layer_hit_ = sqrt(std_layer_hit_ / summed_det_);
725 } else {
726 x_std_ = 0;
727 y_std_ = 0;
728 std_layer_hit_ = 0;
729 }
730
731 // Quotient out the total energies from the standard deviations if possible
732 // and take root
733 for (unsigned int iseg = 0; iseg < n_segments; iseg++) {
734 if (energy_seg[iseg] > 0) {
735 x_std_seg[iseg] = sqrt(x_std_seg[iseg] / energy_seg[iseg]);
736 y_std_seg[iseg] = sqrt(y_std_seg[iseg] / energy_seg[iseg]);
737 layer_std_seg[iseg] = sqrt(layer_std_seg[iseg] / energy_seg[iseg]);
738 }
739 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
740 if (o_cont_energy[ireg][iseg] > 0) {
741 o_cont_x_std[ireg][iseg] =
742 sqrt(o_cont_x_std[ireg][iseg] / o_cont_energy[ireg][iseg]);
743 o_cont_y_std[ireg][iseg] =
744 sqrt(o_cont_y_std[ireg][iseg] / o_cont_energy[ireg][iseg]);
745 o_cont_layer_std[ireg][iseg] =
746 sqrt(o_cont_layer_std[ireg][iseg] / o_cont_energy[ireg][iseg]);
747 }
748 }
749 }
750
751 for (unsigned int ireg = 0; ireg < n_regions; ireg++) {
752 if (outside_containment_energy[ireg] > 0) {
753 outside_containment_x_std[ireg] = sqrt(outside_containment_x_std[ireg] /
754 outside_containment_energy[ireg]);
755 outside_containment_y_std[ireg] = sqrt(outside_containment_y_std[ireg] /
756 outside_containment_energy[ireg]);
757 }
758 }
759
760 ldmx_log(trace) << " Find out if the recoil electron is fiducial";
761
762 // Find the location of the recoil electron
763 // Ecal face is not where the first layer_ starts,
764 // defined in DetDescr/python/EcalGeometry.py
765 const float dz_from_face =
767 float drifted_recoil_x{-9999.};
768 float drifted_recoil_y{-9999.};
769 if (recoil_p[2] > 0.) {
770 ldmx_log(trace) << " Recoil electron pX = " << recoil_p[0]
771 << " pY = " << recoil_p[1] << " pZ = " << recoil_p[2];
772 ldmx_log(trace) << " Recoil electron PosX = " << recoil_pos[0]
773 << " PosY = " << recoil_pos[1]
774 << " PosZ = " << recoil_pos[2];
775 drifted_recoil_x =
776 (dz_from_face * (recoil_p[0] / recoil_p[2])) + recoil_pos[0];
777 drifted_recoil_y =
778 (dz_from_face * (recoil_p[1] / recoil_p[2])) + recoil_pos[1];
779 }
780 const int recoil_layer_index = 0;
781
782 // Check if it's fiducial
783 bool inside_ecal_cell{false};
784 // At module_ level
785 const auto ecal_id = geometry_->getID(drifted_recoil_x, drifted_recoil_y,
786 recoil_layer_index, true);
787 if (!ecal_id.null()) {
788 // If fiducial at module_ level, check at cell level
789 const auto cell_id =
790 geometry_->getID(drifted_recoil_x, drifted_recoil_y, recoil_layer_index,
791 ecal_id.getModuleID(), true);
792 if (!cell_id.null()) {
793 inside_ecal_cell = true;
794 }
795 }
796
797 ldmx_log(info) << " Is this event is fiducial in ECAL? "
798 << inside_ecal_cell;
799 ROOT::Math::XYZVector e_traj_start;
800 ROOT::Math::XYZVector e_traj_end;
801 ROOT::Math::XYZVector e_traj_target_start;
802 ROOT::Math::XYZVector e_traj_target_end;
803 ROOT::Math::XYZVector p_traj_start;
804 ROOT::Math::XYZVector p_traj_end;
805 if (!ele_trajectory.empty() && !photon_trajectory.empty()) {
806 // Create TVector3s marking the start and endpoints of each projected
807 // trajectory
808 e_traj_start.SetXYZ(ele_trajectory[0].first, ele_trajectory[0].second,
810 e_traj_end.SetXYZ(ele_trajectory[(n_ecal_layers_ - 1)].first,
811 ele_trajectory[(n_ecal_layers_ - 1)].second,
812 geometry_->getZPosition((n_ecal_layers_ - 1)));
813 p_traj_start.SetXYZ(photon_trajectory[0].first, photon_trajectory[0].second,
815 p_traj_end.SetXYZ(photon_trajectory[(n_ecal_layers_ - 1)].first,
816 photon_trajectory[(n_ecal_layers_ - 1)].second,
817 geometry_->getZPosition((n_ecal_layers_ - 1)));
818
819 ROOT::Math::XYZVector evec = e_traj_end - e_traj_start;
820 ROOT::Math::XYZVector e_norm = evec.Unit();
821 ROOT::Math::XYZVector pvec = p_traj_end - p_traj_start;
822 ROOT::Math::XYZVector p_norm = pvec.Unit();
823
824 // Calculate the angle between the projected electron at Ecal and the photon
825 // (at target)
826 ep_dot_ = e_norm.Dot(p_norm);
827 ep_ang_ = acos(ep_dot_) * 180.0 / M_PI;
828 ep_sep_ = sqrt(pow(e_traj_start.X() - p_traj_start.X(), 2) +
829 pow(e_traj_start.Y() - p_traj_start.Y(), 2));
830 // Calculate the electron trajectory with positions and momentum as measured
831 // at the target
832 if (!ele_trajectory_at_target.empty()) {
833 e_traj_target_start.SetXYZ(recoil_pos_at_target[0],
834 recoil_pos_at_target[1],
835 static_cast<float>(0.0));
836 e_traj_target_end.SetXYZ(ele_trajectory_at_target[(0)].first,
837 ele_trajectory_at_target[(0)].second,
839 // Now calculate the ep angle at the target
840 ROOT::Math::XYZVector evec_target =
841 e_traj_target_end - e_traj_target_start;
842 ROOT::Math::XYZVector e_norm_target = evec_target.Unit();
843 ep_dot_at_target_ = e_norm_target.Dot(p_norm);
844 ep_ang_at_target_ = acos(ep_dot_at_target_) * 180.0 / M_PI;
845 }
846 ldmx_log(trace) << " Electron trajectory calculated";
847 } else {
848 // Electron trajectory is missing, so all hits_ in the Ecal are fair game.
849 // Pick e/ptraj so that they won't restrict the tracking algorithm (place
850 // them far outside the ECal).
851 ldmx_log(trace) << " Electron trajectory is missing";
852 e_traj_start = ROOT::Math::XYZVector(999, 999, geometry_->getZPosition(0));
853 e_traj_end = ROOT::Math::XYZVector(
854 999, 999, geometry_->getZPosition((n_ecal_layers_ - 1)));
855 p_traj_start =
856 ROOT::Math::XYZVector(1000, 1000, geometry_->getZPosition(0));
857 p_traj_end = ROOT::Math::XYZVector(
858 1000, 1000, geometry_->getZPosition((n_ecal_layers_ - 1)));
859 /*ensures event will not be vetoed by angle/separation cut */
860 ep_ang_ = 999.;
861 ep_ang_at_target_ = 999.;
862 ep_sep_ = 999.;
863 ep_dot_ = 999.;
864 ep_dot_at_target_ = 999.;
865 }
866 // Took out MIP tracking here (starting at near photon hits_)
867 ldmx::EcalTrajectoryInfo ecal_mip_collection;
868 ldmx_log(trace) << " Set up input info for MIP tracking";
869 ecal_mip_collection.setEleTrajectory(ele_trajectory);
870 ecal_mip_collection.setPhotonTrajectory(photon_trajectory);
871 ecal_mip_collection.setTrackingHitList(tracking_hit_list);
872 event.add("EcalTrajectoryInfo", ecal_mip_collection);
873
874 auto mip_tracking_setup = std::chrono::high_resolution_clock::now();
875 profiling_map_["mip_tracking_setup"] +=
876 std::chrono::duration<double, std::milli>(mip_tracking_setup - start)
877 .count();
878 result.setVariables(
879 n_readout_hits_, deepest_layer_hit_, n_tracking_hits_, summed_det_,
880 summed_tight_iso_, max_cell_dep_, shower_rms_, x_std_, y_std_,
881 avg_layer_hit_, std_layer_hit_, ecal_back_energy_, ep_ang_,
883 electron_containment_energy, photon_containment_energy,
884 outside_containment_energy, outside_containment_n_hits,
885 outside_containment_x_std, outside_containment_y_std, energy_seg,
886 x_mean_seg, y_mean_seg, x_std_seg, y_std_seg, layer_mean_seg,
887 layer_std_seg, e_cont_energy, e_cont_x_mean, e_cont_y_mean, g_cont_energy,
888 g_cont_n_hits, g_cont_x_mean, g_cont_y_mean, o_cont_energy, o_cont_n_hits,
889 o_cont_x_mean, o_cont_y_mean, o_cont_x_std, o_cont_y_std,
890 o_cont_layer_mean, o_cont_layer_std, ecal_layer_edep_readout_, recoil_p,
891 recoil_pos);
892
893 auto set_variables = std::chrono::high_resolution_clock::now();
894 profiling_map_["set_variables"] += std::chrono::duration<double, std::milli>(
895 set_variables - mip_tracking_setup)
896 .count();
897 buildBDTFeatureVector(result);
898 ldmx::ort::FloatArrays inputs({bdt_features_});
899 float pred =
900 rt_->run({feature_list_name_}, inputs, {"probabilities"})[0].at(1);
901 ldmx_log(info) << " BDT was ran, score is " << pred;
902 // Other considerations were (n_linreg_tracks_ == 0) && (first_near_ph_layer_
903 // >= 6)
904 // && (ep_ang_ > 3.0 && ep_ang_ < 900 || ep_sep_ > 10.0 && ep_sep_ < 900)
905 result.setVetoResult(pred > bdt_cut_val_);
906 result.setDiscValue(pred);
907 ldmx_log(info) << " The pred > bdtCutVal = " << (pred > bdt_cut_val_);
908
909 // Persist in the event if the recoil ele is fiducial
910 result.setFiducial(inside_ecal_cell);
911 result.setTrackingFiducial(fiducial_in_tracker);
912
913 // If the event passes the veto, keep it. Otherwise,
914 // drop the event.
915 if (!inverse_skim_) {
916 if (result.passesVeto()) {
918 } else {
920 }
921 } else {
922 // Invert the skimming logic
923 if (result.passesVeto()) {
925 } else {
927 }
928 }
929
930 event.add(collection_name_, result);
931
932 auto bdt_variables = std::chrono::high_resolution_clock::now();
933 profiling_map_["bdt_variables"] +=
934 std::chrono::duration<float, std::milli>(bdt_variables - set_variables)
935 .count();
936
937 auto end = std::chrono::high_resolution_clock::now();
938 auto time_diff = end - start;
939 processing_time_ +=
940 std::chrono::duration<float, std::milli>(time_diff).count();
941}
std::tuple< int, const ldmx::SimParticle * > getRecoil(const std::map< int, ldmx::SimParticle > &particleMap)
Find and return the sim particle associated with the recoil electron.
std::vector< float > trackProp(const ldmx::Tracks &tracks, ldmx::TrackStateType ts_type, const std::string &ts_title)
Return a vector of parameters for a propagated recoil track.
Definition EcalHelper.cxx:5
void fillHitMap(const std::vector< ldmx::EcalHit > &ecal_rec_hits, std::map< ldmx::EcalID, float > &cell_map_)
Function to load up empty vector of hit maps.
void buildBDTFeatureVector(const ldmx::EcalVetoResult &result)
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module_.
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
EcalID getID(double x, double y, double z, bool fallible=false) const
Get a cell's ID number from its position.
double getEcalFrontZ() const
Get the z-coordinate of the Ecal face.
bool passesVeto() const
Checks if the event passes the Ecal veto.
void setVariables(int n_readout_hits, int deepest_layer_hit, int n_tracking_hits, float summed_det, float summed_tight_iso, float max_cell_dep, float shower_rms, float x_std, float y_std, float avg_layer_hit, float std_layer_hit, float ecal_back_energy, float ep_ang, float ep_ang_at_target, float ep_sep, float ep_dot, float ep_dot_at_target, std::vector< float > electron_containment_energy, std::vector< float > photon_containment_energy, std::vector< float > outside_containment_energy, std::vector< int > outside_containment_n_hits, std::vector< float > outside_containment_x_std, std::vector< float > outside_containment_y_std, std::vector< float > energy_seg, std::vector< float > x_mean_seg, std::vector< float > y_mean_seg, std::vector< float > x_std_seg, std::vector< float > y_std_seg, std::vector< float > layer_mean_seg, std::vector< float > layer_std_seg, std::vector< std::vector< float > > e_cont_energy, std::vector< std::vector< float > > e_cont_x_mean, std::vector< std::vector< float > > e_cont_y_mean, std::vector< std::vector< float > > g_cont_energy, std::vector< std::vector< int > > g_cont_n_hits, std::vector< std::vector< float > > g_cont_x_mean, std::vector< std::vector< float > > g_cont_y_mean, std::vector< std::vector< float > > o_cont_energy, std::vector< std::vector< int > > o_cont_n_hits, std::vector< std::vector< float > > o_cont_x_mean, std::vector< std::vector< float > > o_cont_y_mean, std::vector< std::vector< float > > o_cont_x_std, std::vector< std::vector< float > > o_cont_y_std, std::vector< std::vector< float > > o_cont_layer_mean, std::vector< std::vector< float > > o_cont_layer_std, std::vector< float > ecal_layer_edep_readout, std::array< float, 3 > recoil_p, std::array< float, 3 > recoil_pos)
Set the sim particle and 'is findable' flag.
Class representing a simulated particle.
Definition SimParticle.h:24
Implements detector ids for special simulation-derived hits like scoring planes.
Represents a simulated tracker hit in the simulation.
Implementation of a track object.
Definition Track.h:53
constexpr StorageControl::Hint HINT_SHOULD_DROP
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint HINT_SHOULD_KEEP
storage control hint alias for backwards compatibility

References buildBDTFeatureVector(), collection_name_, ep_ang_, ep_ang_at_target_, ep_dot_, ep_dot_at_target_, ep_sep_, framework::Event::exists(), fillHitMap(), geometry_, framework::EventProcessor::getCondition(), ldmx::EcalGeometry::getEcalFrontZ(), ldmx::EcalGeometry::getID(), ldmx::EcalGeometry::getPosition(), ldmx::EcalGeometry::getZPosition(), framework::HINT_SHOULD_DROP, framework::HINT_SHOULD_KEEP, n_tracking_hits_, ldmx::EcalVetoResult::passesVeto(), ldmx::SimSpecialID::plane(), framework::EventProcessor::setStorageHint(), ldmx::EcalVetoResult::setVariables(), and ecal::trackProp().

Member Data Documentation

◆ avg_layer_hit_

float ecal::EcalVetoProcessor::avg_layer_hit_ {0}
private

Definition at line 125 of file EcalVetoProcessor.h.

125{0};

◆ bdt_cut_val_

float ecal::EcalVetoProcessor::bdt_cut_val_ {0}
private

Definition at line 146 of file EcalVetoProcessor.h.

146{0};

◆ bdt_feature_config_

std::string ecal::EcalVetoProcessor::bdt_feature_config_
private

Definition at line 151 of file EcalVetoProcessor.h.

◆ bdt_features_

std::vector<float> ecal::EcalVetoProcessor::bdt_features_
private

Definition at line 153 of file EcalVetoProcessor.h.

◆ bdt_file_name_

std::string ecal::EcalVetoProcessor::bdt_file_name_
private

Definition at line 150 of file EcalVetoProcessor.h.

◆ beam_energy_mev_

float ecal::EcalVetoProcessor::beam_energy_mev_ {0}
private

Definition at line 148 of file EcalVetoProcessor.h.

148{0};

◆ cell_map_

std::map<ldmx::EcalID, float> ecal::EcalVetoProcessor::cell_map_
private

Definition at line 106 of file EcalVetoProcessor.h.

◆ cell_map_tight_iso_

std::map<ldmx::EcalID, float> ecal::EcalVetoProcessor::cell_map_tight_iso_
private

Definition at line 107 of file EcalVetoProcessor.h.

◆ collection_name_

std::string ecal::EcalVetoProcessor::collection_name_ {"EcalVeto"}
private

Name of the collection which will containt the results.

Definition at line 171 of file EcalVetoProcessor.h.

171{"EcalVeto"};

Referenced by configure(), and produce().

◆ deepest_layer_hit_

int ecal::EcalVetoProcessor::deepest_layer_hit_ {0}
private

Definition at line 117 of file EcalVetoProcessor.h.

117{0};

◆ ecal_back_energy_

float ecal::EcalVetoProcessor::ecal_back_energy_ {0}
private

Definition at line 127 of file EcalVetoProcessor.h.

127{0};

◆ ecal_layer_edep_raw_

std::vector<float> ecal::EcalVetoProcessor::ecal_layer_edep_raw_
private

Definition at line 109 of file EcalVetoProcessor.h.

◆ ecal_layer_edep_readout_

std::vector<float> ecal::EcalVetoProcessor::ecal_layer_edep_readout_
private

Definition at line 110 of file EcalVetoProcessor.h.

◆ ecal_layer_time_

std::vector<float> ecal::EcalVetoProcessor::ecal_layer_time_
private

Definition at line 111 of file EcalVetoProcessor.h.

◆ ecal_sp_coll_name_

std::string ecal::EcalVetoProcessor::ecal_sp_coll_name_
private

Definition at line 157 of file EcalVetoProcessor.h.

◆ ep_ang_

float ecal::EcalVetoProcessor::ep_ang_ {0}
private

Angular separation between the projected photon and electron trajectories as projected at ECAL.

Definition at line 134 of file EcalVetoProcessor.h.

134{0};

Referenced by produce().

◆ ep_ang_at_target_

float ecal::EcalVetoProcessor::ep_ang_at_target_ {0}
private

Angular separation between the projected photon and electron trajectories as at Target.

Definition at line 137 of file EcalVetoProcessor.h.

137{0};

Referenced by produce().

◆ ep_dot_

float ecal::EcalVetoProcessor::ep_dot_ {0}
private

Dot product of the photon and electron momenta unit vectors at Ecal.

Definition at line 142 of file EcalVetoProcessor.h.

142{0};

Referenced by produce().

◆ ep_dot_at_target_

float ecal::EcalVetoProcessor::ep_dot_at_target_ {0}
private

Dot product of the photon and electron momenta unit vectors at Target.

Definition at line 144 of file EcalVetoProcessor.h.

144{0};

Referenced by produce().

◆ ep_sep_

float ecal::EcalVetoProcessor::ep_sep_ {0}
private

Distance between the projected photon and electron trajectories at the ECal face.

Definition at line 140 of file EcalVetoProcessor.h.

140{0};

Referenced by produce().

◆ feature_list_name_

std::string ecal::EcalVetoProcessor::feature_list_name_
private

Definition at line 154 of file EcalVetoProcessor.h.

◆ geometry_

const ldmx::EcalGeometry* ecal::EcalVetoProcessor::geometry_
private

handle to current geometry (to share with member functions)

Definition at line 176 of file EcalVetoProcessor.h.

Referenced by produce().

◆ inverse_skim_

bool ecal::EcalVetoProcessor::inverse_skim_ {false}
private

Definition at line 168 of file EcalVetoProcessor.h.

168{false};

◆ max_cell_dep_

float ecal::EcalVetoProcessor::max_cell_dep_ {0}
private

Definition at line 121 of file EcalVetoProcessor.h.

121{0};

◆ n_ecal_layers_

int ecal::EcalVetoProcessor::n_ecal_layers_ {0}
private

Definition at line 115 of file EcalVetoProcessor.h.

115{0};

◆ n_readout_hits_

int ecal::EcalVetoProcessor::n_readout_hits_ {0}
private

Definition at line 116 of file EcalVetoProcessor.h.

116{0};

◆ n_tracking_hits_

int ecal::EcalVetoProcessor::n_tracking_hits_ {0}
private

Number of hits outside of the electron roc in the Ecal or if the electron trajectory is missing, all the hits in the Ecal.

Definition at line 131 of file EcalVetoProcessor.h.

131{0};

Referenced by produce().

◆ nevents_

int ecal::EcalVetoProcessor::nevents_ {0}
private

Definition at line 102 of file EcalVetoProcessor.h.

102{0};

◆ processing_time_

float ecal::EcalVetoProcessor::processing_time_ {0.}
private

Definition at line 103 of file EcalVetoProcessor.h.

103{0.};

◆ profiling_map_

std::map<std::string, float> ecal::EcalVetoProcessor::profiling_map_
private

Definition at line 105 of file EcalVetoProcessor.h.

◆ rec_coll_name_

std::string ecal::EcalVetoProcessor::rec_coll_name_
private

Definition at line 161 of file EcalVetoProcessor.h.

◆ rec_pass_name_

std::string ecal::EcalVetoProcessor::rec_pass_name_
private

Definition at line 160 of file EcalVetoProcessor.h.

◆ recoil_from_tracking_

bool ecal::EcalVetoProcessor::recoil_from_tracking_
private

Definition at line 162 of file EcalVetoProcessor.h.

◆ roc_file_name_

std::string ecal::EcalVetoProcessor::roc_file_name_
private

Definition at line 152 of file EcalVetoProcessor.h.

◆ roc_range_values_

std::vector<std::vector<float> > ecal::EcalVetoProcessor::roc_range_values_
private

Definition at line 113 of file EcalVetoProcessor.h.

◆ rt_

std::unique_ptr<ldmx::ort::ONNXRuntime> ecal::EcalVetoProcessor::rt_
private

Definition at line 173 of file EcalVetoProcessor.h.

◆ shower_rms_

float ecal::EcalVetoProcessor::shower_rms_ {0}
private

Definition at line 122 of file EcalVetoProcessor.h.

122{0};

◆ sim_particles_coll_name_

std::string ecal::EcalVetoProcessor::sim_particles_coll_name_
private

Definition at line 166 of file EcalVetoProcessor.h.

◆ sim_particles_passname_

std::string ecal::EcalVetoProcessor::sim_particles_passname_
private

Definition at line 167 of file EcalVetoProcessor.h.

◆ sp_pass_name_

std::string ecal::EcalVetoProcessor::sp_pass_name_
private

Definition at line 159 of file EcalVetoProcessor.h.

◆ std_layer_hit_

float ecal::EcalVetoProcessor::std_layer_hit_ {0}
private

Definition at line 126 of file EcalVetoProcessor.h.

126{0};

◆ summed_det_

float ecal::EcalVetoProcessor::summed_det_ {0}
private

Definition at line 119 of file EcalVetoProcessor.h.

119{0};

◆ summed_tight_iso_

float ecal::EcalVetoProcessor::summed_tight_iso_ {0}
private

Definition at line 120 of file EcalVetoProcessor.h.

120{0};

◆ target_sp_coll_name_

std::string ecal::EcalVetoProcessor::target_sp_coll_name_
private

Definition at line 158 of file EcalVetoProcessor.h.

◆ track_collection_

std::string ecal::EcalVetoProcessor::track_collection_
private

Definition at line 164 of file EcalVetoProcessor.h.

◆ track_pass_name_

std::string ecal::EcalVetoProcessor::track_pass_name_
private

Definition at line 163 of file EcalVetoProcessor.h.

◆ x_std_

float ecal::EcalVetoProcessor::x_std_ {0}
private

Definition at line 123 of file EcalVetoProcessor.h.

123{0};

◆ y_std_

float ecal::EcalVetoProcessor::y_std_ {0}
private

Definition at line 124 of file EcalVetoProcessor.h.

124{0};

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