CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Expressions.h
Go to the documentation of this file.
1 #ifndef SelectorUtils_Expressions_h
2 #define SelectorUtils_Expressions_h
3 
4 // expression templates
5 // Benedikt Hegner, DESY
6 
7 namespace reco{
8 
9 template<class T>
10 class ExprBase {
11  public:
12  ExprBase() {};
13  virtual bool operator()(const T& x) const { return 1;}
14  virtual ExprBase * clone() { return new ExprBase(*this);}
15 };
16 
17 
18 
19 template<class Type>
20 class Selector {
21  public:
22  Selector() {}
23  template<class Expr>
24  void operator=(Expr e){tmp = e.clone();}
25  void operator()(Type * aClass) {return tmp->operator()(*aClass);}
26  private:
27  ExprBase<Type>* tmp; //@TODO: add exception handling in case of forgotten expression definition
28 };
29 
30 
31 //the implementation part
32 
33 template<class AnExpr>
34 class Expr : public ExprBase<typename AnExpr::RetType> {
35  public:
36  typedef typename AnExpr::ArgType ArgType;
37  typedef typename AnExpr::RetType RetType;
38 
39  Expr( const AnExpr& expr = AnExpr() ):mExpr(expr) {};
40  RetType operator()( const ArgType& x ) const
41  { return mExpr(x); }
42 
43  private:
44  AnExpr mExpr;
45 };
46 
47 
48 //hold expression literals
49 template< class Value, class ActON >
51 {
52 public:
53  typedef Value RetType;
54  typedef ActON ArgType;
55 
56  ExprLiteral( const RetType& val)
57  { mVal = val; }
58 
59  RetType operator()( const ArgType& ) const
60  { return mVal; }
61 
62 private:
64 };
65 
66 
68 template < class RETType >
70 {
71 public:
72  typedef RETType RetType;
73  typedef RETType ArgType;
74 
75  RetType operator()( const ArgType& x ) const
76  { return x; }
77 
78 };
79 
80 
81 template< class Value, class ActON >
83 {
84 public:
85  typedef Value RetType;
86  typedef ActON ArgType;
87 
88  ExprUserFun( Value (ActON::* aFun)() const )
89  {mFun = aFun;};
90 
91  RetType operator()( const ArgType& x ) const
92  {return (x.*mFun)();}
93 
94 private:
95  RetType (ActON::* mFun)() const;
96 };
97 
98 
100 // operators //
102 template< class T >
103 struct Add {
104  typedef T RetType;
105  static inline RetType apply( const RetType& a, const RetType& b )
106  {return ( a + b );}
107 };
108 
109 template< class T >
110 struct Sub {
111  typedef T RetType;
112  static inline RetType apply( const RetType& a, const RetType& b )
113  {return ( a - b );}
114 };
115 
116 template< class T >
117 struct Mul {
118  typedef T RetType;
119  static inline RetType apply( const RetType& a, const RetType& b )
120  {return ( a * b );}
121 };
122 
123 template< class T >
124 struct Div {
125  typedef T RetType;
126  static inline RetType apply( const RetType& a, const RetType& b )
127  {return ( a / b );}
128 };
129 
130 
132 // boolean operators //
134 template< class T >
135 struct And;
136 
137 template<>
138 struct And<bool> {
139  typedef bool RetType;
140  static inline RetType apply( bool a, bool b )
141  {return ( a && b );}
142 };
143 
144 template< class T >
145 struct Or;
146 
147 template<>
148 struct Or<bool> {
149  typedef bool RetType;
150  static inline RetType apply( bool a, bool b )
151  {return ( a || b );}
152 };
153 
154 
156 // Comparison operators //
158 template< class T >
159 struct Less {
160  typedef bool RetType;
161  static inline RetType apply( const T& a, const T& b )
162  {return ( a < b );}
163 };
164 
165 template< class T >
166 struct LessEqual {
167  typedef bool RetType;
168  static inline RetType apply( const T& a, const T& b )
169  {return ( a <= b );}
170 };
171 
172 template< class T >
173 struct More {
174  typedef bool RetType;
175  static inline RetType apply( const T& a, const T& b )
176  {return ( a > b );}
177 };
178 
179 template< class T >
180 struct MoreEqual {
181  typedef bool RetType;
182  static inline RetType apply( const T& a, const T& b )
183  {return ( a >= b );}
184 };
185 
186 template< class T >
187 struct Equal {
188  typedef bool RetType;
189  static inline RetType apply( const T& a, const T& b )
190  {return ( a == b );}
191 };
192 
193 
194 
195 template< class A, class Operation, class B >
196 class BinOp {
197  public:
198  typedef typename Operation::RetType RetType;
199  typedef typename A::ArgType ArgType;
200 
201  BinOp( const A& A, const B& B ):mA(A), mB(B)
202  { };
203 
204  RetType operator() (const ArgType& x) const
205  {return Operation::apply( mA(x), mB(x) );}
206 
207  private:
208  A mA;
209  B mB;
210 };
211 
213 // conv traits for basic types //
215 template< class A, class B >
217 
218 template<>
219 struct BasicConvTrait< double, double >
220  {typedef double ResultType;};
221 
222 template<>
223 struct BasicConvTrait< double, int >
224  {typedef double ResultType;};
225 
226 template<>
227 struct BasicConvTrait< int, double >
228  {typedef double ResultType;};
229 
230 template<>
231 struct BasicConvTrait< double, float >
232  {typedef double ResultType;};
233 
234 template<>
235 struct BasicConvTrait< float, double >
236  {typedef double ResultType;};
237 
238 template<>
239 struct BasicConvTrait< float, int >
240  {typedef float ResultType;};
241 
242 template<>
243 struct BasicConvTrait< int, float >
244  {typedef float ResultType;};
245 
246 template<>
247 struct BasicConvTrait< int, int >
248  {typedef int ResultType;};
249 
250 template<class A >
251 struct BasicConvTrait< A, A >
252  {typedef A ResultType;};
253 
254 
256 // conversion traits for more advanced types //
258 template< class A, class B >
259 struct ConvTrait;
260 
261 template< class A, class B >
262 class ConvTrait<Expr<A>, Expr<B> > {
263  private:
264  typedef typename Expr<A>::RetType LReturn;
265  typedef typename Expr<B>::RetType RReturn;
266  public:
268 };
269 
270 template< class A , class ArgType>
272 
273 template<class ArgType>
274 struct ToExprTraits<double, ArgType> {
276 };
277 
278 template<class ArgType>
279 struct ToExprTraits<int, ArgType>{
281 };
282 
283 
285 // operators for expressions //
287 template< template<class T> class Op, class A, class B >
289 
290 template< template<class T> class Op, class A, class B>
291 class operator_trait< Expr<A>, Op, Expr<B> > {
292  private:
293  typedef typename ConvTraits< Expr<A>, Expr<B> >::ResultType ResultType;
294  public:
295  typedef BinOp< Expr<A>, Op< ResultType >, Expr<B> > ReturnBaseType;
297 };
298 
299 template< template<class T> class Op, class A, class B >
300 class operator_trait< Op, A, Expr<B> > {
301  private:
302  typedef typename Expr<B>::ArgType ArgType;
303  typedef typename ToExprTrait<A, ArgType>::ToExprType ToExprType;
304  typedef typename ConvTraits ToExprType, Expr<B> >::ResultType ResultType;
305  public:
309 };
310 
311 template< template<class T> class Op, class A, class B >
312 class operator_trait< Op, Expr<A>, B > {
313  private:
314  typedef typename Expr<A>::ArgType ArgType;
315  typedef typename ToExprTrait<B, ArgType>::ToExprType ToExprType;
316  typedef typename ConvTraits< Expr<A>, ToExprType >::ResultType ResultType;
317  public:
319  typedef BinOp< Expr<A>, Op<ResultType>, ToExprType > ReturnBaseType;
321 };
322 
323 
324 
326 // Expression templates //
328 
329 // operator+
330 template< class A, class B >
332 operator+( const TExpr<A>& A, const TExpr<B>& B ) {
333  typedef typename operator_trait< Expr<A>, Add, TExpr<B> >::ReturnBaseType ReturnBaseType;
334  typedef typename operator_trait< Expr<A>, Add, TExpr<B> >::ReturnType ReturnType;
335  return ReturnType( ReturnBaseType(A, B) );
336 }
337 
338 template< class A, class B >
339 typename operator_trait< A, Add , Expr<B> >::ReturnType
340 operator+( const A& A, const Expr<B>& B ) {
341  typedef typename operator_trait< A, Add, Expr<B> >::LToExpr LToExpr;
342  typedef typename operator_trait< A, Add, Expr<B> >::ReturnBaseType ReturnBaseType;
344  return ReturnType( ReturnBaseType(LToExpr(A), B) );
345 }
346 
347 template< class A, class B >
348 typename operator_trait< Expr<A>, Add, B >::ReturnType
349 operator+( const Expr<A>& A, const B& B ) {
350  typedef typename operator_trait< Expr<A>, Add, B >::RToExpr RToExpr;
351  typedef typename operator_trait< Expr<A>, Add, B >::ReturnBaseType ReturnBaseType;
352  typedef typename operator_trait< Expr<A>, Add, B >::ReturnType ReturnType;
353  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
354 }
355 
356 
357 // operator*
358 template< class A, class B >
359 typename operator_trait< Expr<A>, Mul, Expr<B> >::ReturnType
360 operator*( const Expr<A>& A, const Expr<B>& B ) {
361  typedef typename operator_trait< Expr<A>, Mul, Expr<B> >::ReturnBaseType ReturnBaseType;
362  typedef typename operator_trait< Expr<A>, Mul, Expr<B> >::ReturnType ReturnType;
363  return ReturnType( ReturnBaseType(A, B) );
364 }
365 
366 template< class A, class B >
367 typename operator_trait< A, Mul, Expr<B> >::ReturnType
368 operator*( const A& A, const Expr<B>& B ) {
369  typedef typename operator_trait< A, Mul, Expr<B> >::LToExpr LToExpr;
370  typedef typename operator_trait< A, Mul, Expr<B> >::ReturnBaseType ReturnBaseType;
372  return ReturnType( ReturnBaseType(LToExpr(A), B) );
373 }
374 
375 template< class A, class B >
376 typename operator_trait< Expr<A>, Mul, B >::ReturnType
377 operator*( const Expr<A>& A, const B& B ){
378  typedef typename operator_trait< Expr<A>, Mul, B >::RToExpr RToExpr;
379  typedef typename operator_trait< Expr<A>, Mul, B >::ReturnBaseType ReturnBaseType;
380  typedef typename operator_trait< Expr<A>, Mul, B >::ReturnType ReturnType;
381  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
382 }
383 
384 
385 // operator/
386 template< class A, class B >
387 typename operator_trait< Expr<A>, Div, Expr<B> >::ReturnType
388 operator/( const Expr<A>& A, const Expr<B>& B ) {
389  typedef typename operator_trait< Expr<A>, Div, Expr<B> >::ReturnBaseType ReturnBaseType;
390  typedef typename operator_trait< Expr<A>, Div, Expr<B> >::ReturnType ReturnType;
391  return ReturnType( ReturnBaseType(A, B) );
392 }
393 
394 template< class A, class B >
395 typename operator_trait< A , Div, Expr<B> >::ReturnType
396 operator/( const A& A, const Expr<B>& B ) {
397  typedef typename operator_trait< A, Div, Expr<B> >::LToExpr LToExpr;
398  typedef typename operator_trait< A, Div, Expr<B> >::ReturnBaseType ReturnBaseType;
400  return ReturnType( ReturnBaseType(LToExpr(A), B) );
401 }
402 
403 template< class A, class B >
404 typename operator_trait< Expr<A>, Div, B >::ReturnType
405 operator/( const Expr<A>& A, const B& B ) {
406  typedef typename operator_trait< Expr<A>, Div, B >::RToExpr RToExpr;
407  typedef typename operator_trait< Expr<A>, Div, B >::ReturnBaseType ReturnBaseType;
408  typedef typename operator_trait< Expr<A>, Div, B >::ReturnType ReturnType;
409  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
410 }
411 
412 
413 // operator&&
414 template< class A, class B >
415 typename operator_trait< Expr<A>, And, Expr<B> >::ReturnType
416 operator&&( const Expr<A>& A, const Expr<B>& B )
417 {
418  typedef typename operator_trait< Expr<A>, And, Expr<B> >::ReturnBaseType ReturnBaseType;
419  typedef typename operator_trait< Expr<A>, And, Expr<B> >::ReturnType ReturnType;
420  return ReturnType( ReturnBaseType(A, B) );
421 }
422 
423 
424 template< class A, class B >
425 typename operator_trait< A, And, Expr<B> >::ReturnType
426 operator&&( const A& A, const Expr<B>& B ) {
427  typedef typename operator_trait< A, And, Expr<B> >::LToExpr LToExpr;
428  typedef typename operator_trait< A, And, Expr<B> >::ReturnBaseType ReturnBaseType;
430  return ReturnType( ReturnBaseType(LToExpr(A), B) );
431 }
432 
433 template< class A, class B >
434 typename operator_trait< Expr<A>, And, B >::ReturnType
435 operator&&( const Expr<A>& A, const B& B ) {
436  typedef typename operator_trait< Expr<A>, And, B >::RToExpr RToExpr;
437  typedef typename operator_trait< Expr<A>, And, B >::ReturnBaseType ReturnBaseType;
438  typedef typename operator_trait< Expr<A>, And, B >::ReturnType ReturnType;
439  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
440 }
441 
442 
443 // operator||
444 template< class A, class B >
445 typename operator_trait< Expr<A>, Or, Expr<B> >::ReturnType
446 operator||( const Expr<A>& A, const Expr<B>& B ) {
447  typedef typename operator_trait< Expr<A>, Or, Expr<B> >::ReturnBaseType ReturnBaseType;
448  typedef typename operator_trait< Expr<A>, Or, Expr<B> >::ReturnType ReturnType;
449  return ReturnType( ReturnBaseType(A, B) );
450 }
451 
452 template< class A, class B >
453 typename operator_trait< A, Or, Expr<B> >::ReturnType
454 operator||( const A& A, const Expr<B>& B ) {
455  typedef typename operator_trait< A, Or, Expr<B> >::LToExpr LToExpr;
456  typedef typename operator_trait< A, Or, Expr<B> >::ReturnBaseType ReturnBaseType;
458  return ReturnType( ReturnBaseType(LToExpr(A), B) );
459 }
460 
461 template< class A, class B >
462 typename operator_trait< Expr<A>, Or, B >::ReturnType
463 operator||( const Expr<A>& A, const B& B ) {
464  typedef typename operator_trait< Expr<A>, Or, B >::RToExpr RToExpr;
465  typedef typename operator_trait< Expr<A>, Or, B >::ReturnBaseType ReturnBaseType;
466  typedef typename operator_trait< Expr<A>, Or, B >::ReturnType ReturnType;
467  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
468 }
469 
470 
471 // operator<
472 template< class A, class B >
473 typename operator_trait< Expr<A>, Less, Expr<B> >::ReturnType
474 operator<( const Expr<A>& A, const Expr<B>& B ){
475  typedef typename operator_trait< Expr<A>, Less, Expr<B> >::ReturnBaseType ReturnBaseType;
476  typedef typename operator_trait< Expr<A>, Less, Expr<B> >::ReturnType ReturnType;
477  return ReturnType( ReturnBaseType(A, B) );
478 }
479 
480 template< class A, class B >
481 typename operator_trait< A , Less, TExpr<B> >::ReturnType
482 operator<( const A& A, const Expr<B>& B ){
483  typedef typename operator_trait< A, Less, TExpr<B> >::LToExpr LToExpr;
484  typedef typename operator_trait< A, Less, TExpr<B> >::ReturnBaseType ReturnBaseType;
486  return ReturnType( ReturnBaseType(LToExpr(A), B) );
487 }
488 
489 template< class A, class B >
490 typename operator_trait< Expr<A>, Less, B >::ReturnType
491 operator<( const Expr<A>& A, const B& B ){
492  typedef typename operator_trait< TLt, TExpr<A>, B >::RToExpr RToExpr;
493  typedef typename operator_trait< TLt, TExpr<A>, B >::ReturnBaseType ReturnBaseType;
494  typedef typename operator_trait< TLt, TExpr<A>, B >::ReturnType ReturnType;
495  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
496 }
497 
498 
499 // operator<=
500 template< class A, class B >
501 typename operator_trait< Expr<A>, LessEqual, Expr<B> >::ReturnType
502 operator<=( const Expr<A>& A, const Expr<B>& B ) {
503  typedef typename operator_trait< Expr<A>, LessEqual, Expr<B> >::ReturnBaseType ReturnBaseType;
504  typedef typename operator_trait< Expr<A>, LessEqual, Expr<B> >::ReturnType ReturnType;
505  return ReturnType( ReturnBaseType(A, B) );
506 }
507 
508 template< class A, class B >
509 typename operator_trait< A, LessEqual, Expr<B> >::ReturnType
510 operator<=( const A& A, const Expr<B>& B ) {
512  typedef typename operator_trait< A, LessEqual, Expr<B> >::LToExpr LToExpr;
513  typedef typename operator_trait< A, LessEqual, Expr<B> >::ReturnBaseType ReturnBaseType;
515  return ReturnType( ReturnBaseType(LToExpr(A), B) );
516 }
517 
518 template< class A, class B >
519 typename operator_trait< Expr<A>, LessEqual, B >::ReturnType
520 operator<=( const Expr<A>& A, const B& B ) {
521  typedef typename operator_trait< Expr<A>, LessEqual, B >::RToExpr RToExpr;
522  typedef typename operator_trait< Expr<A>, LessEqual, B >::ReturnBaseType ReturnBaseType;
523  typedef typename operator_trait< Expr<A>, LessEqual, B >::ReturnType ReturnType;
524  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
525 }
526 
527 
528 // operator>
529 template< class A, class B >
530 typename operator_trait< Expr<A>, More, Expr<B> >::ReturnType
531 operator>( const Expr<A>& A, const Expr<B>& B ) {
532  typedef typename operator_trait< Expr<A>, More, Expr<B> >::ReturnBaseType ReturnBaseType;
533  typedef typename operator_trait< Expr<A>, More, Expr<B> >::ReturnType ReturnType;
534  return ReturnType( ReturnBaseType(A, B) );
535 }
536 
537 template< class A, class B >
538 typename operator_trait< A, More, Expr<B> >::ReturnType
539 operator>( const A& A, const Expr<B>& B ) {
540  typedef typename operator_trait< A, More, Expr<B> >::LToExpr LToExpr;
541  typedef typename operator_trait< A, More, Expr<B> >::ReturnBaseType ReturnBaseType;
543  return ReturnType( ReturnBaseType(LToExpr(A), B) );
544 }
545 
546 template< class A, class B >
547 typename operator_trait< Expr<A>, More, B >::ReturnType
548 operator>( const Expr<A>& A, const B& B ) {
549  typedef typename operator_trait< Expr<A>, More, B >::RToExpr RToExpr;
550  typedef typename operator_trait< Expr<A>, More, B >::ReturnBaseType ReturnBaseType;
551  typedef typename operator_trait< Expr<A>, More, B >::ReturnType ReturnType;
552  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
553 }
554 
555 
556 // operator>=
557 template< class A, class B >
558 typename operator_trait< Expr<A>, MoreEqual, TExpr<B> >::ReturnType
559 operator>=( const Expr<A>& A, const Expr<B>& B ) {
560  typedef typename operator_trait< Expr<A>, MoreEqual, Expr<B> >::ReturnBaseType ReturnBaseType;
561  typedef typename operator_trait< Expr<A>, MoreEqual, Expr<B> >::ReturnType ReturnType;
562  return ReturnType( ReturnBaseType(A, B) );
563 }
564 
565 template< class A, class B >
566 typename operator_trait< A , MoreEqual, TExpr<B> >::ReturnType
567 operator>=( const A& A, const Expr<B>& B ) {
568  typedef typename operator_trait< A, MoreEqual, Expr<B> >::LToExpr LToExpr;
569  typedef typename operator_trait< A, MoreEqual, Expr<B> >::ReturnBaseType ReturnBaseType;
571  return ReturnType( ReturnBaseType(LToExpr(A), B) );
572 }
573 
574 template< class A, class B >
575 typename operator_trait< Expr<A>, MoreEqual, B >::ReturnType
576 operator>=( const Expr<A>& A, const B& B ) {
577  typedef typename operator_trait< Expr<A>, MoreEqual, B >::RToExpr RToExpr;
578  typedef typename operator_trait< Expr<A>, MoreEqual, B >::ReturnBaseType ReturnBaseType;
579  typedef typename operator_trait< Expr<A>, MoreEqual, B >::ReturnType ReturnType;
580  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
581 }
582 
583 
584 
585 //------------------------- operator== --------------------------------------------------
586 template< class A, class B >
587 typename operator_trait< Expr<A>, Equal, Expr<B> >::ReturnType
588 operator==( const Expr<A>& A, const Expr<B>& B ) {
589  typedef typename operator_trait< Expr<A>, Equal, Expr<B> >::ReturnBaseType ReturnBaseType;
590  typedef typename operator_trait< Expr<A>, Equal, Expr<B> >::ReturnType ReturnType;
591  return ReturnType( ReturnBaseType(A, B) );
592 }
593 
594 template< class A, class B >
595 typename operator_trait< A , Equal, Expr<B> >::ReturnType
596 operator==( const A& A, const Expr<B>& B ) {
597  typedef typename operator_trait< A, Equal, Expr<B> >::LToExpr LToExpr;
598  typedef typename operator_trait< A, Equal, Expr<B> >::ReturnBaseType ReturnBaseType;
600  return ReturnType( ReturnBaseType(LToExpr(A), B) );
601 }
602 
603 template< class A, class B >
604 typename operator_trait< Expr<A>, Equal, B >::ReturnType
605 operator==( const Expr<A>& A, const B& B ) {
606  typedef typename operator_trait< Expr<A>, Equal, B >::RToExpr RToExpr;
607  typedef typename operator_trait< Expr<A>, Equal, B >::ReturnBaseType ReturnBaseType;
608  typedef typename operator_trait< Expr<A>, Equal, B >::ReturnType ReturnType;
609  return ReturnType( ReturnBaseType(A, RToExpr(B)) );
610 }
611 
612 
613 }// namespace
614 
615 #endif
RetType operator()(const ArgType &) const
Definition: Expressions.h:59
AnExpr::RetType RetType
Definition: Expressions.h:37
static RetType apply(const RetType &a, const RetType &b)
Definition: Expressions.h:126
ConvTraits< Expr< A >, Expr< B > >::ResultType ResultType
Definition: Expressions.h:293
RetType operator()(const ArgType &x) const
Definition: Expressions.h:204
virtual ExprBase * clone()
Definition: Expressions.h:14
static RetType apply(const RetType &a, const RetType &b)
Definition: Expressions.h:119
AnExpr mExpr
Definition: Expressions.h:44
double_binary B
Definition: DDStreamer.cc:234
BasicConvTrait< LReturn, RReturn >::ResultType ResultType
Definition: Expressions.h:267
ToExprTrait< A, ArgType >::ToExprType ToExprType
Definition: Expressions.h:303
virtual bool operator()(const T &x) const
Definition: Expressions.h:13
static RetType apply(const T &a, const T &b)
Definition: Expressions.h:182
void operator()(Type *aClass)
Definition: Expressions.h:25
RetType operator()(const ArgType &x) const
Definition: Expressions.h:91
static RetType apply(const T &a, const T &b)
Definition: Expressions.h:161
BinOp(const A &A, const B &B)
Definition: Expressions.h:201
AnExpr::ArgType ArgType
Definition: Expressions.h:36
RetType operator()(const ArgType &x) const
Definition: Expressions.h:75
ConvTraits Expr< B >::ResultType ResultType
Definition: Expressions.h:304
ExprBase< Type > * tmp
Definition: Expressions.h:27
operator_trait< Expr< A >, Div, Expr< B > >::ReturnType operator/(const Expr< A > &A, const Expr< B > &B)
Definition: Expressions.h:388
void operator=(Expr e)
Definition: Expressions.h:24
operator_trait< Expr< A >, Mul, Expr< B > >::ReturnType operator*(const Expr< A > &A, const Expr< B > &B)
Definition: Expressions.h:360
Expr< ExprLiteral< int, ArgType > > ToExprType
Definition: Expressions.h:280
std::map< DetId, double > ReturnType
Expr(const AnExpr &expr=AnExpr())
Definition: Expressions.h:39
reco::JetExtendedAssociation::JetExtendedData Value
operator_trait< Expr< A >, Add, Expr< B > >::ReturnType operator+(const TExpr< A > &A, const TExpr< B > &B)
Definition: Expressions.h:332
Operation::RetType RetType
Definition: Expressions.h:198
ToExprTrait< B, ArgType >::ToExprType ToExprType
Definition: Expressions.h:315
operator_trait< Expr< A >, Or, Expr< B > >::ReturnType operator||(const Expr< A > &A, const Expr< B > &B)
Definition: Expressions.h:446
ExprUserFun(Value(ActON::*aFun)() const )
Definition: Expressions.h:88
bool RetType
Definition: Expressions.h:174
BinOp< Expr< A >, Op< ResultType >, Expr< B > > ReturnBaseType
Definition: Expressions.h:295
RetType operator()(const ArgType &x) const
Definition: Expressions.h:40
bool RetType
Definition: Expressions.h:160
Expr< ExprLiteral< double, ArgType > > ToExprType
Definition: Expressions.h:275
static RetType apply(const RetType &a, const RetType &b)
Definition: Expressions.h:112
operator_trait< Expr< A >, MoreEqual, TExpr< B > >::ReturnType operator>=(const Expr< A > &A, const Expr< B > &B)
Definition: Expressions.h:559
static RetType apply(const RetType &a, const RetType &b)
Definition: Expressions.h:105
static RetType apply(const T &a, const T &b)
Definition: Expressions.h:168
BinOp< ToExprType, Op< ResultType >, Expr< B > > ReturnBaseType
Definition: Expressions.h:307
double b
Definition: hdecay.h:120
hold basic identities
Definition: Expressions.h:69
operator_trait< Expr< A >, And, Expr< B > >::ReturnType operator&&(const Expr< A > &A, const Expr< B > &B)
Definition: Expressions.h:416
static RetType apply(const T &a, const T &b)
Definition: Expressions.h:175
double a
Definition: hdecay.h:121
static RetType apply(bool a, bool b)
Definition: Expressions.h:150
RetType(ActON::* mFun)() const
Definition: Expressions.h:95
Definition: DDAxes.h:10
operator_trait< Expr< A >, More, Expr< B > >::ReturnType operator>(const Expr< A > &A, const Expr< B > &B)
Definition: Expressions.h:531
A::ArgType ArgType
Definition: Expressions.h:199
ExprLiteral(const RetType &val)
Definition: Expressions.h:56
long double T
BinOp< Expr< A >, Op< ResultType >, ToExprType > ReturnBaseType
Definition: Expressions.h:319
ConvTraits< Expr< A >, ToExprType >::ResultType ResultType
Definition: Expressions.h:316
Vec apply(Vec v, F f)
Definition: ExtVec.h:70
static RetType apply(const T &a, const T &b)
Definition: Expressions.h:189
static RetType apply(bool a, bool b)
Definition: Expressions.h:140
::boost::mpl::if_< D1, D1, typename::boost::mpl::if_< D2, D2, D0 >::type >::type Div
Definition: Factorize.h:147
operator_trait< Expr< A >, Equal, Expr< B > >::ReturnType operator==(const Expr< A > &A, const Expr< B > &B)
Definition: Expressions.h:588