CFEL - ASG Software Suite  2.5.0
CASS
achimcalibrator_hex.h
Go to the documentation of this file.
1 // Copyright (C) 2008-2011 Lutz Foucar
2 
3 /**
4  * @file achimcalibrator_hex.h file contains class that uses achims calibration
5  * capabilities
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef _ACHIMCALIBRATOR_HEX_H_
11 #define _ACHIMCALIBRATOR_HEX_H_
12 
13 #include <tr1/memory>
14 #include <vector>
15 #include <utility>
16 
17 #include <QtCore/QMutex>
18 #include <QtCore/QString>
19 
20 #include "processor.h"
22 #include "delayline_detector.h"
23 
24 class sum_walk_calibration_class;
25 class scalefactors_calibration_class;
26 class sort_class;
27 
28 namespace cass
29 {
30 /** Achims resort routine calibrator
31  *
32  * @PPList "170": Hex Delayline Calibrator (see Hexcalibrator for parameters)
33  *
34  * this class will use achims resort routine capabilties to calibrate
35  * the timesum shift and the scalefactors. The Processor will return the
36  * current ratio of full bins.
37  *
38  * To set up the channel assignment for the requested detector one needs to set
39  * up the detector parameters.
40  * @see cass::ACQIRIS::DelaylineDetector and
41  * cass::ACQIRIS::SignalProducer
42  *
43  * @cassttng Processor/\%name\%/{Detector}\n
44  * Name of the delayline detector that we work on. Default is "blubb"
45  * Speciality of this Processor is, that it will only work with
46  * hex Delayline detectors and the appropriate HexSorter. Make sure
47  * that all settings of the HexSorter are correctly set. See
48  * cass::ACQIRIS::HexSorter and cass::ACQIRIS::DelaylineDetector.
49  * @cassttng Processor/\%name\%/{RatioFullBins}\n
50  * The ratio of how many bins in the detector image have to be full
51  * before the calibration is started and the results written to the
52  * settingsfile.
53  *
54  * @author Lutz Foucar
55  */
57  : public Processor
58 {
59 public:
60  /** enum for accessing the vectors */
61  enum {mcp, u1, u2, v1, v2, w1, w2};
62  enum {u, v, w};
63 
64  /** constructor */
65  HexCalibrator(const name_t &name);
66 
67  /** create the calibration
68  *
69  * this won't extract the detector hits but rather just fill the
70  * calibrators with the values that they expect.
71  *
72  * In order to fill the scalefactor calibrator with only points that are
73  * meaningful we check first the time sum for the hit we want to include.
74  *
75  * After we filled we check whether we can already output the calibration
76  * data. We have enough when either we are told so or when the ratio is
77  * better than what the user set as limit. If so, create the a QSettings
78  * object that handles the ini file that will contain the calibration data.
79  * Extract the name of the .ini file from the settings for this calibrator.
80  *
81  * @param evt the event to work on
82  * @param res the histogram containing the result
83  */
84  void process(const CASSEvent& evt, result_t &res);
85 
86  /** load the detector analyzers settings from .ini file
87  *
88  * retrieve all necessary information to be able to calibrate the timesum
89  * and the scalefactors. Next to this remember the the groupname of the
90  * settings object, so that we later can use it to extract information
91  */
92  void loadSettings(size_t);
93 
94 private:
95  /** the time sum calibrator
96  *
97  * this will take the timesum and after a while it knows how to correct
98  * the timesum to be a straight line
99  */
100  std::tr1::shared_ptr<sum_walk_calibration_class> _tsum_calibrator;
101 
102  /** pointer to scalfactor calibrator
103  *
104  * this is a class that will help finding the scalefactor and the
105  * w-Layer offset of the Hex-Anode.
106  */
107  std::tr1::shared_ptr<scalefactors_calibration_class> _scalefactor_calibrator;
108 
109  /** the timesums and their width
110  *
111  * the order is as follows (first is always timesum and second
112  * the timesumwidth):
113  * - 0: u layer
114  * - 1: v layer
115  * - 2: w layer
116  */
117  std::vector<std::pair<double,double> > _timesums;
118 
119  /** the w-layer offset */
121 
122  /** the ratio to check whether the calibration can be started */
123  double _ratio;
124 
125  /** the group name of the cass settings for this calibrator */
127 
128  /** the .ini filename for the sorting information */
129  std::string _calibrationFilename;
130 
131  /** the center of the image */
132  std::pair<double,double> _center;
133 
134  /** the scalefactors
135  *
136  * the order in the array is given by the enums
137  */
138  std::vector<double> _scalefactors;
139 
140  /** the maximum runtime */
141  double _maxRuntime;
142 
143  /** The detector we are there for*/
144  ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector;
145 
146  /** flag to tell wether the calibration has been written already */
148 };
149 }//end namespace cass
150 #endif
CachedList::item_type result_t
define the results
Definition: processor.h:52
Event to store all LCLS Data.
Definition: cass_event.h:32
Achims resort routine calibrator.
std::tr1::shared_ptr< scalefactors_calibration_class > _scalefactor_calibrator
pointer to scalfactor calibrator
const name_t name() const
retrieve the name of this processor
Definition: processor.h:167
file contains declaration of classes that extract information of acqiris detectors.
std::vector< double > _scalefactors
the scalefactors
QString _groupname
the group name of the cass settings for this calibrator
file contains the classes that describe a delayline detector.
std::pair< double, double > _center
the center of the image
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
std::string _calibrationFilename
the .ini filename for the sorting information
base class for processors.
Definition: processor.h:39
std::vector< std::pair< double, double > > _timesums
the timesums and their width
double _maxRuntime
the maximum runtime
file contains processors baseclass declaration
bool _calibwritten
flag to tell wether the calibration has been written already
HexCalibrator(const name_t &name)
constructor
void process(const CASSEvent &evt, result_t &res)
create the calibration
double _wLayerOffset
the w-layer offset
void loadSettings(size_t)
load the detector analyzers settings from .ini file
double _ratio
the ratio to check whether the calibration can be started
std::tr1::shared_ptr< sum_walk_calibration_class > _tsum_calibrator
the time sum calibrator
std::string name_t
define the name type
Definition: processor.h:46