Pixie16 Analysis Software Suite
Analysis code for processing of .ldf files
DetectorDriver.hpp
Go to the documentation of this file.
1 
33 #ifndef __DETECTORDRIVER_HPP_
34 #define __DETECTORDRIVER_HPP_ 1
35 
36 #include <set>
37 #include <string>
38 #include <utility>
39 #include <vector>
40 
41 #include "Calibrator.hpp"
42 #include "ChanEvent.hpp"
43 #include "Globals.hpp"
44 #include "Messenger.hpp"
45 #include "Plots.hpp"
46 #include "WalkCorrector.hpp"
47 
48 class Calibration;
49 class RawEvent;
50 class EventProcessor;
51 class TraceAnalyzer;
52 
60 public:
62  static DetectorDriver* get();
63 
67 
74  virtual void plot(int dammId, double val1, double val2 = -1,
75  double val3 = -1, const char* name="h") {
76  histo.Plot(dammId, val1, val2, val3, name);
77  }
78 
92  int ProcessEvent(RawEvent& rawev);
93 
100  int ThreshAndCal(ChanEvent *chan, RawEvent& rawev);
101 
107  int Init(RawEvent& rawev);
108 
114  int PlotRaw(const ChanEvent *);
115 
120  int PlotCal(const ChanEvent *);
121 
124  void DeclarePlots();
125 
128  void SanityCheck(void) const {};
129 
133  void CorrelateClock(double d, time_t t) {
134  pixieToWallClock=std::make_pair(d, t);
135  }
136 
139  time_t GetWallTime(double d) const {
140  return (time_t)((d - pixieToWallClock.first) *
142  pixieToWallClock.second);
143  }
144 
146  const std::vector<EventProcessor *>& GetProcessors(void) const {
147  return vecProcess;
148  }
149 
152  std::vector<EventProcessor *> GetProcessors(const std::string &type) const;
153 
155  const std::set<std::string> &GetUsedDetectors(void) const;
156 
158  virtual ~DetectorDriver();
159 private:
161  DetectorDriver();
165 
166  std::vector<EventProcessor*> vecProcess;
168  std::vector<TraceAnalyzer*> vecAnalyzer;
170  std::set<std::string> knownDetectors;
173  std::pair<double, time_t> pixieToWallClock;
180  virtual void DeclareHistogram1D(int dammId, int xSize, const char* title) {
181  histo.DeclareHistogram1D(dammId, xSize, title);
182  }
183 
189  virtual void DeclareHistogram2D(int dammId, int xSize, int ySize,
190  const char* title) {
191  histo.DeclareHistogram2D(dammId, xSize, ySize, title);
192  }
193 
196  void LoadProcessors(Messenger& m);
197 
199  void ReadCalXml();
201  void ReadWalkXml();
202 };
203 
204 #endif // __DETECTORDRIVER_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.
void CorrelateClock(double d, time_t t)
Definition: DetectorDriver.hpp:133
Calibrator cali
Instance of the calibrator.
Definition: DetectorDriver.hpp:65
A channel event.
Definition: ChanEvent.hpp:23
A Class to define what a channel event is.
int PlotRaw(const ChanEvent *)
static Globals * get()
Class to handle energy calibrations for the channels.
DetectorDriver & operator=(DetectorDriver const &)
Equality constructor.
std::pair< double, time_t > pixieToWallClock
Definition: DetectorDriver.hpp:173
virtual void DeclareHistogram1D(int dammId, int xSize, const char *title)
Definition: DetectorDriver.hpp:180
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.
A Class to handle walk corrections for channels.
const std::set< std::string > & GetUsedDetectors(void) const
void DeclarePlots()
void SanityCheck(void) const
Definition: DetectorDriver.hpp:128
DetectorDriver controls event processing.
Definition: DetectorDriver.hpp:59
Plots histo
Instance of the histogram class.
Definition: DetectorDriver.hpp:66
void LoadProcessors(Messenger &m)
static DetectorDriver * instance
The only instance of DetectorDriver.
Definition: DetectorDriver.hpp:164
constant parameters used in pixie16 analysis
std::vector< TraceAnalyzer * > vecAnalyzer
Definition: DetectorDriver.hpp:168
Online trace analysis.
Definition: TraceAnalyzer.hpp:19
virtual void DeclareHistogram2D(int dammId, int xSize, int ySize, const char *title)
Declares a 2D histogram calls the C++ wrapper for DAMM.
Definition: DetectorDriver.hpp:189
A class to handle messages and output them prettily.
virtual void plot(int dammId, double val1, double val2=-1, double val3=-1, const char *name="h")
Plots into histogram defined by dammId.
Definition: DetectorDriver.hpp:74
Class to correct channels for walk in the onboard filters.
Definition: WalkCorrector.hpp:40
void ReadWalkXml()
WalkCorrector walk
Instance of the walk correction.
Definition: DetectorDriver.hpp:64
std::vector< EventProcessor * > vecProcess
Definition: DetectorDriver.hpp:166
time_t GetWallTime(double d) const
Definition: DetectorDriver.hpp:139
Class to handle energy calibrations.
Definition: Calibrator.hpp:44
This class outputs nicely formatted messages during configuration loading.
Definition: Messenger.hpp:19
double clockInSeconds() const
Definition: Globals.hpp:150
std::set< std::string > knownDetectors
Definition: DetectorDriver.hpp:170
const std::vector< EventProcessor * > & GetProcessors(void) const
Definition: DetectorDriver.hpp:146
Class to handle event processing.
Definition: EventProcessor.hpp:25
int PlotCal(const ChanEvent *)
int ThreshAndCal(ChanEvent *chan, RawEvent &rawev)
Check threshold and calibrate each channel. Check the thresholds and calibrate the energy for each ch...
The all important raw event.
Definition: RawEvent.hpp:46
int Init(RawEvent &rawev)
int ProcessEvent(RawEvent &rawev)
Control of the event processing.
virtual ~DetectorDriver()
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