CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
global_linear.cc
Go to the documentation of this file.
1 
2 //#include "DetectorDescription/Base/interface/DDdebug.h"
3 // GENERATED FILE. DO NOT MODIFY!
4 #include "global_linear.h"
5 // I tried the following on CERN lxplus and still no MAX_DOUBLE was defined.
6 // so I tried DBL_MAX which does exist, but I do not know the source of this.
7 // So, in keeping with everything else I saw:
8 #define MAX_DOUBLE DBL_MAX
9 //#include <climits>
10 
11 
12 
13 
14  #include <cmath>
15 
16 
17 
18 
19 // always the same ctor
21  : AlgoImpl(a,label)
22 { }
23 
25 { }
26 
28 {
29 
30  bool result = true;
31 
32  // check for valid delta-value
33  if (ParE_["delta"][0] == 0.) {
34  err_ += "\tdelta must not be 0\n";
35  result = false;
36  }
37 
38  // check for presence of base
39  if (!ParE_["base"].size()) {
40  result = false; // don't select this implementation, because base is missing
41  }
42 
43  return result;
44 
45 }
46 
47 
49 {
50 
51  // we can safely fetch all parameters, because they
52  // have been checked already ...
53  double theta = ParE_["theta"][0]/rad;
54  double phi = ParE_["phi"][0]/rad;
55  double offset = ParE_["offset"][0];
56  double delta = ParE_["delta"][0];
57 
58  DDTranslation direction( sin(theta)*cos(phi),
59  sin(theta)*sin(phi),
60  cos(theta) );
61 
62  DDTranslation base(ParE_["base"][0],
63  ParE_["base"][1],
64  ParE_["base"][2]);
65 
66  return base + (offset + double(curr_)*delta)*direction;
67 
68 }
69 
70 
72 {
73 
74  return DDRotationMatrix();
75 
76 }
77 
78 
79 
80 
81 
82 
83 
84 void global_linear_0::stream(std::ostream & os) const
85 {
86  os << "global_linear_0::stream(): not implemented.";
87 }
88 
89 
90 
91  #include <cmath>
92 
93 
94 
95 
96 // always the same ctor
98  : AlgoImpl(a,label)
99 { }
100 
102 { }
103 
105 {
106 
107  /* besides the automatic generated checking for the input params,
108  we have to decide, whether the params are correct and should
109  select this implementation
110  */
111 
112  bool result = true;
113 
114  // check for valid delta-value
115  if (ParE_["delta"][0] == 0.) {
116  err_ += "\tdelta must not be 0\n";
117  result = false;
118  }
119 
120  // check for presence of base
121  if (ParE_["base"].size()) {
122  result = false; // don't select this implementation, because base is present
123  }
124 
125  return result;
126 
127 }
128 
129 
131 {
132 
133  // we can safely fetch all parameters, because they
134  // have been checked already ...
135  double theta = ParE_["theta"][0]/rad;
136  double phi = ParE_["phi"][0]/rad;
137  double offset = ParE_["offset"][0];
138  double delta = ParE_["delta"][0];
139 
140  DDTranslation direction( sin(theta)*cos(phi),
141  sin(theta)*sin(phi),
142  cos(theta) );
143 
144  return (offset + double(curr_)*delta)*direction;
145 
146 }
147 
148 
150 {
151 
152  // there are no rotations involved in this algorithm.
153  // simply returns the unit matrix.
154  return DDRotationMatrix();
155 
156 }
157 
158 
159 
160 
161 
162 
163 
164 void global_linear_1::stream(std::ostream & os) const
165 {
166  os << "global_linear_0::stream(): not implemented.";
167 }
168 
169 
170 /***********************************************************************************/
171 
172 /**************************************************************************
173 
174  The following Code gets only generated IF the code-generator
175  has the capability of generating evaluation/checking code for
176  the specification of the parameters in the algorithm XML.
177 
178  If the following is not generated, there will be not automatic
179  checking of the basic properties of the user-supplied parameters
180  (bounds, occurences, default values, ...)
181 
182 ***************************************************************************/
183 
184 // IT IS ADVISABLE TO HAVE SCHEMA VALIDATION DURING PARSING THE ALGORITHM-XML
185 // IN ORDER TO GET DEFAULT VALUES & CONTRAINTS FOR THE PARAMTERS OF THE ALGORITHM
186 // The code-generator has to fill data-structures containing the parameter names
187 // and their constraints. This information is only completely available during
188 // parsing of an algorithm-defintion-xml when schema validation is turned on.
190 {
191  // for the time being only expression-valued parameters can be automatically checked
192  // against their specified constraints
193 
194  // schema default values will be shown if necessary in the following XML comments
195  // on the second line. The fist shows the values as given in the instance document
196 
197  // expressions have to be converted into doubles. No variables [bla] shall be allowed
198  // inside the expressions; SystemOfUnits-symbols are the only supported ones.
199 
200 
201  constraintsE_["theta"] = ConstraintE( 1, // minOccurs
202  1, // maxOccurs
203  0*deg, // min
204  180*deg, // max
205  true, // use, true=required, false=optional
206  false, // use, true=use default, false=no default
207  0.
208  );
209 
210  constraintsE_["phi"] = ConstraintE( 1, // minOccurs
211  1, // maxOccurs
212  0*deg, // min
213  360*deg, // max
214  true, // use, true=required, false=optional
215  false, // use, true=use default, false=no default
216  0.
217  );
218 
219  constraintsE_["delta"] = ConstraintE( 1, // minOccurs
220  1, // maxOccurs
221  -MAX_DOUBLE, // min
222  +MAX_DOUBLE, // max
223  true, // use, true=required, false=optional
224  false, // use, true=use default, false=no default
225  0.
226  );
227 
228  constraintsE_["offset"] = ConstraintE( 1, // minOccurs
229  1, // maxOccurs
230  -MAX_DOUBLE, // min
231  +MAX_DOUBLE, // max
232  false, // use, true=required, false=optional
233  true, // use, true=use default, false=no default
234  0
235  );
236 
237  constraintsE_["base"] = ConstraintE( 3, // minOccurs
238  3, // maxOccurs
239  -MAX_DOUBLE, // min
240  +MAX_DOUBLE, // max
241  false, // use, true=required, false=optional
242  false, // use, true=use default, false=no default
243  0.
244  );
245 
246 }
247 
248 
dbl * delta
Definition: mlp_gen.cc:36
tuple base
Main Program
Definition: newFWLiteAna.py:92
#define MAX_DOUBLE
Definition: global_linear.cc:8
class for algorithmic positioning, represents an algorithm
Definition: AlgoPos.h:27
global_linear_1(AlgoPos *, std::string label)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void stream(std::ostream &) const
Geom::Theta< T > theta() const
DDTranslation translation()
subclass must calculate a translation std::vector
parE_type & ParE_
Definition: AlgoImpl.h:113
constraints as defined for algorithm-parameters in the XML schema Algorithm.xsd, expressions ...
Definition: AlgoCheck.h:19
const int & curr_
Definition: AlgoImpl.h:117
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::string & err_
Definition: AlgoImpl.h:120
tuple result
Definition: query.py:137
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void stream(std::ostream &) const
implementation of an algorithm, non generated checking code.
Definition: AlgoImpl.h:19
unsigned int offset(bool)
DDRotationMatrix rotation()
subclass must calculate a rotation matrix
DDTranslation translation()
subclass must calculate a translation std::vector
constraintsE_type constraintsE_
format: &quot;ParameterName&quot; -&gt; ConstraintE
Definition: AlgoCheck.h:73
DDRotationMatrix rotation()
subclass must calculate a rotation matrix
double a
Definition: hdecay.h:121
bool checkParameters()
subclass must check the supplied parameters ParE_, ParS_
global_linear_0(AlgoPos *, std::string label)
bool checkParameters()
subclass must check the supplied parameters ParE_, ParS_
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
tuple size
Write out results.
Definition: DDAxes.h:10