CFEL - ASG Software Suite  2.5.0
CASS
momenta_calculator.h
Go to the documentation of this file.
1 //Copyright (C) 2001-2010 Lutz Foucar
2 
3 /**
4  * @file momenta_calculator.h file contains the classes that calculate the
5  * momenta of particles from their detector hits.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef __MomentaCalculator_H_
11 #define __MomentaCalculator_H_
12 
13 #include <memory>
14 #include <tr1/memory>
15 
17 
18 namespace cass
19 {
20 class CASSSettings;
21 
22 namespace ACQIRIS
23 {
24 class Particle;
25 
26 /** copy and correct detectorhit properties
27  *
28  * copy the position and time value from the detectorhit and then correct
29  * those values.
30  *
31  * @cassttng AcqirisDetectors/\%detectorname\%/Particles/\%particlename%/Corrections/{T0}\n
32  * Time in ns that should be substracted from the recorded time
33  * of the detectorhit. Default is 0.
34  * @cassttng AcqirisDetectors/\%detectorname\%/Particles/\%particlename%/Corrections/{CorrectX|CorrectY}\n
35  * Position in mm that should be substracted from the x and y
36  * position of the detectorhit. Default is 0|0.
37  * @cassttng AcqirisDetectors/\%detectorname\%/\%particlename%/Corrections/{ScaleX|ScaleY}\n
38  * Factor by which the corrected position should be multiplied, to
39  * get a right sized image. Default is 1|1.
40  * @cassttng AcqirisDetectors/\%detectorname\%/Particles/\%particlename%/Corrections/{Angle}\n
41  * Angle in degree around which the corrected and scaled position
42  * should be roated. Default is 0.
43  *
44  * @author Lutz Foucar
45  */
47 {
48 public:
49  /** load the settings
50  *
51  * load the correction factors from the .ini file
52  *
53  * @param s the CASSSettings object to read the information from
54  */
55  void loadSettings(CASSSettings &s);
56 
57  /** correct the position in the detector plane
58  *
59  * Create a particlehit.
60  * Then copy the position and the time from the dethit to the particlehit.
61  * Then correct this position, then scale the correted position and finaly
62  * rotate the corrected scaled positition around the given angle.
63  * Then substract _t0 form the time of the detectorhit
64  *
65  * @return the correct position
66  * @param[in] dethit the detector hit to correct
67  */
68  particleHit_t operator()(const detectorHit_t &dethit)const;
69 
70 private:
71  /** the correction factor of the time of flight */
72  double _t0;
73 
74  /** the correction of the position */
75  std::pair<double,double> _pos0;
76 
77  /** the correction of the scale */
78  std::pair<double,double> _scalefactors;
79 
80  /** the angle to rotate the position */
81  double _angle;
82 };
83 
84 /** base class for calculating momenta from a detector hit
85  *
86  * @author Lutz Foucar
87  */
89 {
90 public:
91  /** virtual destructor since this is a base class */
92  virtual ~MomentumCalculator() {}
93 
94  /** enum for the types of momcalculators */
96 
97  /** calculate the momenta
98  *
99  * calculates the momenta of the particle form a given detectorhit. First
100  * correct the position of the detectorhit and the time of flight.
101  *
102  * @return the particle hit that contains all momenta
103  * @param[in] particlehit the detectorhit to calculate the momenta from
104  * @param[in] particle the particle object that contains the properties of
105  * the particle that the momentum needs to be
106  * calculated from
107  */
108  virtual particleHit_t& operator()(const Particle &particle, particleHit_t& particlehit)const=0;
109 
110  /** create instance of requested type
111  *
112  * creates an instance of the requested type
113  *
114  * @return pointer to the instance of the requested type
115  * @param type the type of momentum calculator requested
116  */
117  static std::tr1::shared_ptr<MomentumCalculator> instance(const MomCalcType &type);
118 };
119 
120 /** calculate px,py momenta
121  *
122  * This calcultates the momenta components of the particle in the
123  * detectorplane for a spectrometer without a magnetic field.
124  *
125  * @author Lutz Foucar
126  */
128 {
129 public:
131  particleHit_t& operator()(const Particle &particle, particleHit_t& particlehit)const;
132 };
133 
134 /** calculate px,py momenta
135  *
136  * This calcultates the momenta components of the particle in the
137  * detectorplane for a spectrometer with a magnetic field.
138  *
139  * @author Lutz Foucar
140  */
142 {
143 public:
145  particleHit_t& operator()(const Particle &particle, particleHit_t& particlehit)const;
146 };
147 
148 /** calculate pz momenta
149  *
150  * This calcultates the momenta componetnt of the particle along the time of
151  * flight for a spectrometer with only one region. This can be done
152  * analytical.
153  *
154  * @author Lutz Foucar
155  */
157 {
158 public:
160  particleHit_t& operator()(const Particle &particle, particleHit_t& particlehit)const;
161 };
162 
163 /** calculate pz momenta
164  *
165  * This calcultates the momenta componetnt of the particle along the time of
166  * flight for a spectrometer with more than one region. We do this iterativly.
167  *
168  * @author Lutz Foucar
169  */
171 {
172 public:
174  particleHit_t& operator()(const Particle &particle, particleHit_t& particlehit)const;
175 };
176 }//end namespace acqiris
177 }//end namespace cass
178 #endif
std::vector< double > detectorHit_t
define a detector hit
void loadSettings(CASSSettings &s)
load the settings
copy and correct detectorhit properties
base class for calculating momenta from a detector hit
double _t0
the correction factor of the time of flight
particleHit_t operator()(const detectorHit_t &dethit) const
correct the position in the detector plane
virtual particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const =0
calculate the momenta
double _angle
the angle to rotate the position
Settings for CASS.
Definition: cass_settings.h:30
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
std::pair< double, double > _pos0
the correction of the position
std::vector< double > particleHit_t
define a particle hit
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
static std::tr1::shared_ptr< MomentumCalculator > instance(const MomCalcType &type)
create instance of requested type
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
contains the global definitions for acqiris analysis
MomCalcType
enum for the types of momcalculators
virtual ~MomentumCalculator()
virtual destructor since this is a base class
A Particle.
Definition: particle.h:70
std::pair< double, double > _scalefactors
the correction of the scale