Jpp
JDetectorParameters.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JDETECTORPARAMETERS__
2 #define __JDETECTOR__JDETECTORPARAMETERS__
3 
4 #include "JLang/JParameter.hh"
5 #include "JLang/JException.hh"
6 #include "JLang/JComparable.hh"
7 #include "Jeep/JProperties.hh"
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace JDETECTOR {}
15 namespace JPP { using namespace JDETECTOR; }
16 
17 namespace JDETECTOR {
18 
19  using JLANG::JParameter;
20  using JLANG::JException;
21  using JLANG::JComparable;
22 
23 
24  /**
25  * Data structure for parameters for detector geometry.
26  */
28  public JComparable<JDetectorParameters>
29  {
30  public:
31  /**
32  * Default constructor.
33  */
35  detectorType (),
37  numberOfFloors (),
38  lineDistance_m (),
39  numberOfLines ()
40  {}
41 
42 
48 
49 
50  /**
51  * Get status of parameters.
52  *
53  * \return true if all parameters have been defined; else false
54  */
55  const bool isDefined() const
56  {
57  return (detectorType .isDefined() &&
62  }
63 
64 
65  /**
66  * Compare detector parameters.
67  *
68  * The hierarchy is:
69  * 1) detector type;
70  * 2) number of lines;
71  * 3) number of floors;
72  * 4) line distance;
73  * 5) floor distance;
74  *
75  * \param detector detector parameters
76  * \return true is first is less than second; else false
77  */
78  bool less(const JDetectorParameters& detector) const
79  {
80  if (detectorType == detector.detectorType)
81  if (numberOfLines == detector.numberOfLines)
82  if (numberOfFloors == detector.numberOfFloors)
83  if (lineDistance_m == detector.lineDistance_m)
84  return floorDistance_m < detector.floorDistance_m;
85  else
86  return lineDistance_m < detector.lineDistance_m;
87  else
88  return numberOfFloors < detector.numberOfFloors;
89  else
90  return numberOfLines < detector.numberOfLines;
91  else
92  return detectorType < detector.detectorType;
93  }
94  };
95 
96 
97  /**
98  * Auxiliary class for I/O of JDetectorParameters data structure.
99  */
101  public JProperties
102  {
103  public:
104  /**
105  * Constructor.
106  *
107  * \param detector detector parameters
108  */
110  JProperties(JEquationParameters("= ", "\n;", "", ""), 2)
111  {
112  insert(gmake_property(detector.detectorType));
113  insert(gmake_property(detector.floorDistance_m));
114  insert(gmake_property(detector.numberOfFloors));
115  insert(gmake_property(detector.lineDistance_m));
116  insert(gmake_property(detector.numberOfLines));
117  }
118  };
119 }
120 
121 #endif
JException.hh
JDETECTOR::JDetectorParametersHelper::JDetectorParametersHelper
JDetectorParametersHelper(JDetectorParameters &detector)
Constructor.
Definition: JDetectorParameters.hh:109
JParameter.hh
JDETECTOR::JDetectorParametersHelper
Auxiliary class for I/O of JDetectorParameters data structure.
Definition: JDetectorParameters.hh:100
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDETECTOR::JDetectorParameters::isDefined
const bool isDefined() const
Get status of parameters.
Definition: JDetectorParameters.hh:55
JComparable.hh
JDETECTOR::JDetectorParameters
Data structure for parameters for detector geometry.
Definition: JDetectorParameters.hh:27
JDETECTOR::JDetectorParameters::lineDistance_m
JParameter< double > lineDistance_m
Definition: JDetectorParameters.hh:46
JLANG::JParameter
Parameter class.
Definition: JParameter.hh:32
JLANG::JComparable
Template definition of auxiliary base class for comparison of data structures.
Definition: JComparable.hh:24
JLANG::JEquationParameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Definition: JEquationParameters.hh:20
gmake_property
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
Definition: JProperties.hh:1319
JEEP::JProperties
Utility class to parse parameter values.
Definition: JProperties.hh:496
JDETECTOR::JDetectorParameters::numberOfFloors
JParameter< unsigned int > numberOfFloors
Definition: JDetectorParameters.hh:45
JProperties.hh
JDETECTOR::JDetectorParameters::JDetectorParameters
JDetectorParameters()
Default constructor.
Definition: JDetectorParameters.hh:34
JDETECTOR::JDetectorParameters::less
bool less(const JDetectorParameters &detector) const
Compare detector parameters.
Definition: JDetectorParameters.hh:78
JDETECTOR::JDetectorParameters::numberOfLines
JParameter< unsigned int > numberOfLines
Definition: JDetectorParameters.hh:47
JDETECTOR::JDetectorParameters::detectorType
JParameter< int > detectorType
Definition: JDetectorParameters.hh:43
JLANG::JParameter::isDefined
const bool isDefined() const
Get status of parameter.
Definition: JParameter.hh:134
JDETECTOR
Auxiliary classes and methods for detector calibration.
Definition: JAnchor.hh:12
JLANG::JException
General exception.
Definition: JException.hh:23
JDETECTOR::JDetectorParameters::floorDistance_m
JParameter< double > floorDistance_m
Definition: JDetectorParameters.hh:44