38 enum ConditionType {tofcond, radcond, rectcond, tofradcond,tofrectcond};
58 static tr1::shared_ptr<IsParticleHit> instance(
const ConditionType& type);
78 return (_tofcond.first < dethit[
t] && dethit[
t] < _tofcond.second);
85 _tofcond = make_pair(s.
value(
"Low",0).toDouble(),
86 s.
value(
"High",20000).toDouble());
115 const double &xval (dethit[
x]);
116 const double &yval (dethit[
y]);
117 const double rad = sqrt((xval-_center.first)*(xval-_center.first) +
118 (yval-_center.second)*(yval-_center.second));
119 return (rad < _maxradius);
126 _center = make_pair(s.
value(
"CenterX",0).toDouble(),
127 s.
value(
"CenterY",0).toDouble());
128 _maxradius = s.
value(
"MaximumRadius",100).toDouble();
157 const double &xval (dethit[
x]);
158 const double &yval (dethit[
y]);
159 const bool checkX(_xrange.first < xval && xval < _xrange.second);
160 const bool checkY(_yrange.first < yval && yval < _yrange.second);
161 return (checkX && checkY);
168 _xrange = make_pair(s.
value(
"XLow",-10).toDouble(),
169 s.
value(
"XHigh",10).toDouble());
170 _yrange = make_pair(s.
value(
"YLow",-10).toDouble(),
171 s.
value(
"YHigh",10).toDouble());
194 template <
class FirstCondition,
class SecondCondition>
199 :_conditions(
std::make_pair(new FirstCondition, new SecondCondition))
208 return (firstCond(dethit) && secondCond(dethit));
213 _conditions.first->loadSettings(s);
214 _conditions.second->loadSettings(s);
223 std::tr1::shared_ptr<IsParticleHit> cond;
227 cond = std::tr1::shared_ptr<IsParticleHit>(
new TofCond);
230 cond = std::tr1::shared_ptr<IsParticleHit>(
new RadCond);
233 cond = std::tr1::shared_ptr<IsParticleHit>(
new RectCond);
242 throw invalid_argument(
"IsParticleHit::instance: Condition type '" +
243 toString(type) +
"' not available");
260 const double & xval (hit[
px]);
261 const double & yval (hit[
py]);
262 const double & zval (hit[
pz]);
263 double & rhoval (hit[
roh]);
264 double & thetaval (hit[
theta]);
265 double & phival (hit[
phi]);
266 rhoval = sqrt(xval*xval + yval*yval + zval*zval);
267 thetaval = atan2(yval,xval);
268 phival = acos(zval/rhoval);
276 _charge_au = s.
value(
"Charge",1).toDouble();
277 _mass_au = s.
value(
"Mass",1).toDouble();
278 _spectrometer.loadSettings(s,*
this);
279 _copyandcorrect.loadSettings(s);
280 if (!(_mass_au == 1 && _charge_au == -1))
285 _isParticleHit->loadSettings(s);
286 if (_spectrometer.BFieldIsOn())
290 if (_spectrometer.regions().size() > 1)
303 _listIsCreated =
true;
305 detectorHits_t::iterator dethit (detectorhits.begin());
306 for (; dethit != detectorhits.end(); ++dethit)
308 if (isParticleHit(*dethit))
314 hit[
e_au] = hit[
roh]*hit[
roh] / (2.*_mass_au);
316 _particlehits.push_back(hit);
320 return _particlehits;
325 _listIsCreated =
false;
326 _particlehits.clear();
std::vector< double > detectorHit_t
define a detector hit
void loadSettings(CASSSettings &s)
read the parameters of the condition from the .ini file
particleHits_t & hits()
retrieve the particle hits
base class for calculating momenta from a detector hit
a simple position condition
file contains the classes that calculate the momenta of particles from their detector hits...
bool operator()(const detectorHit_t &dethit) const
the comparison
a combination of conditions
a Time of Flight condition
std::vector< detectorHit_t > detectorHits_t
define container for all detector hits
define which of the hitfinders defined above will be used as hit
bool operator()(const detectorHit_t &dethit) const
the comparison
void kartesian2polar(particleHit_t &hit)
convert kartesian coordinates to polar coordinates
a radius position condition
file contains the classes that describe a delayline detector.
std::vector< double > particleHit_t
define a particle hit
base class of conditions for finding the right particle
static std::tr1::shared_ptr< MomentumCalculator > instance(const MomCalcType &type)
create instance of requested type
std::pair< double, double > _center
the center of the radius
std::string toString(const Type &t)
convert any type to a string
std::pair< double, double > _xrange
the range in x
std::pair< IsParticleHit *, IsParticleHit * > _conditions
static tr1::shared_ptr< IsParticleHit > instance(const ConditionType &type)
create an instance of the chosen class
value(const QString &key, const QVariant &defaultValue=QVariant()
void loadSettings(CASSSettings &s)
load the settings from .ini file
void loadSettings(CASSSettings &s)
read the parameters of the condition from the .ini file
bool operator()(const detectorHit_t &dethit) const
the comparison
std::pair< double, double > _tofcond
the tof range
void loadSettings(CASSSettings &s, CFDParameters &p, uint32_t &instrument, size_t &channelNbr)
implementation of loading settings for both CFD classes
file contains specialized class that do the settings for cass
double _maxradius
the maximum radius of the condtion
void associate(DelaylineDetector *detector)
tell which are the detector hits to search through
file contains the classes that describe a particle that hit a delayline detector. ...
ConditionType
typedef defining the types of available conditions
void loadSettings(CASSSettings &s)
read the parameters of the condition from the .ini file
virtual ~IsParticleHit()
virtual destructor since this is a base class
std::vector< particleHit_t > particleHits_t
define container for all particle hits
beginGroup(const QString &prefix)
void loadSettings(CASSSettings &s)
read the parameters of the condition from the .ini file
std::pair< double, double > _yrange
the range in y
bool operator()(const detectorHit_t &dethit) const
the comparison
virtual ~CombineConditions()