LDMX Software
MyProcessor.cxx
1
2#include "Recon/Examples/MyProcessor.h"
3
4#include "Ecal/Event/EcalHit.h"
5
6namespace recon {
7
8MyProcessor::MyProcessor(const std::string& name, framework::Process& process)
9 : framework::Producer(name, process) {}
10
18 int my_parameter = parameters.get<int>("my_parameter");
19
20 ldmx_log(info) << "MyProcessor configured with my_parameter = "
21 << my_parameter;
22
23 ecal_rechits_passname_ = parameters.get<std::string>("ecal_rechits_passname");
24 ecal_rec_hits_event_passname_ =
25 parameters.get<std::string>("ecal_rec_hits_event_passname");
26}
27
29 // Check if the collection of reconstructed ECal hits_ exist. If not,
30 // don't bother processing the event.
31 if (!event.exists("EcalRecHits", ecal_rec_hits_event_passname_)) return;
32
33 // Get the collection of digitized ECal hits_ from the event
34 const std::vector<ldmx::EcalHit> hits =
35 event.getCollection<ldmx::EcalHit>("EcalRecHits", ecal_rechits_passname_);
36
37 // Loop over the collection of hits_ and print the hit details
38 for (const auto& hit : hits) {
39 // Print the hit
40 ldmx_log(info) << hit;
41 }
42}
43} // namespace recon
44
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Implements an event buffer system for storing event data.
Definition Event.h:40
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:107
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 reconstructed hit information from the ECAL.
Definition EcalHit.h:19
Minimal example of a processor.
Definition MyProcessor.h:19
std::string ecal_rechits_passname_
Pass name for the EcalRecHits collection.
Definition MyProcessor.h:53
MyProcessor(const std::string &name, framework::Process &process)
Constructor.
void produce(framework::Event &event) override
Process the event and put new data products into it.
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
All classes in the ldmx-sw project use this namespace.