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_ =
21 parameters.get<std::string>("ecal_sim_hits_pass_name");
22
23 sim_particles_pass_name_ =
24 parameters.get<std::string>("sim_particles_pass_name");
25}
26
28 // Get the collection of simulated particles from the event
29 auto particle_map{event.getMap<int, ldmx::SimParticle>(
30 "SimParticles", sim_particles_pass_name_)};
31
32 // Search for the recoil electron
33 auto [recoilTrackID, recoilElectron] = analysis::getRecoil(particle_map);
34
35 // Get the collection of simulated Ecal hits_ from the event.
36 const std::vector<ldmx::SimCalorimeterHit> ecal_sim_hits =
37 event.getCollection<ldmx::SimCalorimeterHit>("EcalSimHits",
38 ecal_sim_hits_pass_name_);
39
40 // Loop through the Ecal hits_ and check if the recoil electron is
41 // associated with any of them. If there are any recoil electron hits_
42 // in the Ecal, drop the event.
43 bool has_recoil_electron_hits = false;
44 for (const ldmx::SimCalorimeterHit &sim_hit : ecal_sim_hits) {
45 /*std::cout << "[ RecoilMissesEcalSkimmer ]: "
46 << "Number of hit contributions: "
47 << simHit->getNumberOfContribs() << std::endl;*/
48
49 for (int i_contrib = 0; i_contrib < sim_hit.getNumberOfContribs();
50 ++i_contrib) {
51 ldmx::SimCalorimeterHit::Contrib contrib = sim_hit.getContrib(i_contrib);
52
53 if (contrib.track_id_ == recoilTrackID) {
54 /*std::cout << "[ RecoilMissesEcalSkimmer ]: "
55 << "Ecal hit associated with recoil electron." << std::endl;
56 */
57
58 has_recoil_electron_hits = true;
59 }
60 }
61 }
62
63 // Tell the skimmer to keep or drop the event based on whether there
64 // were recoil electron hits_ found in the Ecal.
65 if (has_recoil_electron_hits) {
67 } else {
69 }
70}
71} // namespace recon
72
#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:37
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