PAASS
Software suite to Acquire and Analyze Data from Pixie16
scope.hpp
Go to the documentation of this file.
1 #ifndef OSCILLOSCOPE_HPP
2 #define OSCILLOSCOPE_HPP
3 
4 #include <ctime>
5 #include <vector>
6 #include <deque>
7 #include <cmath>
8 #include <string>
9 
10 #include "Unpacker.hpp"
11 
12 #include "RootScanner.hpp"
13 
14 class ChannelEvent;
15 class TGraph;
16 class TH2F;
17 class TF1;
18 class TLine;
19 class TProfile;
20 
22 // class scopeUnpacker
24 
25 class scopeUnpacker : public Unpacker {
26  public:
28  scopeUnpacker(const unsigned int &mod=0, const unsigned int &chan=0);
29 
32 
33  int SetMod(const unsigned int &mod){ return(mod >= 0 ? (mod_ = mod) : (mod_ = 0)); }
34 
35  int SetChan(const unsigned int &chan){ return(chan >= 0 ? (chan_ = chan) : (chan_ = 0)); }
36 
37  void SetThreshLow(const int &threshLow){ threshLow_ = threshLow; }
38 
39  void SetThreshHigh(const int &threshHigh){ threshHigh_ = threshHigh; }
40 
41  unsigned int GetMod(){ return mod_; }
42 
43  unsigned int GetChan(){ return chan_; }
44 
45  int GetThreshLow(){ return threshLow_; }
46 
47  int GetThreshHigh(){ return threshHigh_; }
48 
49  private:
50  unsigned int mod_;
51  unsigned int chan_;
54 
59  virtual void ProcessRawEvent(ScanInterface *addr_=NULL);
60 
66  virtual void RawStats(XiaData *event_, ScanInterface *addr_=NULL){ }
67 };
68 
70 // class scopeScanner
72 
73 class scopeScanner : public RootScanner {
74  public:
76  scopeScanner(int mod = 0, int chan = 0);
77 
79  ~scopeScanner();
80 
82  int GetDelay(){ return delay_; }
83 
85  size_t GetNumEvents(){ return numEvents; }
86 
88  void SetDelay(int delay){ delay_ = (delay>1)?delay:1; }
89 
91  void SetNumEvents(size_t num_){ numEvents = num_; }
92 
94  void StopACQ(){ running = false; }
95 
97  void StartACQ(){ running = true; }
98 
106  virtual bool ExtraCommands(const std::string &cmd_, std::vector<std::string> &args_);
107 
114  virtual void ExtraArguments();
115 
122  virtual void CmdHelp(const std::string &prefix_="");
123 
130  virtual void ArgHelp();
131 
136  virtual void SyntaxStr(char *name_);
137 
143  virtual bool Initialize(std::string prefix_="");
144 
148  virtual void FinalInitialization(){ }
149 
155  virtual bool InitRootOutput(std::string fname_, bool overwrite_=true){ return false; }
156 
161  virtual void Notify(const std::string &code_="");
162 
167  virtual Unpacker *GetCore();
168 
174  virtual bool AddEvent(XiaData *event_);
175 
180  virtual bool ProcessEvents();
181 
185  void ClearEvents();
186 
187  private:
188  unsigned int numAvgWaveforms_;
189  unsigned int num_displayed;
190 
191  size_t numEvents;
192 
193  float cfdF_;
194  int cfdD_;
195  int cfdL_;
196  int fitLow_;
197  int fitHigh_;
198  int delay_;
199 
202  bool acqRun_;
204  bool init;
205  bool running;
208 
209  std::vector<int> x_vals;
210  std::deque<ChannelEvent*> chanEvents_;
211 
212  time_t last_trace;
213 
214  std::string saveFile_;
215 
216  TGraph *graph;
217  TLine *cfdLine;
218  TF1 *cfdPol3;
219  TF1 *cfdPol2;
220  TH2F *hist;
221  TProfile *prof;
222 
224 
225  TF1 *SetupFunc();
226 
227  void ResetGraph(unsigned int size_);
228 
230  void Plot();
231 };
232 
233 #endif
bool running
True if debug mode is set.
Definition: Unpacker.hpp:115
time_t last_trace
The time of the last trace.
Definition: scope.hpp:212
bool performCfd_
Definition: scope.hpp:207
TLine * cfdLine
Definition: scope.hpp:217
unsigned int GetChan()
Definition: scope.hpp:43
int GetDelay()
Set the time delay between traces (in seconds).
Definition: scope.hpp:82
bool AddEvent(XiaData *event_)
Definition: Unpacker.cpp:132
TF1 * paulauskasFunc
A TF1 of the Paulauskas Function (NIM A 737 (2014) 22)
Definition: scope.hpp:223
void SetDelay(int delay)
Set the number of seconds to wait between drawing of traces.
Definition: scope.hpp:88
~scopeUnpacker()
Destructor.
Definition: scope.hpp:31
size_t numEvents
Definition: scope.hpp:191
int delay_
Definition: scope.hpp:198
bool running
Definition: scope.hpp:205
void StartACQ()
Star the run.
Definition: scope.hpp:97
int GetThreshLow()
Definition: scope.hpp:45
TGraph * graph
The TGraph for plotting traces.
Definition: scope.hpp:216
int SetMod(const unsigned int &mod)
Definition: scope.hpp:33
bool need_graph_update
The number of seconds to wait between drawing traces.
Definition: scope.hpp:200
int GetThreshHigh()
Definition: scope.hpp:47
int SetChan(const unsigned int &chan)
Definition: scope.hpp:35
void StopACQ()
Stop the run.
Definition: scope.hpp:94
std::deque< ChannelEvent * > chanEvents_
The buffer of waveforms to be plotted.
Definition: scope.hpp:210
virtual void FinalInitialization()
Definition: scope.hpp:148
unsigned int numAvgWaveforms_
Definition: scope.hpp:188
TH2F * hist
The histogram containing the waveform frequencies.
Definition: scope.hpp:220
int threshHigh_
Definition: scope.hpp:53
TF1 * cfdPol3
Definition: scope.hpp:218
bool acqRun_
Definition: scope.hpp:202
TF1 * cfdPol2
Definition: scope.hpp:219
void SetThreshLow(const int &threshLow)
Definition: scope.hpp:37
void SetNumEvents(size_t num_)
Set the maximum number of events to store.
Definition: scope.hpp:91
size_t GetNumEvents()
Return the maximum number of events to store.
Definition: scope.hpp:85
unsigned int mod_
The module of the signal of interest.
Definition: scope.hpp:50
scopeUnpacker(const unsigned int &mod=0, const unsigned int &chan=0)
Default constructor.
Definition: scope.cpp:70
bool singleCapture_
Definition: scope.hpp:203
virtual void RawStats(XiaData *event_, ScanInterface *addr_=NULL)
Definition: scope.hpp:66
TProfile * prof
The profile of the average histogram.
Definition: scope.hpp:221
std::vector< int > x_vals
Definition: scope.hpp:209
Unpacker * GetCore()
Return a pointer to a new Filterer object.
Definition: filterer.hpp:116
int fitHigh_
Definition: scope.hpp:197
virtual bool InitRootOutput(std::string fname_, bool overwrite_=true)
Definition: scope.hpp:155
A pixie16 channel event.
Definition: XiaData.hpp:19
A class to handle the unpacking of UTK/ORNL style pixie16 data spills.
bool performFit_
Definition: scope.hpp:206
bool resetGraph_
Set to true if the graph range needs updated.
Definition: scope.hpp:201
float cfdF_
The number of waveforms to store.
Definition: scope.hpp:193
virtual void ProcessRawEvent(ScanInterface *addr_=NULL)
Definition: scope.cpp:81
unsigned int num_displayed
The number of displayed traces.
Definition: scope.hpp:189
std::string saveFile_
The name of the file to save a trace.
Definition: scope.hpp:214
int threshLow_
Definition: scope.hpp:52
unsigned int GetMod()
Definition: scope.hpp:41
bool init
Definition: scope.hpp:204
int fitLow_
Definition: scope.hpp:196
unsigned int chan_
The channel of the signal of interest.
Definition: scope.hpp:51
void SetThreshHigh(const int &threshHigh)
Definition: scope.hpp:39