Go to the documentation of this file.00001 #include "HLTrigger/JetMET/interface/AlphaT.h"
00002
00003 double AlphaT::value_(std::vector<bool> * jet_sign) const {
00004
00005
00006 if (jet_sign) {
00007 jet_sign->clear();
00008 jet_sign->resize(et_.size());
00009 }
00010
00011
00012 if (et_.size() == 0)
00013
00014 return 0.;
00015
00016 if (et_.size() > (unsigned int) std::numeric_limits<unsigned int>::digits)
00017
00018 return std::numeric_limits<double>::max();
00019
00020
00021 const double sum_et = std::accumulate( et_.begin(), et_.end(), 0. );
00022 const double sum_px = std::accumulate( px_.begin(), px_.end(), 0. );
00023 const double sum_py = std::accumulate( py_.begin(), py_.end(), 0. );
00024
00025
00026 double min_delta_sum_et = sum_et;
00027
00028 for (unsigned int i = 0; i < (1U << (et_.size() - 1)); i++) {
00029 double delta_sum_et = 0.;
00030 for (unsigned int j = 0; j < et_.size(); ++j) {
00031 if (i & (1U << j))
00032 delta_sum_et -= et_[j];
00033 else
00034 delta_sum_et += et_[j];
00035 }
00036 delta_sum_et = std::abs(delta_sum_et);
00037 if (delta_sum_et < min_delta_sum_et) {
00038 min_delta_sum_et = delta_sum_et;
00039 if (jet_sign) {
00040 for (unsigned int j = 0; j < et_.size(); ++j)
00041 (*jet_sign)[j] = ((i & (1U << j)) == 0);
00042 }
00043 }
00044 }
00045
00046
00047 return (0.5 * (sum_et - min_delta_sum_et) / sqrt( sum_et*sum_et - (sum_px*sum_px+sum_py*sum_py) ));
00048 }