Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JVectorNZ.hh
Go to the documentation of this file.
1 #ifndef __JFIT__JVECTORNZ__
2 #define __JFIT__JVECTORNZ__
3 
4 #include <vector>
5 #include <ostream>
6 
7 #include "Jeep/JPrint.hh"
8 #include "JFit/JLine1Z.hh"
9 #include "JMath/JVectorND.hh"
10 #include "JGeometry3D/JVector3D.hh"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JFIT {}
18 namespace JPP { using namespace JFIT; }
19 
20 namespace JFIT {
21 
22  using JMATH::JVectorND;
23 
24 
25  /**
26  * Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
27  */
28  class JVectorNZ :
29  public JVectorND
30  {
31  public:
32  /**
33  * Default contructor.
34  */
36  {}
37 
38 
39  /**
40  * Constructor.
41  *
42  * The template argument <tt>T</tt> refers to an iterator of a data structure which should have the following member methods:
43  * - double getX(); // [m]
44  * - double getY(); // [m]
45  * - double getZ(); // [m]
46  * - double getT(); // [ns]
47  *
48  * \param track track
49  * \param __begin begin of data
50  * \param __end end of data
51  */
52  template<class T>
53  JVectorNZ(const JLine1Z& track,
54  T __begin,
55  T __end)
56  {
57  set(track, __begin, __end);
58  }
59 
60 
61  /**
62  * Set time residual vector.
63  *
64  * The template argument <tt>T</tt> refers to an iterator of a data structure which should have the following member methods:
65  * - double getX(); // [m]
66  * - double getY(); // [m]
67  * - double getZ(); // [m]
68  * - double getT(); // [ns]
69  *
70  * \param track track
71  * \param __begin begin of data
72  * \param __end end of data
73  */
74  template<class T>
75  void set(const JLine1Z& track,
76  T __begin,
77  T __end)
78  {
80 
81  this->clear();
82 
83  for (T hit = __begin; hit != __end; ++hit) {
84  this->push_back(hit->getT() - track.getT(JVector3D(hit->getX(),
85  hit->getY(),
86  hit->getZ())));
87  }
88  }
89 
90 
91  /**
92  * Print ASCII formatted output.
93  *
94  * \param out output stream
95  * \param Y Y vector
96  * \return output stream
97  */
98  friend inline std::ostream& operator<<(std::ostream& out, const JVectorNZ& Y)
99  {
100  using namespace std;
101 
102  JFlags flags(out);
103 
104  for (JVectorNZ::const_iterator i = Y.begin(); i != Y.end(); ++i) {
105  out << showpos << SCIENTIFIC(10,2) << *i << ' ';
106  }
107 
108  out << endl;
109 
110  return out;
111  }
112  };
113 }
114 
115 #endif
JVectorNZ()
Default contructor.
Definition: JVectorNZ.hh:35
I/O formatting auxiliaries.
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
Definition: JVectorNZ.hh:28
Data structure for vector in three dimensions.
Definition: JVector3D.hh:33
do set_variable OUTPUT_DIRECTORY $WORKDIR T
void set(const JLine1Z &track, T __begin, T __end)
Set time residual vector.
Definition: JVectorNZ.hh:75
JVectorNZ(const JLine1Z &track, T __begin, T __end)
Constructor.
Definition: JVectorNZ.hh:53
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition: JLine1Z.hh:114
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:27
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:518
Auxiliary class to temporarily modify format specifications.
Definition: JPrint.hh:617
friend std::ostream & operator<<(std::ostream &out, const JVectorNZ &Y)
Print ASCII formatted output.
Definition: JVectorNZ.hh:98
Nx1 matrix.
Definition: JVectorND.hh:14