LDMX Software
RecoilMissesEcalSkimmer.cxx
Go to the documentation of this file.
1
9
10namespace recon {
11
13 framework::Process &process)
14 : framework::Producer(name, process) {}
15
17
20 ecal_sim_hits_pass_name_ = parameters.get<std::string>("ecalSimHitsPassName");
21
22 sim_particles_pass_name_ =
23 parameters.get<std::string>("sim_particles_pass_name");
24}
25
27 // Get the collection of simulated particles from the event
28 auto particle_map{event.getMap<int, ldmx::SimParticle>(
29 "SimParticles", sim_particles_pass_name_)};
30
31 // Search for the recoil electron
32 auto [recoilTrackID, recoilElectron] = analysis::getRecoil(particle_map);
33
34 // Get the collection of simulated Ecal hits_ from the event.
35 const std::vector<ldmx::SimCalorimeterHit> ecal_sim_hits =
36 event.getCollection<ldmx::SimCalorimeterHit>("EcalSimHits",
37 ecal_sim_hits_pass_name_);
38
39 // Loop through the Ecal hits_ and check if the recoil electron is
40 // associated with any of them. If there are any recoil electron hits_
41 // in the Ecal, drop the event.
42 bool has_recoil_electron_hits = false;
43 for (const ldmx::SimCalorimeterHit &sim_hit : ecal_sim_hits) {
44 /*std::cout << "[ RecoilMissesEcalSkimmer ]: "
45 << "Number of hit contributions: "
46 << simHit->getNumberOfContribs() << std::endl;*/
47
48 for (int i_contrib = 0; i_contrib < sim_hit.getNumberOfContribs();
49 ++i_contrib) {
50 ldmx::SimCalorimeterHit::Contrib contrib = sim_hit.getContrib(i_contrib);
51
52 if (contrib.track_id_ == recoilTrackID) {
53 /*std::cout << "[ RecoilMissesEcalSkimmer ]: "
54 << "Ecal hit associated with recoil electron." << std::endl;
55 */
56
57 has_recoil_electron_hits = true;
58 }
59 }
60 }
61
62 // Tell the skimmer to keep or drop the event based on whether there
63 // were recoil electron hits_ found in the Ecal.
64 if (has_recoil_electron_hits) {
66 } else {
68 }
69}
70} // namespace recon
71
#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.
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:42
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
Stores simulated calorimeter hit information.
Class representing a simulated particle.
Definition SimParticle.h:23
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