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.getParameter<int>("my_parameter");
17
18 std::cout << "MyProcessor has my_parameter = " << my_parameter << std::endl;
19}
20
22 // Check if the collection of reconstructed ECal hits exist. If not,
23 // don't bother processing the event.
24 if (!event.exists("EcalRecHits")) return;
25
26 // Get the collection of digitized ECal hits from the event
27 const std::vector<ldmx::EcalHit> hits =
28 event.getCollection<ldmx::EcalHit>("EcalRecHits");
29
30 // Loop over the collection of hits and print the hit details
31 for (const ldmx::EcalHit &hit : hits) {
32 // Print the hit
33 hit.Print();
34 }
35}
36} // namespace recon
37
38DECLARE_PRODUCER_NS(recon, MyProcessor)
#define DECLARE_PRODUCER_NS(NS, 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:41
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:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
Stores reconstructed hit information from the ECAL.
Definition EcalHit.h:19
void Print() const
Print a text representation of this object.
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.
Definition PerfDict.cxx:45