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"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JFIT {}
17 namespace JPP { using namespace JFIT; }
18 
19 namespace JFIT {
20 
21 
22  /**
23  * Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
24  */
25  class JVectorNZ :
26  public std::vector<double>
27  {
28  public:
29  /**
30  * Default contructor.
31  */
33  std::vector<double>()
34  {}
35 
36 
37  /**
38  * Constructor.
39  *
40  * The template argument <tt>T</tt> refers to an iterator of a data structure which should have the following member methods:
41  * - double getX(); // [m]
42  * - double getY(); // [m]
43  * - double getZ(); // [m]
44  * - double getT(); // [ns]
45  *
46  * \param track track
47  * \param __begin begin of data
48  * \param __end end of data
49  */
50  template<class T>
51  JVectorNZ(const JLine1Z& track,
52  T __begin,
53  T __end) :
54  std::vector<double>()
55  {
56  set(track, __begin, __end);
57  }
58 
59 
60  /**
61  * Set time residual vector.
62  *
63  * The template argument <tt>T</tt> refers to an iterator of a data structure which should have the following member methods:
64  * - double getX(); // [m]
65  * - double getY(); // [m]
66  * - double getZ(); // [m]
67  * - double getT(); // [ns]
68  *
69  * \param track track
70  * \param __begin begin of data
71  * \param __end end of data
72  */
73  template<class T>
74  void set(const JLine1Z& track,
75  T __begin,
76  T __end)
77  {
79 
80  this->clear();
81 
82  for (T hit = __begin; hit != __end; ++hit) {
83  this->push_back(hit->getT() - track.getT(JVector3D(hit->getX(),
84  hit->getY(),
85  hit->getZ())));
86  }
87  }
88 
89 
90  /**
91  * Print ASCII formatted output.
92  *
93  * \param out output stream
94  * \param Y Y vector
95  * \return output stream
96  */
97  friend inline std::ostream& operator<<(std::ostream& out, const JVectorNZ& Y)
98  {
99  using namespace std;
100 
101  JFlags flags(out);
102 
103  for (JVectorNZ::const_iterator i = Y.begin(); i != Y.end(); ++i) {
104  out << showpos << SCIENTIFIC(10,2) << *i << ' ';
105  }
106 
107  out << endl;
108 
109  return out;
110  }
111  };
112 }
113 
114 #endif
JVectorNZ()
Default contructor.
Definition: JVectorNZ.hh:32
I/O formatting auxiliaries.
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
Definition: JVectorNZ.hh:25
Data structure for vector in three dimensions.
Definition: JVector3D.hh:32
void set(const JLine1Z &track, T __begin, T __end)
Set time residual vector.
Definition: JVectorNZ.hh:74
JVectorNZ(const JLine1Z &track, T __begin, T __end)
Constructor.
Definition: JVectorNZ.hh:51
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:498
Auxiliary class to temporarily modify format specifications.
Definition: JPrint.hh:535
friend std::ostream & operator<<(std::ostream &out, const JVectorNZ &Y)
Print ASCII formatted output.
Definition: JVectorNZ.hh:97