7#ifndef FRAMEWORK_EVENTPROCESSOR_H_
8#define FRAMEWORK_EVENTPROCESSOR_H_
14#include "Framework/Configure/Parameters.h"
16#include "Framework/Exception/Exception.h"
17#include "Framework/Histograms.h"
18#include "Framework/Logger.h"
19#include "Framework/NtupleManager.h"
20#include "Framework/RunHeader.h"
171 const std::string &purposeString);
196 static void declare(
const std::string &classname,
int classtype,
205 const std::vector<framework::config::Parameters> &histos);
333#define DECLARE_PRODUCER(CLASS) \
334 framework::EventProcessor *CLASS##_ldmx_make(const std::string &name, \
335 framework::Process &process) { \
336 return new CLASS(name, process); \
338 __attribute__((constructor(1000))) static void CLASS##_ldmx_declare() { \
339 framework::EventProcessor::declare( \
340 #CLASS, ::framework::Producer::CLASSTYPE, &CLASS##_ldmx_make); \
352#define DECLARE_ANALYZER(CLASS) \
353 framework::EventProcessor *CLASS##_ldmx_make(const std::string &name, \
354 framework::Process &process) { \
355 return new CLASS(name, process); \
357 __attribute__((constructor(1000))) static void CLASS##_ldmx_declare() { \
358 framework::EventProcessor::declare( \
359 #CLASS, ::framework::Analyzer::CLASSTYPE, &CLASS##_ldmx_make); \
371#define DECLARE_PRODUCER_NS(NS, CLASS) \
372 framework::EventProcessor *CLASS##_ldmx_make(const std::string &name, \
373 framework::Process &process) { \
374 return new NS::CLASS(name, process); \
376 __attribute__((constructor(1000))) static void CLASS##_ldmx_declare() { \
377 framework::EventProcessor::declare( \
378 std::string(#NS) + "::" + std::string(#CLASS), \
379 ::framework::Producer::CLASSTYPE, &CLASS##_ldmx_make); \
391#define DECLARE_ANALYZER_NS(NS, CLASS) \
392 framework::EventProcessor *CLASS##_ldmx_make(const std::string &name, \
393 framework::Process &process) { \
394 return new NS::CLASS(name, process); \
396 __attribute__((constructor(1000))) static void CLASS##_ldmx_declare() { \
397 framework::EventProcessor::declare( \
398 std::string(#NS) + "::" + std::string(#CLASS), \
399 ::framework::Analyzer::CLASSTYPE, &CLASS##_ldmx_make); \
Container and caching class for conditions information.
Class implementing an event buffer system for storing event data.
Definitions related to event storage control from an EventProcessor.
Specific exception used to abort an event.
virtual ~AbortEventException()
Destructor.
AbortEventException()
Constructor.
Base class for a module which does not produce a data product.
static const int CLASSTYPE
Constant used to track EventProcessor types by the PluginFactory.
virtual void analyze(const Event &event)=0
Process the event and make histograms or summaries.
Container and cache for conditions and conditions providers.
const T & getCondition(const std::string &condition_name)
Primary request action for a conditions object If the object is in the cache and still valid (IOV),...
This class manages all ROOT file input/output operations.
Base class for all event processing components.
static void declare(const std::string &classname, int classtype, EventProcessorMaker *)
Internal function which is part of the PluginFactory machinery.
Process & process_
Handle to the Process.
virtual void configure(framework::config::Parameters ¶meters)
Callback for the EventProcessor to configure itself from the given set of parameters.
std::string name_
The name of the EventProcessor.
NtupleManager & ntuple_
Manager for any ntuples.
virtual void onProcessEnd()
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
void createHistograms(const std::vector< framework::config::Parameters > &histos)
Internal function which is used to create histograms passed from the python configuration @parma hist...
virtual void onFileClose(EventFile &eventFile)
Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
TDirectory * histoDir_
Histogram directory.
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
Conditions & getConditions() const
Internal getter for conditions without exposing all of Process.
void abortEvent()
Abort the event immediately.
const ldmx::EventHeader & getEventHeader() const
Internal getter for EventHeader without exposing all of Process.
virtual void onNewRun(const ldmx::RunHeader &runHeader)
Callback for the EventProcessor to take any necessary action when the run being processed changes.
std::string getName() const
Get the processor name.
virtual ~EventProcessor()
Class destructor.
virtual void onProcessStart()
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
virtual void onFileOpen(EventFile &eventFile)
Callback for the EventProcessor to take any necessary action when a new event input ROOT file is open...
int getRunNumber() const
Get the run number from the process.
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
logging::logger theLog_
The logger for this EventProcessor.
HistogramHelper histograms_
Interface class for making and filling histograms.
int getLogFrequency() const
Get the current logging frequency from the process.
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.
Interface class between an EventProcessor and the HistogramPool.
Singleton class used to manage the creation and pooling of ntuples.
static NtupleManager & getInstance()
Class which represents the process under execution.
Base class for a module which produces a data product.
static const int CLASSTYPE
Constant used to track EventProcessor types by the PluginFactory.
virtual void produce(Event &event)=0
Process the event and put new data products into it.
virtual void beforeNewRun(ldmx::RunHeader &header)
Handle allowing producers to modify run headers before the run begins.
Hint
Hints that can be provided by processors to the storage controller.
Class encapsulating parameters for configuring a processor.
Standard base exception class with some useful output information.
Exception()
Empty constructor.
All classes in the ldmx-sw project use this namespace.
EventProcessor * EventProcessorMaker(const std::string &name, Process &process)
Typedef for EventProcessorFactory use.