Pixie16 Analysis Software Suite
Analysis code for processing of .ldf files
EventProcessor.hpp
Go to the documentation of this file.
1 
4 #ifndef __EVENTPROCESSOR_HPP_
5 #define __EVENTPROCESSOR_HPP_
6 
7 #include <map>
8 #include <set>
9 #include <string>
10 
11 #include <sys/times.h>
12 
13 #include "Plots.hpp"
14 #include "TreeCorrelator.hpp"
15 
16 // forward declarations
17 class DetectorSummary;
18 class RawEvent;
19 
20 #ifdef useroot
21 class TTree;
22 #endif
23 
26 public:
29 
34  EventProcessor(int offset, int range, std::string name);
35 
37  virtual ~EventProcessor();
38 
40  virtual void DeclarePlots(void) {};
41 
44  virtual const std::set<std::string>& GetTypes(void) const {
45  return associatedTypes;
46  }
47 
49  virtual bool DidProcess(void) const {
50  return didProcess;
51  }
52 
55  virtual bool HasEvent(void) const;
56 
61  virtual bool Init(RawEvent& event);
62 
70  virtual bool PreProcess(RawEvent &event);
71 
77  virtual bool Process(RawEvent &event);
78 
80  void EndProcess(void);
81 
84  std::string GetName(void) const {
85  return name;
86  }
87 #ifdef useroot
88 
92  virtual bool AddBranch(TTree *tree) {return(false);};
93 
100  virtual void FillBranch(void) {};
101 #endif
102 
103 protected:
104  std::string name;
105  std::set<std::string> associatedTypes;
106  bool initDone;
108  std::map<std::string, const DetectorSummary *> sumMap;
109 
113 
124  virtual void plot(int dammId, double val1, double val2 = -1,
125  double val3 = -1, const char* name="h") {
126  histo.Plot(dammId, val1, val2, val3, name);
127  }
128 
134  virtual void DeclareHistogram1D(int dammId, int xSize, const char* title) {
135  histo.DeclareHistogram1D(dammId, xSize, title);
136  }
137 
144  virtual void DeclareHistogram2D(int dammId, int xSize, int ySize,
145  const char* title) {
146  histo.DeclareHistogram2D(dammId, xSize, ySize, title);
147  }
148 
149 private:
150  tms tmsBegin;
151  double userTime;
152  double systemTime;
154 };
155 #endif // __EVENTPROCESSOR_HPP_
bool DeclareHistogram2D(int dammId, int xSize, int ySize, const char *title, int halfWordsPerChan, int xHistLength, int xLow, int xHigh, int yHistLength, int yLow, int yHigh, const std::string &mne="")
Declares a 2D histogram calls the C++ wrapper for DAMM.
A class to handle complex correlations between various processors.
virtual bool Init(RawEvent &event)
Plots histo
Definition: EventProcessor.hpp:112
virtual ~EventProcessor()
std::set< std::string > associatedTypes
Set of associated types for Processor.
Definition: EventProcessor.hpp:105
virtual bool Process(RawEvent &event)
tms tmsBegin
The beginning processor time.
Definition: EventProcessor.hpp:150
A container to request a block of plots and plot respective spectra through the plots register...
bool Plot(int dammId, double val1, double val2=-1, double val3=-1, const char *name="h")
Plots into histogram defined by dammId.
void EndProcess(void)
virtual bool DidProcess(void) const
Definition: EventProcessor.hpp:49
double systemTime
The system time spent in the processor.
Definition: EventProcessor.hpp:152
double userTime
The user time spent in the processor.
Definition: EventProcessor.hpp:151
virtual void DeclarePlots(void)
Definition: EventProcessor.hpp:40
bool initDone
True if the initialization has finished.
Definition: EventProcessor.hpp:106
bool didProcess
True if the process finished.
Definition: EventProcessor.hpp:107
virtual bool PreProcess(RawEvent &event)
virtual void plot(int dammId, double val1, double val2=-1, double val3=-1, const char *name="h")
Implementation of the plot command to interface with the DAMM routines.
Definition: EventProcessor.hpp:124
std::map< std::string, const DetectorSummary * > sumMap
Map of associated detector summary.
Definition: EventProcessor.hpp:108
virtual bool HasEvent(void) const
std::string GetName(void) const
Definition: EventProcessor.hpp:84
virtual void DeclareHistogram1D(int dammId, int xSize, const char *title)
Declares a 1D histogram calls the C++ wrapper for DAMM.
Definition: EventProcessor.hpp:134
Class to handle event processing.
Definition: EventProcessor.hpp:25
virtual void DeclareHistogram2D(int dammId, int xSize, int ySize, const char *title)
Declares a 2D histogram calls the C++ wrapper for DAMM.
Definition: EventProcessor.hpp:144
The all important raw event.
Definition: RawEvent.hpp:46
Summary of all channels of one detector type.
Definition: DetectorSummary.hpp:31
std::string name
Name of the Processor.
Definition: EventProcessor.hpp:104
double clocksPerSecond
The number of clock cycles per second.
Definition: EventProcessor.hpp:153
virtual const std::set< std::string > & GetTypes(void) const
Definition: EventProcessor.hpp:44
bool DeclareHistogram1D(int dammId, int xSize, const char *title, int halfWordsPerChan, int xHistLength, int xLow, int xHigh, const std::string &mne="")
Declares a 1D histogram calls the C++ wrapper for DAMM.
Holds pointers to all Histograms.
Definition: Plots.hpp:27