Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
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"
7#include "Jeep/JProperties.hh"
8
9
10/**
11 * \author mdejong
12 */
13
14namespace JDETECTOR {}
15namespace JPP { using namespace JDETECTOR; }
16
17namespace JDETECTOR {
18
22
23
24 /**
25 * Data structure for parameters for detector geometry.
26 */
28 public JComparable<JDetectorParameters>
29 {
30 public:
31 /**
32 * Default constructor.
33 */
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() &&
58 floorDistance_m.isDefined() &&
59 numberOfFloors .isDefined() &&
60 lineDistance_m .isDefined() &&
61 numberOfLines .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
Exceptions.
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Auxiliary class for I/O of JDetectorParameters data structure.
JDetectorParametersHelper(JDetectorParameters &detector)
Constructor.
Data structure for parameters for detector geometry.
bool less(const JDetectorParameters &detector) const
Compare detector parameters.
JParameter< unsigned int > numberOfLines
JDetectorParameters()
Default constructor.
const bool isDefined() const
Get status of parameters.
JParameter< unsigned int > numberOfFloors
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
General exception.
Definition JException.hh:24
Parameter class.
Definition JParameter.hh:36
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template definition of auxiliary base class for comparison of data structures.