CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

XF.h
Go to the documentation of this file.
1 //---------------XF::Function (transformation field)--------------------//
2 // //
3 // XF::Function, class of function objects which evaluate to a //
4 // evaluate to a HepTransform, and a class XF::Pow which can be //
5 // used to exponentiate any transform. The transformations fields //
6 // can be multiplied together or multiplied with a fixed global //
7 // transformation. These can be used to build arbitrary //
8 // HepTransform3D-valued-fields which are very compact. Chief //
9 // application so far is in geometry modelling where it is a //
10 // powerful technique for parameterization. //
11 // //
12 // Example: //
13 // //
14 // // Define some constants: //
15 // int N; //
16 // double c1, c2, r, z; //
17 // //
18 // // Construct a simple linear function of a variable i: //
19 // //
20 // Variable i; //
21 // //
22 // GENFUNCTION g = c1+c2*i; //
23 // //
24 // // Create a transfunction //
25 // //
26 // TRANSFUNCTION xf = Pow(HepRotateZ3D(1),g)* //
27 // HepTranslateX3D(r)* //
28 // HepTranslateZ3D(z); //
29 // //
30 // // Evaluation of TRANSFUNCTION //
31 // //
32 // HepTransform3D x = xf(33.2); //
33 // //
34 // //
35 // ... //
36 // Similar techniques may be used to create a transformation field of //
37 // more than one variable. //
38 // //
39 // //
40 //----------------------------------------------------------------------//
41 #ifndef TransformFunction_h
42 #define TransformFunction_h 1
46 
47 //-----------------------------------------------------------------------//
48 // Exact return type of arithmentic operations. To the user, the return //
49 // type is TRANSFUNCTION, or const XF::Function &. //
50 //-----------------------------------------------------------------------//
51 
52 namespace XF
53 {
54 
55  class Product;
56  class PreMult;
57  class PostMult;
58  class Pow;
59 
60 
61  class Function
62  {
63 
64  public:
65 
66  // Default Constructor
67  Function ();
68 
69  // Destructor
70  virtual ~ Function ();
71 
72  // Function value: N-dimensional functions must override these:
73  virtual unsigned int dimensionality () const; //returns 1;
74 
75  // Function value
76  virtual HepGeom::Transform3D operator () (double argument) const = 0;
78  Argument & argument) const =
79  0;
80 
81  // Every function must override this:
82  virtual Function *clone () const = 0;
83 
84  // Copy constructor
85  Function (const Function & right);
86 
87  private:
88 
89  // Assignment operator
90  const Function & operator = (const Function & right);
91 
92  };
93 
94 
95 
96 
97 
98 
99  class Pow:public Function
100  {
101 
102  public:
103 
105 
106  virtual ~ Pow ();
107 
108  virtual HepGeom::Transform3D operator () (double argument) const;
110  Argument & argument) const;
111 
112  // Every function must override this:
113  Pow *clone () const;
114 
115  // Copy constructor:
116  Pow (const Pow & right);
117 
118  private:
119 
120  // Assignment operator
121  const Pow & operator = (const Pow & right);
122 
123  const HepGeom::Transform3D xf;
124  const Genfun::AbsFunction * function;
125 
126  };
127 
128 
129 
130 
131 
132  Product operator * (const Function & op1, const Function & op2);
133  PreMult operator * (const HepGeom::Transform3D & xf, const Function & op2);
134  PostMult operator * (const Function & op2, const HepGeom::Transform3D & xf);
135 
136 
137  // Internally used class:: Product:
138 
139  class Product:public Function
140  {
141 
142  public:
143 
144 
145  Product (const Function * arg1, const Function * arg2);
146 
147  virtual ~ Product ();
148 
149  virtual unsigned int dimensionality () const;
150 
151  virtual HepGeom::Transform3D operator () (double argument) const;
153  Argument & argument) const;
154 
155  // Every function must override this:
156  virtual Product *clone () const;
157 
158  // Copy constructor:
159  Product (const Product & right);
160 
161  private:
162 
163  const Function *_arg1;
164  const Function *_arg2;
165 
166  };
167 
168  // Internally used class:: PreMult :
169 
170  class PreMult:public Function
171  {
172 
173  public:
174 
175 
176  PreMult (const HepGeom::Transform3D & arg1, const Function * arg2);
177 
178  virtual ~ PreMult ();
179 
180  virtual unsigned int dimensionality () const;
181 
182  virtual HepGeom::Transform3D operator () (double argument) const;
184  Argument & argument) const;
185 
186  // Every function must override this:
187  virtual PreMult *clone () const;
188 
189  // Copy constructor:
190  PreMult (const PreMult & right);
191 
192  private:
193 
194  const HepGeom::Transform3D _arg1;
195  const Function *_arg2;
196 
197  };
198 
199  // Internally used class:: PostMult :
200 
201  class PostMult:public Function
202  {
203 
204  public:
205 
206 
207  PostMult (const Function * arg1, const HepGeom::Transform3D & arg2);
208 
209  virtual ~ PostMult ();
210 
211  virtual unsigned int dimensionality () const;
212 
213  virtual HepGeom::Transform3D operator () (double argument) const;
215  Argument & argument) const;
216 
217  // Every function must override this:
218  virtual PostMult *clone () const;
219 
220  // Copy constructor:
221  PostMult (const PostMult & right);
222 
223  private:
224 
225  const Function *_arg1;
226  const HepGeom::Transform3D _arg2;
227 
228  };
229 
230  typedef const Function & TRANSFUNCTION;
231 
232 
233 
234 }
235 
236 #endif
Definition: XF.h:52
Function()
Definition: XF.cc:15
double Pow(double x, int n)
Definition: VoigtProfile.cc:14
virtual Function * clone() const =0
void f(void g())
Definition: excDblThrow.cc:38
virtual HepGeom::Transform3D operator()(double argument) const =0
virtual unsigned int dimensionality() const
Definition: XF.cc:38
Definition: XF.h:99
Product operator*(const Function &op1, const Function &op2)
Definition: XF.cc:23
virtual ~ Function()
const Function & TRANSFUNCTION
Definition: XF.h:230