CFEL - ASG Software Suite  2.5.0
CASS
commonmode_calculator_base.h
Go to the documentation of this file.
1 // Copyright (C) 2011 Lutz Foucar
2 
3 /**
4  * @file commonmode_calculator_base.h contains base class for all common mode
5  * calculators.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef _COMMONMODECALCULATORBASE_H_
11 #define _COMMONMODECALCULATORBASE_H_
12 
13 #include <tr1/memory>
14 
15 #include "pixeldetector.hpp"
16 
17 namespace cass
18 {
19 class CASSSettings;
20 
21 namespace pixeldetector
22 {
23 //forward declaration//
24 struct Frame;
25 class CommonData;
26 
27 namespace commonmode
28 {
29 /** base class for all common mode calculators
30  *
31  * the calculators determine the common mode of the a user defined part of the
32  * row and return the value for correcting the frame.
33  *
34  * @cassttng PixelDetectors/\%name\%/HLLProcessing/CommonModeCorrection/{Width}\n
35  * How many pixels shoudl be included in the common mode correction.
36  * The width of one Camex is 128 pixels. Sometimes it is better to
37  * to calculate the common mode from the entire quadrant in which case
38  * it should be 512. Default is 128.
39  * @cassttng PixelDetectors/\%name\%/HLLProcessing/CommonModeCorrection/{Multiplier}\n
40  * When suppressing pixels in the common mode calculation that contain
41  * photons this is the multiplier that should be added to the noise
42  * before checking for photons. Default is 4
43  *
44  * @author Lutz Foucar
45  */
47 {
48 public:
49  /** typedef the shared pointer of this */
50  typedef std::tr1::shared_ptr<CalculatorBase> shared_pointer;
51 
52  /** virtual destructor */
53  virtual ~CalculatorBase() {}
54 
55  /** create an instance of the requested functor
56  *
57  * @return a shared pointer to the requested type
58  * @param type the reqested type
59  */
60  static shared_pointer instance(const std::string &type);
61 
62  /** determine the common mode value
63  *
64  * calculate the common mode from the given index on.
65  *
66  * @return the common mode value
67  * @param pixel the start pixel within the frame to start the common mode
68  * calculation
69  * @param idx index where the pixel iterator is right now within the frame
70  */
71  virtual Detector::pixel_t operator() (Detector::frame_t::const_iterator pixel, size_t idx)const=0;
72 
73  /** load the settings of this calculator
74  *
75  * @param s the CASSSettings object to read the information from
76  */
77  virtual void loadSettings(CASSSettings &s)=0;
78 
79  /** load all common settings
80  *
81  * @param s the CASSSettings object to read the information from
82  */
83  void load(CASSSettings &s);
84 
85  /** retrieve the number of pixels (or the width of calculation */
86  size_t width()const {return _nbrPixels;}
87 
88 protected:
89  /** the commonly used data container */
90  std::tr1::shared_ptr<CommonData> _commondata;
91 
92  /** how many pixels should be used for calculating the common mode */
93  size_t _nbrPixels;
94 
95  /** the multiplier to identify pixels that contain information */
96  float _multiplier;
97 };
98 
99 } //end namespace commonmode
100 } //end namespace pixeldetector
101 } //end namespace cass
102 #endif
std::tr1::shared_ptr< CalculatorBase > shared_pointer
typedef the shared pointer of this
Settings for CASS.
Definition: cass_settings.h:30
float pixel_t
define a pixel of the pixel detector
size_t _nbrPixels
how many pixels should be used for calculating the common mode
size_t width() const
retrieve the number of pixels (or the width of calculation
virtual void loadSettings(CASSSettings &s)=0
load the settings of this calculator
void load(CASSSettings &s)
load all common settings
float _multiplier
the multiplier to identify pixels that contain information
static shared_pointer instance(const std::string &type)
create an instance of the requested functor
contains container for simple pixel detector data
virtual Detector::pixel_t operator()(Detector::frame_t::const_iterator pixel, size_t idx) const =0
determine the common mode value
int16_t pixel
define a pixel
Definition: hlltypes.hpp:27
base class for all common mode calculators
std::tr1::shared_ptr< CommonData > _commondata
the commonly used data container