LDMX Software
MyProcessor.cxx
1
2#include "Recon/Examples/MyProcessor.h"
3
4namespace recon {
5
6MyProcessor::MyProcessor(const std::string &name, framework::Process &process)
7 : framework::Producer(name, process) {}
8
16 int my_parameter = parameters.get<int>("my_parameter");
17
18 ldmx_log(info) << "MyProcessor configured with my_parameter = "
19 << my_parameter;
20
21 ecal_rechits_passname_ = parameters.get<std::string>("ecal_rechits_passname");
22 ecal_rec_hits_event_passname_ =
23 parameters.get<std::string>("ecal_rec_hits_event_passname");
24}
25
27 // Check if the collection of reconstructed ECal hits_ exist. If not,
28 // don't bother processing the event.
29 if (!event.exists("EcalRecHits", ecal_rec_hits_event_passname_)) return;
30
31 // Get the collection of digitized ECal hits_ from the event
32 const std::vector<ldmx::EcalHit> hits =
33 event.getCollection<ldmx::EcalHit>("EcalRecHits", ecal_rechits_passname_);
34
35 // Loop over the collection of hits_ and print the hit details
36 for (const auto &hit : hits) {
37 // Print the hit
38 ldmx_log(info) << hit;
39 }
40}
41} // namespace recon
42
#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:42
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:92
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 reconstructed hit information from the ECAL.
Definition EcalHit.h:19
Minimal example of a processor.
Definition MyProcessor.h:20
std::string ecal_rechits_passname_
Pass name for the EcalRecHits collection.
Definition MyProcessor.h:54
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.