CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlphaT.h
Go to the documentation of this file.
1 #ifndef HLTrigger_JetMET_AlphaT_h
2 #define HLTrigger_JetMET_AlphaT_h
3 
4 #include <algorithm>
5 #include <functional>
6 #include <vector>
7 
8 
9 class AlphaT {
10 public:
11  template <class T>
12  AlphaT(std::vector<T const *> const & p4, bool use_et = true);
13 
14  template <class T>
15  AlphaT(std::vector<T> const & p4, bool use_et = true);
16 
17 private:
18  std::vector<double> et_;
19  std::vector<double> px_;
20  std::vector<double> py_;
21 
22 public:
23  inline double value(void) const;
24  inline double value(std::vector<bool> & jet_sign) const;
25 
26 private:
27  double value_(std::vector<bool> * jet_sign) const;
28 };
29 
30 
31 // -----------------------------------------------------------------------------
32 template<class T>
33 AlphaT::AlphaT(std::vector<T const *> const & p4, bool use_et /* = true */) {
34  std::transform( p4.begin(), p4.end(), back_inserter(et_), ( use_et ? std::mem_fun(&T::Et) : std::mem_fun(&T::Pt) ) );
35  std::transform( p4.begin(), p4.end(), back_inserter(px_), std::mem_fun(&T::Px) );
36  std::transform( p4.begin(), p4.end(), back_inserter(py_), std::mem_fun(&T::Py) );
37 }
38 
39 // -----------------------------------------------------------------------------
40 template<class T>
41 AlphaT::AlphaT(std::vector<T> const & p4, bool use_et /* = true */) {
42  std::transform( p4.begin(), p4.end(), back_inserter(et_), std::mem_fun_ref( use_et ? &T::Et : &T::Pt ) );
43  std::transform( p4.begin(), p4.end(), back_inserter(px_), std::mem_fun_ref(&T::Px) );
44  std::transform( p4.begin(), p4.end(), back_inserter(py_), std::mem_fun_ref(&T::Py) );
45 }
46 
47 
48 // -----------------------------------------------------------------------------
49 inline
50 double AlphaT::value(void) const {
51  return value_(0);
52 }
53 
54 // -----------------------------------------------------------------------------
55 inline
56 double AlphaT::value(std::vector<bool> & jet_sign) const {
57  return value_(& jet_sign);
58 }
59 
60 #endif // HLTrigger_JetMET_AlphaT_h
std::vector< double > px_
Definition: AlphaT.h:19
Definition: AlphaT.h:9
std::vector< double > py_
Definition: AlphaT.h:20
double value_(std::vector< bool > *jet_sign) const
Definition: AlphaT.cc:3
std::vector< double > et_
Definition: AlphaT.h:18
double p4[4]
Definition: TauolaWrapper.h:92
AlphaT(std::vector< T const * > const &p4, bool use_et=true)
Definition: AlphaT.h:33
double value(void) const
Definition: AlphaT.h:50