CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/HLTrigger/JetMET/src/AlphaT.cc

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   // Clear pseudo-jet container
00006   if (jet_sign) {
00007     jet_sign->clear();
00008     jet_sign->resize(et_.size());
00009   }
00010 
00011   // check the size of the input collection
00012   if (et_.size() == 0)
00013     // empty jet collection, return AlphaT = 0
00014     return 0.;
00015 
00016   if (et_.size() > (unsigned int) std::numeric_limits<unsigned int>::digits)
00017     // too many jets, return AlphaT = a very large number
00018     return std::numeric_limits<double>::max();
00019 
00020   // Momentum sums in transverse plane
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   // Minimum Delta Et for two pseudo-jets
00026   double min_delta_sum_et = sum_et;
00027 
00028   for (unsigned int i = 0; i < (1U << (et_.size() - 1)); i++) { //@@ iterate through different combinations
00029     double delta_sum_et = 0.;
00030     for (unsigned int j = 0; j < et_.size(); ++j) { //@@ iterate through jets
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   // Alpha_T
00047   return (0.5 * (sum_et - min_delta_sum_et) / sqrt( sum_et*sum_et - (sum_px*sum_px+sum_py*sum_py) ));  
00048 }