hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Processor.h
Go to the documentation of this file.
1
7#ifndef __PROCESSOR_H__
8#define __PROCESSOR_H__
9
10//----------------//
11// C++ StdLib //
12//----------------//
13#include <map>
14
15//-----------//
16// hpstr //
17//-----------//
18#include "ParameterSet.h"
19
20// Forward declarations
21class Process;
22class Processor;
23class TTree;
24class TFile;
25class IEvent;
26
28typedef Processor* ProcessorMaker(const std::string& name, Process& process);
29
34class Processor {
35
36 public:
49 Processor(const std::string& name, Process& process);
50
54 virtual ~Processor() {;}
55
61 virtual void configure(const ParameterSet& parameters) {
62 }
63
71 virtual void initialize(TTree* tree) = 0;
72
81 virtual void initialize(std::string inFilename, std::string outFilename) {};
82
88 virtual void setFile(TFile* outFile) {outF_ = outFile;};
89
95 virtual bool process() {return true;};
96
103 virtual bool process(IEvent* ievent) = 0;
104
110 virtual void finalize() = 0;
111
118 static void declare(const std::string& classname, ProcessorMaker*);
119
120 protected:
123
125 TFile* outF_{nullptr};
126
128 std::string name_;
129
130
131};
132
139#define DECLARE_PROCESSOR(CLASS) Processor* CLASS ## _make (const std::string& name, Process& process) { return new CLASS(name,process); } __attribute__((constructor(1000))) static void CLASS ## _declare() { Processor::declare(#CLASS, & CLASS ## _make ); }
140
141#endif
Class which contains parameters passed to a Processor.
Processor * ProcessorMaker(const std::string &name, Process &process)
Definition Processor.h:28
Definition IEvent.h:7
description
Base class for all event processing components.
Definition Processor.h:34
virtual bool process(IEvent *ievent)=0
Process the event and put new data products into it.
TFile * outF_
Definition Processor.h:125
std::string name_
Definition Processor.h:128
static void declare(const std::string &classname, ProcessorMaker *)
Internal function which is part of the ProcessorFactory machinery.
Definition Processor.cxx:14
virtual void finalize()=0
Callback for the Processor to take any necessary action when the processing of events finishes,...
virtual void configure(const ParameterSet &parameters)
Callback for the Processor to configure itself from the given set of parameters.
Definition Processor.h:61
virtual ~Processor()
Definition Processor.h:54
virtual bool process()
Process the histograms and generate analysis output.
Definition Processor.h:95
virtual void initialize(TTree *tree)=0
Callback for the Processor to take any necessary action when the processing of events starts,...
virtual void initialize(std::string inFilename, std::string outFilename)
Callback for the Processor to take any necessary action when the processing of events starts,...
Definition Processor.h:81
virtual void setFile(TFile *outFile)
Set output TFile for AnaProcessors.
Definition Processor.h:88
Process & process_
Definition Processor.h:122