CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/HLTrigger/JetMET/interface/AlphaT.h

Go to the documentation of this file.
00001 #ifndef HLTrigger_JetMET_AlphaT_h
00002 #define HLTrigger_JetMET_AlphaT_h
00003 
00004 #include <algorithm>
00005 #include <functional>
00006 #include <vector>
00007 
00008 
00009 class AlphaT {
00010 public:
00011   template <class T>
00012   AlphaT(std::vector<T const *> const & p4, bool use_et = true);
00013 
00014   template <class T>
00015   AlphaT(std::vector<T> const & p4, bool use_et = true);
00016 
00017 private:
00018   std::vector<double> et_;
00019   std::vector<double> px_;
00020   std::vector<double> py_;
00021 
00022 public:
00023   inline double value(void) const;
00024   inline double value(std::vector<bool> & jet_sign) const;
00025 
00026 private:
00027   double value_(std::vector<bool> * jet_sign) const;
00028 };
00029 
00030 
00031 // -----------------------------------------------------------------------------
00032 template<class T>
00033 AlphaT::AlphaT(std::vector<T const *> const & p4, bool use_et /* = true */) {
00034   std::transform( p4.begin(), p4.end(), back_inserter(et_), ( use_et ? std::mem_fun(&T::Et) : std::mem_fun(&T::Pt) ) );
00035   std::transform( p4.begin(), p4.end(), back_inserter(px_), std::mem_fun(&T::Px) );
00036   std::transform( p4.begin(), p4.end(), back_inserter(py_), std::mem_fun(&T::Py) );
00037 }
00038 
00039 // -----------------------------------------------------------------------------
00040 template<class T>
00041 AlphaT::AlphaT(std::vector<T> const & p4, bool use_et /* = true */) {
00042   std::transform( p4.begin(), p4.end(), back_inserter(et_), std::mem_fun_ref( use_et ? &T::Et : &T::Pt ) );
00043   std::transform( p4.begin(), p4.end(), back_inserter(px_), std::mem_fun_ref(&T::Px) );
00044   std::transform( p4.begin(), p4.end(), back_inserter(py_), std::mem_fun_ref(&T::Py) );
00045 }
00046 
00047 
00048 // -----------------------------------------------------------------------------
00049 inline
00050 double AlphaT::value(void) const {
00051   return value_(0);
00052 }
00053 
00054 // -----------------------------------------------------------------------------
00055 inline
00056 double AlphaT::value(std::vector<bool> & jet_sign) const {
00057   return value_(& jet_sign);
00058 }
00059 
00060 #endif // HLTrigger_JetMET_AlphaT_h