15 #include "resort64c.h"
30 namespace AchimCalibrator
49 const int size (profile.number_of_columns);
50 for (
int i = 0; i <
size; ++i)
54 (profile.get_bin_center_x(static_cast<double>(i)));
55 const double cor (profile.get_y(i));
82 shared_ptr<sum_walk_calibration_class> tsum_calibrator,
83 shared_ptr<scalefactors_calibration_class> scalefactor_calibrator)
85 tsum_calibrator->generate_sum_walk_profiles();
86 if (tsum_calibrator->sumu_profile)
92 if (tsum_calibrator->sumv_profile)
98 if (tsum_calibrator->sumw_profile)
104 scalefactor_calibrator->
105 do_auto_calibration(s.
value(
"WLayerOffset",0).toDouble());
106 s.
setValue(
"ScalefactorV",scalefactor_calibrator->best_fv);
107 s.
setValue(
"ScalefactorW",scalefactor_calibrator->best_fw);
108 s.
setValue(
"WLayerOffset",scalefactor_calibrator->best_w_offset);
119 void shift_sum(vector<double> &values,
const vector<pair<double,double> > &sums)
146 const pair<double,double> ¢er,
147 const vector<double> &scalefactors)
152 (0.25*(center.first - center.second *sqrt(3))/scalefactors[
HexCalibrator::v]);
154 (0.25*(center.first + center.second *sqrt(3))/scalefactors[
HexCalibrator::w]);
179 const double w_offset_shift = direction * w_offset * 0.5;
180 w1 += w_offset_shift;
181 w2 -= w_offset_shift;
190 _timesums(3,make_pair(0,0)),
206 _ratio = settings.
value(
"RatioFullBins",0.9).toDouble();
211 throw invalid_argument(
"HexCalibrator::loadSettings: Error The Hex-Sorter cannot work on '" +
212 d.
name() +
"' which is not a Hex Detector.");
220 s.
value(
"TimeSumUWidth",0).toDouble());
221 _timesums[
v] = make_pair(s.
value(
"TimeSumV",100).toDouble(),
222 s.
value(
"TimeSumVWidth",0).toDouble());
223 _timesums[
w] = make_pair(s.
value(
"TimeSumW",100).toDouble(),
224 s.
value(
"TimeSumWWidth",0).toDouble());
226 s.
value(
"CenterY",0).toDouble());
236 _scalefactors[
v] = hexsettings.
value(
"ScalefactorV",1).toDouble();
237 _scalefactors[
w] = hexsettings.
value(
"ScalefactorW",1).toDouble();
240 shared_ptr<sum_walk_calibration_class>(
new sum_walk_calibration_class(49,
true,
_maxRuntime,0.1));
242 shared_ptr<scalefactors_calibration_class>(
new scalefactors_calibration_class(
true,
258 vector<double> values(7);
260 values[
u1] = d.
layers()[
'U'].wireends()[
'1'].firstGood();
261 values[
u2] = d.
layers()[
'U'].wireends()[
'2'].firstGood();
262 values[
v1] = d.
layers()[
'V'].wireends()[
'1'].firstGood();
263 values[
v2] = d.
layers()[
'V'].wireends()[
'2'].firstGood();
264 values[
w1] = d.
layers()[
'W'].wireends()[
'1'].firstGood();
265 values[
w2] = d.
layers()[
'W'].wireends()[
'2'].firstGood();
267 vector<double> layer(3);
268 layer[
u] = values[
u1] - values[
u2];
269 layer[
v] = values[
v1] - values[
v2];
270 layer[
w] = values[
w1] - values[
w2];
272 vector<bool> layerChecksum(3);
281 if (layerChecksum[
u] && layerChecksum[
v] && layerChecksum[
w])
CachedList::item_type result_t
define the results
Event to store all LCLS Data.
virtual void createHistList(result_t::shared_pointer result)
create result list.
direction
enum for easier code
std::tr1::shared_ptr< scalefactors_calibration_class > _scalefactor_calibrator
pointer to scalfactor calibrator
const name_t name() const
retrieve the name of this processor
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
std::vector< double > _scalefactors
the scalefactors
file contains class that uses achims calibration capabilities
QString _groupname
the group name of the cass settings for this calibrator
void shift_wLayer(double &w1, double &w2, const double w_offset)
shift the w-layer
things written only at end of run H5Dump ProcessorSummary size
beginWriteArray(const QString &prefix, int size=-1)
SignalProducer & mcp()
retrieve the mcp
setValue(const QString &key, const QVariant &value)
static void add(Level level, const std::string &line)
add a string to the log
void setValue(const_reference value)
assign the result container to a value
std::pair< double, double > _center
the center of the image
fromStdString(const std::string &str)
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
std::string _calibrationFilename
the .ini filename for the sorting information
anodelayers_t & layers()
return the layers
base class for processors.
std::vector< std::pair< double, double > > _timesums
the timesums and their width
file contains declaration of classes and functions that help other processors to do their job...
double _maxRuntime
the maximum runtime
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
std::string loadDelayDet(CASSSettings &s, int ppNbr, const std::string &key)
load detector from file
value(const QString &key, const QVariant &defaultValue=QVariant()
const std::string name() const
return the detector name
double _wLayerOffset
the w-layer offset
bool isHex() const
retrieve the anode type property
void loadSettings(size_t)
load the detector analyzers settings from .ini file
double firstGood(const std::pair< double, double > &range)
returns the time of the first peak in the time range
void setupGeneral()
general setup of the processor
double _ratio
the ratio to check whether the calibration can be started
void writeCalibData(QSettings &s, shared_ptr< sum_walk_calibration_class > tsum_calibrator, shared_ptr< scalefactors_calibration_class > scalefactor_calibrator)
write all calibration data into an ini file
std::tr1::shared_ptr< sum_walk_calibration_class > _tsum_calibrator
the time sum calibrator
void writeProfileData(QSettings &s, profile_class &profile)
write the profile part of calibration data into an ini file
file contains specialized class that do the settings for cass
Base class for all Detectors attached to an Acqiris Instrument.
shared_pointer _condition
pointer to the processor that will contain the condition
void shift_sum(vector< double > &values, const vector< pair< double, double > > &sums)
shift the values so that the timesum peaks around 0
void shift_pos(vector< double > &layer, const pair< double, double > ¢er, const vector< double > &scalefactors)
shift the position
bool setupCondition(bool defaultConditionType=true)
setup the condition.
std::string name_t
define the name type
contains a logger for cass
beginGroup(const QString &prefix)