LDMX Software
RecoilMissesEcalSkimmer.cxx
Go to the documentation of this file.
1
9
11#include "SimCore/Event/SimParticle.h"
12#include "Tools/AnalysisUtils.h"
13
14namespace recon {
15
17 framework::Process& process)
18 : framework::Producer(name, process) {}
19
21
24 ecal_sim_hits_pass_name_ =
25 parameters.get<std::string>("ecal_sim_hits_pass_name");
26
27 sim_particles_pass_name_ =
28 parameters.get<std::string>("sim_particles_pass_name");
29}
30
32 // Get the collection of simulated particles from the event
33 auto particle_map{event.getMap<int, ldmx::SimParticle>(
34 "SimParticles", sim_particles_pass_name_)};
35
36 // Search for the recoil electron
37 auto [recoilTrackID, recoilElectron] = analysis::getRecoil(particle_map);
38
39 // Get the collection of simulated Ecal hits_ from the event.
40 const std::vector<ldmx::SimCalorimeterHit> ecal_sim_hits =
41 event.getCollection<ldmx::SimCalorimeterHit>("EcalSimHits",
42 ecal_sim_hits_pass_name_);
43
44 // Loop through the Ecal hits_ and check if the recoil electron is
45 // associated with any of them. If there are any recoil electron hits_
46 // in the Ecal, drop the event.
47 bool has_recoil_electron_hits = false;
48 for (const ldmx::SimCalorimeterHit& sim_hit : ecal_sim_hits) {
49 /*std::cout << "[ RecoilMissesEcalSkimmer ]: "
50 << "Number of hit contributions: "
51 << simHit->getNumberOfContribs() << std::endl;*/
52
53 for (int i_contrib = 0; i_contrib < sim_hit.getNumberOfContribs();
54 ++i_contrib) {
55 ldmx::SimCalorimeterHit::Contrib contrib = sim_hit.getContrib(i_contrib);
56
57 if (contrib.track_id_ == recoilTrackID) {
58 /*std::cout << "[ RecoilMissesEcalSkimmer ]: "
59 << "Ecal hit associated with recoil electron." << std::endl;
60 */
61
62 has_recoil_electron_hits = true;
63 }
64 }
65 }
66
67 // Tell the skimmer to keep or drop the event based on whether there
68 // were recoil electron hits_ found in the Ecal.
69 if (has_recoil_electron_hits) {
71 } else {
73 }
74}
75} // namespace recon
76
Collection of utility functions useful for analysis.
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Processor used to select events where the recoil electron misses the Ecal.
Class which stores simulated calorimeter hit information.
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module_.
Implements an event buffer system for storing event data.
Definition Event.h:40
Class which represents the process under execution.
Definition Process.h:34
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:75
Stores simulated calorimeter hit information.
Class representing a simulated particle.
Definition SimParticle.h:25
RecoilMissesEcalSkimmer(const std::string &name, framework::Process &process)
Constructor.
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
void produce(framework::Event &event) override
Run the processor and select events where the recoil misses the Ecal.
All classes in the ldmx-sw project use this namespace.
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
Information about a contribution to the hit in the associated cell.
int track_id_
track ID of this contributor