15 #include "resort64c.h"
39 vector<double> &tdcarray(thePair.second);
42 SignalProducer::signals_t::const_iterator sigsIt(sigs.begin());
43 for (;sigsIt !=sigs.end(); ++sigsIt)
44 tdcarray.push_back((*sigsIt)[
time]);
55 _sorter(new sort_class()),
67 _sorter->TDC_resolution_ns = 0.1;
68 _sorter->tdc_array_row_length = 1000;
69 _sorter->dont_overwrite_original_data =
true;
70 _sorter->use_pos_correction =
false;
71 _sorter->common_start_mode =
true;
75 for (
size_t i=0;i<7;++i)
76 _sorter->tdc[i] = (
double*)(0x1);
83 for (
size_t i(0); i<7;++i)
95 int32_t nbrOfRecHits =
_sorter->sort();
97 for (
int i(0);i<nbrOfRecHits;++i)
100 hit[
x] =
_sorter->output_hit_array[i]->x;
101 hit[
y] =
_sorter->output_hit_array[i]->y;
102 hit[
t] =
_sorter->output_hit_array[i]->time;
113 throw invalid_argument(
"HexSorter::loadSettings: Error The Hex-Sorter cannot work on '" +
114 d.
name() +
"' which is not a Hex Detector.");
116 _signals.push_back(make_pair(&d.
mcp(),vector<double>()));
117 _signals.push_back(make_pair(&d.
layers()[
'U'].wireends()[
'1'],vector<double>()));
118 _signals.push_back(make_pair(&d.
layers()[
'U'].wireends()[
'2'],vector<double>()));
119 _signals.push_back(make_pair(&d.
layers()[
'V'].wireends()[
'1'],vector<double>()));
120 _signals.push_back(make_pair(&d.
layers()[
'V'].wireends()[
'2'],vector<double>()));
121 _signals.push_back(make_pair(&d.
layers()[
'W'].wireends()[
'1'],vector<double>()));
122 _signals.push_back(make_pair(&d.
layers()[
'W'].wireends()[
'2'],vector<double>()));
127 _sorter->uncorrected_time_sum_half_width_u = s.
value(
"TimeSumUWidth",0).toDouble();
128 _sorter->uncorrected_time_sum_half_width_v = s.
value(
"TimeSumVWidth",0).toDouble();
129 _sorter->uncorrected_time_sum_half_width_w = s.
value(
"TimeSumWWidth",0).toDouble();
133 _sorter->max_runtime = s.
value(
"MaxRuntime",130).toDouble();
134 _sorter->dead_time_anode = s.
value(
"DeadTimeAnode",20).toDouble();
135 _sorter->dead_time_mcp = s.
value(
"DeadTimeMCP",20).toDouble();
136 _sorter->MCP_radius = s.
value(
"MCPRadius",88).toDouble();
140 s.
value(
"CenterY",0).toDouble());
144 string settingsfilename (s.
value(
"SettingsFilename").toString().toStdString());
148 hexsettings.beginGroup(s.
group());
149 _sorter->fv = hexsettings.value(
"ScalefactorV",1).toDouble();
150 _sorter->fw = hexsettings.value(
"ScalefactorW",1).toDouble();
151 _wLayerOffset = hexsettings.value(
"WLayerOffset",0).toDouble();
152 int size = hexsettings.beginReadArray(
"SumUCorrectionPoints");
153 _sorter->use_sum_correction =
static_cast<bool>(
size);
154 for (
int i = 0; i<
size; ++i)
156 hexsettings.setArrayIndex(i);
160 set_point(hexsettings.value(
"Position").toDouble(),
161 hexsettings.value(
"Correction").toDouble());
163 hexsettings.endArray();
164 size = hexsettings.beginReadArray(
"SumVCorrectionPoints");
165 for (
int i = 0; i <
size; ++i)
167 hexsettings.setArrayIndex(i);
171 set_point(hexsettings.value(
"Position").toDouble(),
172 hexsettings.value(
"Correction").toDouble());
174 hexsettings.endArray();
175 size = hexsettings.beginReadArray(
"SumWCorrectionPoints");
176 for (
int i = 0; i <
size; ++i)
178 hexsettings.setArrayIndex(i);
182 set_point(hexsettings.value(
"Position").toDouble(),
183 hexsettings.value(
"Correction").toDouble());
185 hexsettings.endArray();
187 int error_code =
_sorter->init_after_setting_parameters();
190 char error_text[500];
191 _sorter->get_error_text(error_code,500,error_text);
192 throw invalid_argument(
"HexSorter::loadSettings: Error '" +
toString(error_code) +
193 "' while trying to initialize the sorter: '" + error_text +
"'");
std::vector< double > detectorHit_t
define a detector hit
std::vector< int32_t > _count
counter array for achims routine
std::vector< signal_t > signals_t
void loadSettings(CASSSettings &s, DelaylineDetector &d)
load the detector analyzers settings from .ini file
std::vector< double > _timesums
the timesums
void extactTimes(pair< SignalProducer *, vector< double > > &thePair)
extract times from signal producer
detectorHits_t & operator()(detectorHits_t &hits)
the function creating the detectorhit list
std::vector< detectorHit_t > detectorHits_t
define container for all detector hits
std::vector< std::pair< SignalProducer *, std::vector< double > > > _signals
container for tdc like arrays mapped to the corrosponding signalproducer
define which of the hitfinders defined above will be used as hit
Average out the iShit status to get the avererage hits
things written only at end of run H5Dump ProcessorSummary size
SignalProducer & mcp()
retrieve the mcp
fromStdString(const std::string &str)
anodelayers_t & layers()
return the layers
std::tr1::shared_ptr< sort_class > _sorter
the instance of Achims routine
file contains class that uses achims resort routine
std::string toString(const Type &t)
convert any type to a string
value(const QString &key, const QVariant &defaultValue=QVariant()
const std::string name() const
return the detector name
bool isHex() const
retrieve the anode type property
file contains specialized class that do the settings for cass
double _wLayerOffset
the w-layer offset
std::pair< double, double > _center
the center of the detector
beginGroup(const QString &prefix)
Base class for all detector analyzers.