39 typedef std::pair<sigIt_t,sigIt_t>
range_t;
48 struct isInRange : std::unary_function<signal_t,bool>
56 isInRange(
double mcp,
double timesum,
double maxruntime)
57 :_mcp(mcp),_timesum(timesum),_maxruntime(maxruntime)
69 return fabs(2.*sig[
time] - 2.*_mcp - _timesum) <= _maxruntime;
98 pair<sigIt_t,sigIt_t>
getSignalRange(signals_t &sigs,
const double mcp,
const double ts,
const double rTime)
100 sigIt_t begin (find_if(sigs.begin(),sigs.end(),
isInRange(mcp,ts,rTime)));
101 sigIt_t end (find_if(begin, sigs.end(),not1(
isInRange(mcp,ts,rTime))));
102 return (make_pair(begin,end));
113 typedef signals_t::iterator
sigIt_t;
114 typedef std::pair<sigIt_t,sigIt_t>
range_t;
122 for (sigIt_t iMcp (mcpsignals.begin());iMcp != mcpsignals.end() ;++iMcp)
126 const double mcp ((*iMcp)[
time]);
127 range_t f1range(
getSignalRange(f1signals,mcp,_ts.first,_runtime));
128 range_t f2range(
getSignalRange(f2signals,mcp,_ts.first,_runtime));
129 range_t s1range(
getSignalRange(s1signals,mcp,_ts.second,_runtime));
130 range_t s2range(
getSignalRange(s2signals,mcp,_ts.second,_runtime));
131 for (sigIt_t iF1 (f1range.first);iF1!=f1range.second;++iF1)
135 for (sigIt_t iF2 (f2range.first);iF2!=f2range.second;++iF2)
139 for (sigIt_t iS1 (s1range.first);iS1!=s1range.second;++iS1)
143 for (sigIt_t iS2 (s2range.first);iS2!=s2range.second;++iS2)
148 const double mcp ((*iMcp)[time]);
150 const double f1 ((*iF1)[time]);
151 const double f2 ((*iF2)[time]);
152 const double s1 ((*iS1)[time]);
153 const double s2 ((*iS2)[time]);
154 const double sumf (f1+f2 - 2.* mcp);
155 const double sums (s1+s2 - 2.* mcp);
156 const double f((f1-f2) * _sf.first);
157 const double s((s1-s2) * _sf.second);
159 const pair<double,double> pos ((*_poscalc)(make_pair(f,s)));
161 const double radius (sqrt(pos.first*pos.first + pos.second*pos.second));
163 if ( (sumf > _tsrange.first.first) && (sumf < _tsrange.first.second) )
165 if ( (sums > _tsrange.second.first) && (sums < _tsrange.second.second) )
167 if (radius < _mcpRadius)
172 hit[
t] = (*iMcp)[
time];
192 enum LayerComb{xy,uv,uw,vw};
195 (static_cast<DelaylineType>(s.
value(
"DelaylineType",
Hex).toInt()));
198 LayerComb lc (static_cast<LayerComb>(s.
value(
"LayersToUse",xy).toInt()));
199 if ((lc == xy) && (delaylinetype ==
Hex))
200 throw invalid_argument(
"DelaylineDetectorAnalyzerSimple::loadSettings: Error using layers xy for Hex-Detector");
201 if ((delaylinetype ==
Quad) && (lc == uv || lc == uw || lc == vw))
202 throw invalid_argument(
"DelaylineDetectorAnalyzerSimple::loadSettings: Error using layers uv, uw or vw for Quad-Detector");
207 _layerCombination = make_pair(make_pair(&d.
layers()[
'X'].wireends()[
'1'],
208 &d.
layers()[
'X'].wireends()[
'2']),
209 make_pair(&d.
layers()[
'Y'].wireends()[
'1'],
210 &d.
layers()[
'Y'].wireends()[
'2']));
211 _poscalc = std::tr1::shared_ptr<PositionCalculator>(
new XYCalc);
214 _layerCombination = make_pair(make_pair(&d.
layers()[
'U'].wireends()[
'1'],
215 &d.
layers()[
'U'].wireends()[
'2']),
216 make_pair(&d.
layers()[
'V'].wireends()[
'1'],
217 &d.
layers()[
'V'].wireends()[
'2']));
218 _poscalc = std::tr1::shared_ptr<PositionCalculator>(
new UVCalc);
221 _layerCombination = make_pair(make_pair(&d.
layers()[
'U'].wireends()[
'1'],
222 &d.
layers()[
'U'].wireends()[
'2']),
223 make_pair(&d.
layers()[
'W'].wireends()[
'1'],
224 &d.
layers()[
'W'].wireends()[
'2']));
225 _poscalc = std::tr1::shared_ptr<PositionCalculator>(
new UWCalc);
228 _layerCombination = make_pair(make_pair(&d.
layers()[
'V'].wireends()[
'1'],
229 &d.
layers()[
'V'].wireends()[
'2']),
230 make_pair(&d.
layers()[
'W'].wireends()[
'1'],
231 &d.
layers()[
'W'].wireends()[
'2']));
232 _poscalc = std::tr1::shared_ptr<PositionCalculator>(
new VWCalc);
240 _tsrange = make_pair(make_pair(s.
value(
"TimesumFirstLayerLow",0).toDouble(),
241 s.
value(
"TimesumFirstLayerHigh",200).toDouble()),
242 make_pair(s.
value(
"TimesumSecondLayerLow",0).toDouble(),
243 s.
value(
"TimesumSecondLayerHigh",200).toDouble()));
244 _ts = make_pair(0.5*(_tsrange.first.first + _tsrange.first.second),
245 0.5*(_tsrange.second.first + _tsrange.second.second));
246 _sf = make_pair(s.
value(
"ScalefactorFirstLayer",0.4).toDouble(),
247 s.
value(
"ScalefactorSecondLayer",0.4).toDouble());
248 _runtime = s.
value(
"Runtime",150).toDouble();
249 _mcpRadius = s.
value(
"McpRadius",88).toDouble();
std::vector< double > detectorHit_t
define a detector hit
contains classes for calculating the position in a DLD
SignalProducer::signals_t signals_t
typedefs for shorter code
file contains the classes that describe how to analyze the waveform and stores the result...
std::vector< signal_t > signals_t
isInRange(double mcp, double timesum, double maxruntime)
constructor
position calculator for hex anodes u and v layer
pair< sigIt_t, sigIt_t > getSignalRange(signals_t &sigs, const double mcp, const double ts, const double rTime)
return range of possible anode wire signal candidates
file contains the classes that describe an acqiris channel
std::vector< detectorHit_t > detectorHits_t
define container for all detector hits
define which of the hitfinders defined above will be used as hit
Average out the iShit status to get the avererage hits
position calculator for hex anodes u and v layer
std::pair< sigIt_t, sigIt_t > range_t
typedefs for shorter code
SignalProducer & mcp()
retrieve the mcp
file contains the classes that describe a delayline detector.
std::vector< double > signal_t
detectorHits_t & operator()(detectorHits_t &hits)
the function creating the detectorhit list
anodelayers_t & layers()
return the layers
DelaylineType
the types of delayline detectors that are available
file contains the declaration of classes that analyzses a delayline detector.
double _maxruntime
the time it takes the signal to run across the anode
file contains declaration of classes and functions that help other processors to do their job...
check whether anode end wire signal is correleated to mcp signal
bool fuzzyIsNull(const T &val)
fuzzy compare a floating point number to 0
signals_t::iterator sigIt_t
typedefs for shorter code
void loadSettings(CASSSettings &s, DelaylineDetector &d)
load the detector analyzers settings from .ini file
double _timesum
the timesum of the anode layer
value(const QString &key, const QVariant &defaultValue=QVariant()
position calculator for hex anodes u and w layer
bool operator()(const signal_t &sig) const
check correlation
file contains specialized class that do the settings for cass
position calculator for quad anode
beginGroup(const QString &prefix)
double _mcp
the time of the mcp signal
SignalProducer::signal_t signal_t
typedefs for shorter code