Jpp  19.1.0
the software that should make you happy
JShower3EZ.hh
Go to the documentation of this file.
1 #ifndef __JSHOWER3EZ__
2 #define __JSHOWER3EZ__
3 
4 #include <istream>
5 #include <ostream>
6 
7 #include "JMath/JMath.hh"
8 #include "JFit/JShower3Z.hh"
9 
10 
11 /**
12  * \author lquinn
13  */
14 
15 namespace JFIT {}
16 namespace JPP { using namespace JFIT; }
17 
18 namespace JFIT {
19 
20  using JMATH::JMath;
21 
22 
23  /**
24  * Data structure for fit of straight line in positive z-direction with energy.
25  * Note that the position coordinates are defined with respect to the given direction.
26  */
27  class JShower3EZ :
28  public JShower3Z,
29  public JMath<JShower3EZ>
30  {
31  public:
32 
33  /**
34  * Default constructor.
35  */
37  JShower3Z()
38  {}
39 
40 
41  /**
42  * Constructor.
43  *
44  * \param line line
45  * \param E E [GeV]
46  * \param By bjorken y
47  */
48  JShower3EZ(const JShower3Z& line, const double& E = 0, const double By = 1.0) :
49  JShower3Z(line),
50  __E(E),
51  __By(By)
52  {}
53 
54  /**
55  * Constructor.
56  *
57  * \param point point
58  * \param dir direction
59  * \param E E [GeV]
60  * \param By bjorken y
61  */
62  JShower3EZ(const JPoint4D& point,
63  const JVersor3Z& dir,
64  const double E = 0,
65  const double By = 1.0):
66  JShower3Z(JPoint4D(point), JVersor3Z(dir)),
67  __E(E),
68  __By(By)
69  {}
70 
71  /**
72  * Get bjorken y
73  *
74  * \return bjorken y
75  */
76  double getBy() const
77  {
78  return __By;
79  }
80 
81  /**
82  * Get E
83  *
84  * \return Energy [GeV]
85  */
86  double getE() const
87  {
88  return __E;
89  }
90  /**
91  * Prefix unary minus.
92  *
93  * \return shower
94  */
96  {
98  __E = -__E;
99  __By = -__By;
100 
101  return *this;
102  }
103 
104 
105  /**
106  * Addition operator.
107  *
108  * \param value shower
109  * \return shower
110  */
111  JShower3EZ& add(const JShower3EZ& value)
112  {
113  JShower3Z::add(value);
114  __E += value.getE();
115  __By += value.getBy();
116 
117  return *this;
118  }
119 
120 
121  /**
122  * Subtraction operator.
123  *
124  * \param value shower
125  * \return shower
126  */
127  JShower3EZ& sub(const JShower3EZ& value)
128  {
129  JShower3Z::sub(value);
130  __E -= value.getE();
131  __By -= value.getBy();
132 
133  return *this;
134  }
135 
136 
137  /**
138  * Multiplication operator.
139  *
140  * \param value multiplication factor
141  * \return shower
142  */
143  JShower3EZ& mul(const double value)
144  {
145  JShower3Z::mul(value);
146  __E *= value;
147  __By *= value;
148 
149  return *this;
150  }
151 
152 
153  /**
154  * Division operator.
155  *
156  * \param value division factor
157  * \return shower
158  */
159  JShower3EZ& div(const double value)
160  {
161  JShower3Z::div(value);
162  __E /= value;
163  __By /= value;
164 
165  return *this;
166  }
167 
168 
169  /**
170  * Read object from input.
171  *
172  * \param in input stream
173  * \param object object
174  * \return input stream
175  */
176  friend inline std::istream& operator>>(std::istream& in, JShower3EZ& object)
177  {
178  in >> static_cast<JShower3Z&>(object);
179  in >> object.__E;
180  in >> object.__By;
181 
182  return in;
183  }
184 
185 
186  /**
187  * Write object to output.
188  *
189  * \param out output stream
190  * \param object object
191  * \return output stream
192  */
193  friend inline std::ostream& operator<<(std::ostream& out, const JShower3EZ& object)
194  {
195  out << static_cast<const JShower3Z&>(object);
196  out << object.__E;
197  out << object.__By;
198 
199  return out;
200  }
201 
202  typedef double JShower3EZ::*parameter_type;
203 
204  static parameter_type pBy() { return &JShower3EZ::__By; }
205  static parameter_type pE() { return &JShower3EZ::__E; }
206  protected:
207  double __E;
208  double __By;
209  };
210 }
211 
212 #endif
Base class for data structures with artithmetic capabilities.
Data structure for vertex fit.
Definition: JPoint4D.hh:24
double JPoint4D::* parameter_type
Definition: JPoint4D.hh:56
Data structure for fit of straight line in positive z-direction with energy.
Definition: JShower3EZ.hh:30
JShower3EZ & negate()
Prefix unary minus.
Definition: JShower3EZ.hh:95
friend std::istream & operator>>(std::istream &in, JShower3EZ &object)
Read object from input.
Definition: JShower3EZ.hh:176
static parameter_type pE()
Definition: JShower3EZ.hh:205
double getBy() const
Get bjorken y.
Definition: JShower3EZ.hh:76
JShower3EZ & div(const double value)
Division operator.
Definition: JShower3EZ.hh:159
friend std::ostream & operator<<(std::ostream &out, const JShower3EZ &object)
Write object to output.
Definition: JShower3EZ.hh:193
double JShower3EZ::* parameter_type
Definition: JShower3EZ.hh:202
JShower3EZ & sub(const JShower3EZ &value)
Subtraction operator.
Definition: JShower3EZ.hh:127
JShower3EZ(const JShower3Z &line, const double &E=0, const double By=1.0)
Constructor.
Definition: JShower3EZ.hh:48
double getE() const
Get E.
Definition: JShower3EZ.hh:86
JShower3EZ & add(const JShower3EZ &value)
Addition operator.
Definition: JShower3EZ.hh:111
JShower3EZ(const JPoint4D &point, const JVersor3Z &dir, const double E=0, const double By=1.0)
Constructor.
Definition: JShower3EZ.hh:62
static parameter_type pBy()
Definition: JShower3EZ.hh:204
JShower3EZ()
Default constructor.
Definition: JShower3EZ.hh:36
JShower3EZ & mul(const double value)
Multiplication operator.
Definition: JShower3EZ.hh:143
Data structure for cascade in positive z-direction.
Definition: JShower3Z.hh:36
JVersor3Z & add(const JVersor3Z &value)
Addition operator.
Definition: JVersor3Z.hh:200
JVersor3Z & sub(const JVersor3Z &value)
Subtraction operator.
Definition: JVersor3Z.hh:215
JShower3Z & negate()
Prefix unary minus.
Definition: JShower3Z.hh:71
JShower3Z & div(const double value)
Divison operator.
Definition: JShower3Z.hh:127
JShower3Z & mul(const double value)
Multiplication operator.
Definition: JShower3Z.hh:113
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:41
Auxiliary classes and methods for linear and iterative data regression.
Definition: JEnergy.hh:15
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary base class for aritmetic operations of derived class types.
Definition: JMath.hh:347