Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:44

0001 #ifndef HLTrigger_JetMET_AlphaT_h
0002 #define HLTrigger_JetMET_AlphaT_h
0003 
0004 #include <algorithm>
0005 #include <functional>
0006 #include <vector>
0007 
0008 class AlphaT {
0009 public:
0010   template <class T>
0011   AlphaT(std::vector<T const *> const &p4, bool setDHtZero = false, bool use_et = true);
0012 
0013   template <class T>
0014   AlphaT(std::vector<T> const &p4, bool setDHtZero = false, bool use_et = true);
0015 
0016 private:
0017   std::vector<double> et_;
0018   std::vector<double> px_;
0019   std::vector<double> py_;
0020 
0021 public:
0022   inline double value(void) const;
0023   inline double value(std::vector<bool> &jet_sign) const;
0024 
0025 private:
0026   double value_(std::vector<bool> *jet_sign) const;
0027   bool setDHtZero_;
0028 };
0029 
0030 // -----------------------------------------------------------------------------
0031 template <class T>
0032 AlphaT::AlphaT(std::vector<T> const &p4, bool setDHtZero, bool use_et /* = true */) {
0033   std::transform(p4.begin(), p4.end(), back_inserter(et_), std::mem_fn(use_et ? &T::Et : &T::Pt));
0034   std::transform(p4.begin(), p4.end(), back_inserter(px_), std::mem_fn(&T::Px));
0035   std::transform(p4.begin(), p4.end(), back_inserter(py_), std::mem_fn(&T::Py));
0036   setDHtZero_ = setDHtZero;
0037 }
0038 
0039 // -----------------------------------------------------------------------------
0040 inline double AlphaT::value(void) const { return value_(nullptr); }
0041 
0042 // -----------------------------------------------------------------------------
0043 inline double AlphaT::value(std::vector<bool> &jet_sign) const { return value_(&jet_sign); }
0044 
0045 #endif  // HLTrigger_JetMET_AlphaT_h