CFEL - ASG Software Suite  2.5.0
CASS
mapcreators_online.h
Go to the documentation of this file.
1 // Copyright (C) 2012 Lutz Foucar
2 
3 /**
4  * @file mapcreators_online.h contains correction map creators that work fast
5  * easy for online purposes.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef _MAPCREATORSONLINE_H_
11 #define _MAPCREATORSONLINE_H_
12 
13 #include <tr1/memory>
14 #include <tr1/functional>
15 #include <vector>
16 
17 #include "mapcreator_base.h"
19 
20 namespace cass
21 {
22 class CASSSettings;
23 
24 namespace pixeldetector
25 {
26 //forward declaration//
27 struct Frame;
28 class CommonData;
29 
30 /** Creates the maps fast and simple
31  *
32  * @MapCreateList "online": Uses a fast way to collect the frames and a fast and
33  * simple way to calculate the maps
34  *
35  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreator/{Multiplier}\n
36  * How much bigger does the pixel value have to be than the noise before
37  * The pixel is not taken into account when calculating the offset and
38  * noise of that pixel. Default is 4.
39  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreator/{NbrFrames}\n
40  * The number of frames that should be collected for calculating the
41  * maps. Default is 200.
42  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreator/{StartInstantly}\n
43  * Flag to tell whether the calculator should start instantly with
44  * collecting the frames and calculating the maps. If false it will
45  * wait until told by the program through the available GUI's. Default
46  * is false.
47  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreator/{WriteMaps}\n
48  * Tell the creator to write the calulated maps once they have been
49  * calculated. For further infomration on how the files are written,
50  * see cass::pixeldetector::CommonData. Default is true.
51  *
52  * @author Lutz Foucar
53  */
55 {
56 public:
57  /** the operator
58  *
59  * just calls the function that creates the map. This function is exchanged
60  * depending on whether the frames should be calculated or not.
61  *
62  * @param frame the frame to check for
63  */
64  void operator() (const Frame &frame) {_createMap(frame);}
65 
66  /** start accumulating the maps
67  *
68  * @param unused not used
69  */
70  void controlCalibration(const std::string& unused);
71 
72  /** load the settings of this creator
73  *
74  * @param s the CASSSettings object to read the information from
75  */
76  void loadSettings(CASSSettings &s);
77 
78 private:
79  /** the special storage type of this class */
80  typedef std::vector< std::vector<Detector::pixel_t> > specialstorage_t;
81 
82  /** a function that just returns and does nothing
83  *
84  * @param unused not used
85  */
86  void doNothing(const Frame& /*unused*/) {}
87 
88  /** build up storage and then calculate the maps
89  *
90  * @param frame the frame to build up the storage and to calc the maps from
91  */
92  void buildAndCalc(const Frame& frame);
93 
94  /** the container with all the maps */
95  std::tr1::shared_ptr<CommonData> _commondata;
96 
97  /** the function object that will be called by the operator */
98  std::tr1::function<void(const Frame&)> _createMap;
99 
100  /** storage where the pixels are already ordered */
101  specialstorage_t _specialstorage;
102 
103  /** how many frames should be collected before the maps are calculated */
104  size_t _nbrFrames;
105 
106  /** the multiplier to define the max noise before the pixel is considered to contain a photon */
108 
109  /** flag wether the create maps should be saved to file or just used */
111 
112  /** counter to keep track how many frames are collected */
114 };
115 
116 
117 
118 
119 /** Creates the maps fast and simple with commond mode correction
120  *
121  * Uses collects the user chosen nbr of frames and uses them to calculate the
122  * correction and noise maps. In addition it will correct the frames from the
123  * common mode noise.
124  *
125  * @MapCreateList "onlinecommonmode": same as online, but corrects the common mode
126  * from the frames when calculating the maps
127  *
128  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreatorCommonMode/{Multiplier}\n
129  * How much bigger does the pixel value have to be than the noise before
130  * The pixel is not taken into account when calculating the offset and
131  * noise of that pixel. Default is 4.
132  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreatorCommonMode/{NbrFrames}\n
133  * The number of frames that should be collected for calculating the
134  * maps. Default is 200.
135  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreatorCommonMode/{StartInstantly}\n
136  * Flag to tell whether the calculator should start instantly with
137  * collecting the frames and calculating the maps. If false it will
138  * wait until told by the program through the available GUI's. Default
139  * is false.
140  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreatorCommonMode/{WriteMaps}\n
141  * Tell the creator to write the calulated maps once they have been
142  * calculated. For further infomration on how the files are written,
143  * see cass::pixeldetector::CommonData. Default is true.
144  * @cassttng PixelDetectors/\%name\%/CorrectionMaps/FixedOnlineCreatorCommonMode/{CommonModeCalculationType}\n
145  * The type of commonmode calculation thats used to correct the common
146  * mode when trying to get rid of it. Default is "simpleMean". Possible
147  * values are:
148  * - "none": No common mode correction is done
149  * - "simpleMean": The common mode is calculated from the mean value
150  * Which is determined with a simple algorithm. See
151  * cass::pixeldetector::commonmode::SimpleMeanCalculator
152  * - "mean": The common mode is calculated from the mean value of the
153  * pixels. See cass::pixeldetector::commonmode::MeanCalculator
154  * - "median": The common mode is calculated from the median of the
155  * pixels. See
156  * cass::pixeldetector::commonmode::MedianCalculator for
157  * details.
158  *
159  * @author Lutz
160  */
162 {
163 public:
164  /** the operator
165  *
166  * just calls the function that creates the map. This function is exchanged
167  * depending on whether the frames should be calculated or not.
168  *
169  * @param frame the frame to check for
170  */
171  void operator() (const Frame &frame) {_createMap(frame);}
172 
173  /** start accumulating the maps
174  *
175  * @param unused not used
176  */
177  void controlCalibration(const std::string& unused);
178 
179  /** load the settings of this creator
180  *
181  * @param s the CASSSettings object to read the information from
182  */
183  void loadSettings(CASSSettings &s);
184 
185 private:
186 
187  /** a function that just returns and does nothing
188  *
189  * @param unused not used
190  */
191  void doNothing(const Frame& /*unused*/) {}
192 
193  /** build up storage and then calculate the maps
194  *
195  * @param frame the frame to build up the storage and to calc the maps from
196  */
197  void buildAndCalc(const Frame& frame);
198 
199  /** the container with all the maps */
200  std::tr1::shared_ptr<CommonData> _commondata;
201 
202  /** the function object that will be called by the operator */
203  std::tr1::function<void(const Frame&)> _createMap;
204 
205  /** storage where the pixels are already ordered */
207 
208  /** how many frames should be collected before the maps are calculated */
209  size_t _nbrFrames;
210 
211  /** the multiplier to define the max noise before the pixel is considered to contain a photon */
213 
214  /** flag wether the create maps should be saved to file or just used */
216 
217  /** counter to keep track how many frames are collected */
219 
220  /** functor for calculating the common mode level */
222 };
223 
224 
225 } //end namespace pixeldetector
226 } //end namespace cass
227 #endif
specialstorage_t _specialstorage
storage where the pixels are already ordered
std::vector< Detector::frame_t > storage_t
the type of storage used
void doNothing(const Frame &)
a function that just returns and does nothing
std::vector< std::vector< Detector::pixel_t > > specialstorage_t
the special storage type of this class
std::tr1::shared_ptr< CalculatorBase > shared_pointer
typedef the shared pointer of this
contains base class for all common mode calculators.
Settings for CASS.
Definition: cass_settings.h:30
void controlCalibration(const std::string &unused)
start accumulating the maps
contains base class for all correction map creators.
void operator()(const Frame &frame)
the operator
void loadSettings(CASSSettings &s)
load the settings of this creator
void loadSettings(CASSSettings &s)
load the settings of this creator
void operator()(const Frame &frame)
the operator
Creates the maps fast and simple with commond mode correction.
void buildAndCalc(const Frame &frame)
build up storage and then calculate the maps
std::tr1::shared_ptr< CommonData > _commondata
the container with all the maps
commonmode::CalculatorBase::shared_pointer _commonModeCalculator
functor for calculating the common mode level
size_t _framecounter
counter to keep track how many frames are collected
bool _writeMaps
flag wether the create maps should be saved to file or just used
Detector::pixel_t _multiplier
the multiplier to define the max noise before the pixel is considered to contain a photon ...
bool _writeMaps
flag wether the create maps should be saved to file or just used
Creates the maps fast and simple.
float pixel_t
define a pixel of the pixel detector
void controlCalibration(const std::string &unused)
start accumulating the maps
size_t _nbrFrames
how many frames should be collected before the maps are calculated
size_t _framecounter
counter to keep track how many frames are collected
std::tr1::function< void(const Frame &)> _createMap
the function object that will be called by the operator
Detector::pixel_t _multiplier
the multiplier to define the max noise before the pixel is considered to contain a photon ...
storage_t _storage
storage where the pixels are already ordered
size_t _nbrFrames
how many frames should be collected before the maps are calculated
std::tr1::shared_ptr< CommonData > _commondata
the container with all the maps
A Frame of an advance Pixel Detector.
base class for all correction map creators
void doNothing(const Frame &)
a function that just returns and does nothing
void buildAndCalc(const Frame &frame)
build up storage and then calculate the maps
std::tr1::function< void(const Frame &)> _createMap
the function object that will be called by the operator