PAASS
Software suite to Acquire and Analyze Data from Pixie16
filterer.hpp
Go to the documentation of this file.
1 #ifndef FILTERER_HPP
2 #define FILTERER_HPP
3 
4 #include <ctime>
5 #include <vector>
6 #include <cmath>
7 
8 #include "Unpacker.hpp"
9 
10 class ChannelEvent;
11 class TApplication;
12 class TCanvas;
13 class TGraph;
14 
15 class Filterer : public Unpacker{
16  private:
17  int mod_;
18  int chan_;
19  bool acqRun_;
23 
24  unsigned int trig_rise;
25  unsigned int trig_flat;
26  unsigned int energy_rise;
27  unsigned int energy_flat;
28 
29  float *fast_filter_y;
30  float *slow_filter_y;
31 
33 
34  int delay_;
35 
36  std::vector<int> x_vals;
37 
39 
40  time_t last_trace;
41 
42  unsigned int num_traces;
43 
44  unsigned int num_displayed;
45 
46  TApplication *rootapp;
47 
48  TCanvas *canvas;
49 
50  TGraph *graph;
51  TGraph *f_fast;
52  TGraph *f_slow;
53 
54  void ResetGraph(unsigned int size_);
55 
56  void Filter(float *trace_, const size_t &length_, float *filtered1, const unsigned int &risetime_, const unsigned int &flattop_);
57 
59  void Plot(ChannelEvent *event_);
60 
62  void ProcessRawEvent();
63 
64  public:
65  Filterer(int mod = 0, int chan = 0);
66 
67  ~Filterer();
68 
69  bool Initialize(std::string prefix_="");
70 
71  int GetMod(){ return mod_; }
72 
73  int GetChan(){ return chan_; }
74 
75  int GetDelay(){ return delay_; }
76 
77  void SetMod(int mod){ mod_ = mod; }
78 
79  void SetChan(int chan){ chan_ = chan; }
80 
82  void SetDelay(int delay){ delay_ = (delay>1)?delay:1; }
83 
85  void SyntaxStr(const char *name_, std::string prefix_=""){ std::cout << prefix_ << "SYNTAX: " << std::string(name_) << " <options> <input>\n"; }
86 
88  void ArgHelp(std::string prefix_="");
89 
91  void CmdHelp(std::string prefix_="");
92 
94  bool SetArgs(std::deque<std::string> &args_, std::string &filename_);
95 
97  void PrintStatus(std::string prefix_=""){ std::cout << prefix_ << "Found " << num_traces << " traces and displayed " << num_displayed << ".\n"; }
98 
103  bool CommandControl(std::string cmd_, const std::vector<std::string> &args_);
104 
106  void StopAcquisition();
107 
109  void StartAcquisition();
110 
112  virtual void IdleTask();
113 };
114 
116 Unpacker *GetCore(){ return (Unpacker*)(new Filterer()); }
117 
118 #endif
bool Initialize(std::string prefix_="")
Definition: filterer.cpp:228
int threshHigh_
Definition: filterer.hpp:22
~Filterer()
Definition: filterer.cpp:80
TCanvas * canvas
The main plotting canvas.
Definition: filterer.hpp:48
void Plot(ChannelEvent *event_)
Plot the current event.
Definition: filterer.cpp:114
bool SetArgs(std::deque< std::string > &args_, std::string &filename_)
Scan input arguments and set class variables.
Definition: filterer.cpp:265
void ProcessRawEvent()
Process all events in the event list.
Definition: filterer.cpp:165
void Filter(float *trace_, const size_t &length_, float *filtered1, const unsigned int &risetime_, const unsigned int &flattop_)
Definition: filterer.cpp:22
void StartAcquisition()
Scan has started data acquisition.
Definition: filterer.cpp:391
bool acqRun_
Definition: filterer.hpp:19
bool CommandControl(std::string cmd_, const std::vector< std::string > &args_)
Definition: filterer.cpp:293
void ResetGraph(unsigned int size_)
Definition: filterer.cpp:91
void ArgHelp(std::string prefix_="")
Print a command line help dialogue for recognized command line arguments.
Definition: filterer.cpp:240
unsigned int num_traces
The total number of traces.
Definition: filterer.hpp:42
TApplication * rootapp
Root application pointer.
Definition: filterer.hpp:46
unsigned int energy_flat
Set the slow filter risetime. Analogous to setting ENERGY_RISETIME.
Definition: filterer.hpp:27
bool need_graph_update
Definition: filterer.hpp:32
virtual void IdleTask()
Perform tasks when waiting for a spill.
Definition: filterer.cpp:395
std::vector< int > x_vals
The number of seconds to wait between drawing traces.
Definition: filterer.hpp:36
int GetMod()
Definition: filterer.hpp:71
int threshLow_
Definition: filterer.hpp:21
int chan_
The channel of the signal of interest.
Definition: filterer.hpp:18
Filterer(int mod=0, int chan=0)
Definition: filterer.cpp:46
bool resetGraph_
Definition: filterer.hpp:38
int GetDelay()
Definition: filterer.hpp:75
TGraph * graph
The TGraph for plotting traces.
Definition: filterer.hpp:50
TGraph * f_fast
The TGraph for plotting the fast filter.
Definition: filterer.hpp:51
TGraph * f_slow
The TGraph for plotting the slow filter.
Definition: filterer.hpp:52
void SetDelay(int delay)
Set the number of seconds to wait between drawing of traces.
Definition: filterer.hpp:82
void CmdHelp(std::string prefix_="")
Print an in-terminal help dialogue for recognized commands.
Definition: filterer.cpp:249
void PrintStatus(std::string prefix_="")
Print a status message.
Definition: filterer.hpp:97
bool singleCapture_
Definition: filterer.hpp:20
unsigned int num_displayed
The number of displayed traces.
Definition: filterer.hpp:44
void StopAcquisition()
Scan has stopped data acquisition.
Definition: filterer.cpp:386
void SyntaxStr(const char *name_, std::string prefix_="")
Return the syntax string for this program.
Definition: filterer.hpp:85
time_t last_trace
The time of the last trace.
Definition: filterer.hpp:40
Unpacker * GetCore()
Return a pointer to a new Filterer object.
Definition: filterer.hpp:116
float * slow_filter_y
Definition: filterer.hpp:30
unsigned int trig_flat
Set the fast filter length. Analogous to setting TRIGGER_RISETIME.
Definition: filterer.hpp:25
void SetMod(int mod)
Definition: filterer.hpp:77
int mod_
The module of the signal of interest.
Definition: filterer.hpp:17
int GetChan()
Definition: filterer.hpp:73
A class to handle the unpacking of UTK/ORNL style pixie16 data spills.
unsigned int energy_rise
Set the fast filter gap. Analogous to setting TRIGGER_FLATTOP.
Definition: filterer.hpp:26
float * fast_filter_y
Set the slow filter gap. Analogous to setting ENERGY_FLATTOP.
Definition: filterer.hpp:29
unsigned int trig_rise
Definition: filterer.hpp:24
int delay_
Set to true if the graph range needs updated.
Definition: filterer.hpp:34
void SetChan(int chan)
Definition: filterer.hpp:79