CFEL - ASG Software Suite  2.5.0
CASS
signal_producer.h
Go to the documentation of this file.
1 //Copyright (C) 2010 Lutz Foucar
2 
3 /**
4  * @file signal_producer.h file contains the classes that describe how to
5  * analyze the waveform and stores the result.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef _SIGNAL_H_
11 #define _SIGNAL_H_
12 
13 #include <algorithm>
14 #include <tr1/memory>
15 #include <map>
16 #include <vector>
17 #include <string>
18 
19 namespace cass
20 {
21 //forward declaration
22 class CASSSettings;
23 class CASSEvent;
24 
25 namespace ACQIRIS
26 {
27 class SignalExtractor;
28 
29 /** A Signal Producer.
30  *
31  * This class describes all signal producing elements of a detector. It
32  * contains an extractor for the produced signals from the event and a list
33  * of the signals it produced.
34  *
35  * User settable parameters via CASS.ini
36  * - general access to these parameters depends on the detector type:
37  * - In Delaylinedetectors its for
38  * - MCP: AcqirisDetectors/%detectorname%/MCP
39  * - Layers Wireends: AcqirisDetectors/%detectorname%/%Layername%/%Wireendname%
40  * - In TofDetectors: AcqirisDetectors/%detectorname%/MCP
41  *
42  * Then the specific settings for these objects are:
43  * @cassttng .../{SignalExtractionMethod}\n
44  * the method type that will be used to extract the signals from
45  * the recorded data. To see what options need to be set for the
46  * specific signalextraction methods description.
47  * There are the following options :
48  * - 0:com 8 bit waveform (see cass::ACQIRIS::CoM8Bit)
49  * - 1:com 16 bit waveform (see cass::ACQIRIS::CoM8Bit)
50  * - 2:cfd 8 bit waveform (see cass::ACQIRIS::CFD8Bit)
51  * - 3:cfd 16 bit waveform (see cass::ACQIRIS::CFD8Bit)
52  * - 4:tdc data extractor (see cass::ACQIRISTDC::TDCExtractor)
53  * @cassttng .../{GoodRangeLow|GoodRangeHigh}\n
54  * The lower an upper boundaries of the range where good single
55  * hits appear in. Default is 0.
56  *
57  * @author Lutz Foucar
58  */
60 {
61 public:
62  typedef std::vector<double> signal_t;
63  typedef std::vector<signal_t> signals_t;
64 
65 public:
66  /** default constructor */
68  :_goodHit(0),
69  _newEventAssociated(false),
70  _goodHitExtracted(false)
71  {}
72 
73 public:
74  /** loads the settings.
75  *
76  * will load the the requested SignalExtractor by calling
77  * SignalExtractor::instance(). And then loads its settings. Please refer
78  * the the chosen signal extractors loadSettings memeber for further
79  * information.\n
80  * See class describtion for the type of signalextractor that can be
81  * chosen.
82  *
83  * @param s the CASSSettings object we retrieve the data from
84  */
85  void loadSettings(CASSSettings &s);
86 
87  /** assciate the event with this signalproducer
88  *
89  * resets the _newEventAssociated flag to true, clears the _signals vector
90  * and associates the event with the signalextractor. See the signal
91  * extractors associate() member function for further information.
92  *
93  * @param evt the event that we need to associate with the signalextractor
94  */
95  void associate(const CASSEvent& evt);
96 
97 public:
98  /** returns the time of the first peak in the time range
99  *
100  * when the _newEventAssociated flag is true it will look for the first
101  * signal whos time is in the requested time range. If there is no signal
102  * in the requested timerange the value is set to 0.
103  *
104  * @return time of the first singal in the requested timerange
105  * @param range the timerange to search for the signal
106  */
107  double firstGood(const std::pair<double,double>& range);
108 
109  /** returns the time of the first peak in the time range
110  *
111  * when the _newEventAssociated flag is true it will look for the first
112  * signal whos time is in the requested time range. If there is no signal
113  * in the requested timerange the value is set to 0. It will use the range
114  * that is set inside.
115  *
116  * @return the time of the first good peak
117  */
118  double firstGood();
119 
120  /** return the signals
121  *
122  * When a new event was associated with this prodcuer, then it will first
123  * extract all signals from the event data otherwise it will just return
124  * the signals. It will extract the events from the data with the help of
125  * the _singalExtractor object that this class owns. This is done by
126  * calling the singalextractos operator().
127  *
128  * @note the output of a signal producer are the singals. Unfortunately
129  * if we call this function signals it will not compile anymore.
130  *
131  * @return reference to the singals of this signalproducer
132  */
133  signals_t& output();
134 
135 private:
136  /** time of the first peak in the "good" range*/
137  double _goodHit;
138 
139  /** the extractor of the produced signals */
140  std::tr1::shared_ptr<SignalExtractor> _signalextractor;
141 
142  /** the signals produces by this producer */
143  signals_t _signals;
144 
145  /** flag to show whether there is a new event associated whith this signal producer */
147 
148  /** flag to show whether the first good hit has been extracted */
150 
151  /** the range in which the good hits will appear */
152  std::pair<double, double> _range;
153 };
154 }//end namespace acqiris
155 }//end namespace cass
156 
157 
158 #endif
Event to store all LCLS Data.
Definition: cass_event.h:32
std::vector< signal_t > signals_t
bool _goodHitExtracted
flag to show whether the first good hit has been extracted
Settings for CASS.
Definition: cass_settings.h:30
double firstGood()
returns the time of the first peak in the time range
bool _newEventAssociated
flag to show whether there is a new event associated whith this signal producer
std::tr1::shared_ptr< SignalExtractor > _signalextractor
the extractor of the produced signals
std::vector< double > signal_t
void loadSettings(CASSSettings &s)
loads the settings.
signals_t _signals
the signals produces by this producer
void associate(const CASSEvent &evt)
assciate the event with this signalproducer
std::pair< double, double > _range
the range in which the good hits will appear
double _goodHit
time of the first peak in the "good" range
signals_t & output()
return the signals
SignalProducer()
default constructor