CFEL - ASG Software Suite  2.5.0
CASS
poscalculator.hpp
Go to the documentation of this file.
1 //Copyright (C) 2010-2011 Lutz Foucar
2 
3 /**
4  * @file poscalculator.hpp contains classes for calculating the position in a
5  * DLD
6  *
7  * @author Lutz Foucar
8  */
9 #ifndef _POSCALCULATOR_H
10 #define _POSCALCULATOR_H
11 
12 #include <utility>
13 #include <cmath>
14 
15 namespace cass
16 {
17 namespace ACQIRIS
18 {
19 /** position calculator base class
20  *
21  * @author Lutz Foucar
22  */
24 {
25 public:
26  virtual ~PositionCalculator() {}
27  virtual std::pair<double,double> operator()(const std::pair<double, double>&)=0;
28 };
29 
30 /** position calculator for quad anode
31  *
32  * @author Lutz Foucar
33  */
34 class XYCalc : public PositionCalculator
35 {
36 public:
37  virtual std::pair<double,double> operator()(const std::pair<double, double>& layer)
38  {
39  return layer;
40  }
41 };
42 
43 /** position calculator for hex anodes u and v layer
44  *
45  * @author Lutz Foucar
46  */
47 class UVCalc : public PositionCalculator
48 {
49 public:
50  virtual std::pair<double,double> operator()(const std::pair<double, double>& layer)
51  {
52  const double u(layer.first);
53  const double v(layer.second);
54  return std::make_pair(u, 1./std::sqrt(3) * (u-2.*v));
55  }
56 };
57 
58 /** position calculator for hex anodes u and w layer
59  *
60  * @author Lutz Foucar
61  */
62 class UWCalc : public PositionCalculator
63 {
64 public:
65  virtual std::pair<double,double> operator()(const std::pair<double, double>& layer)
66  {
67  const double u(layer.first);
68  const double w(layer.second);
69  return std::make_pair(u, 1./std::sqrt(3) * (2.*w-u));
70  }
71 };
72 
73 /** position calculator for hex anodes u and v layer
74  *
75  * @author Lutz Foucar
76  */
77 class VWCalc : public PositionCalculator
78 {
79 public:
80  virtual std::pair<double,double> operator()(const std::pair<double, double>& layer)
81  {
82  const double v(layer.first);
83  const double w(layer.second);
84  return std::make_pair(v+w, 1./std::sqrt(3) * (w-v));
85  }
86 };
87 }//end namepsace acqiris
88 }//end namespace cass
89 #endif
position calculator base class
virtual std::pair< double, double > operator()(const std::pair< double, double > &layer)
position calculator for hex anodes u and v layer
virtual std::pair< double, double > operator()(const std::pair< double, double > &)=0
position calculator for hex anodes u and v layer
virtual std::pair< double, double > operator()(const std::pair< double, double > &layer)
virtual std::pair< double, double > operator()(const std::pair< double, double > &layer)
position calculator for hex anodes u and w layer
position calculator for quad anode
virtual std::pair< double, double > operator()(const std::pair< double, double > &layer)