#include <CondFormats/L1TObjects/interface/L1GctJetEtCalibrationFunction.h>
Public Types | |
enum | CorrectionFunctionType { POWER_SERIES_CORRECTION, ORCA_STYLE_CORRECTION, PIECEWISE_CUBIC_CORRECTION, NO_CORRECTION } |
Public Member Functions | |
uint16_t | calibratedEt (const double correctedEt) const |
Convert the corrected Et value to a linear Et for Ht summing. | |
double | correctedEt (const double et, const unsigned eta, const bool tauVeto) const |
apply jet Et correction Eta takes a value from 0-10, corresponding to jet regions running from eta=0.0 to eta=5.0 | |
double | getHtScaleLSB () const |
Access method for Ht scale (LSB for integer->physical conversion, in GeV units). | |
double | getThreshold () const |
Access method for jet threshold (in GeV units). | |
L1GctJetEtCalibrationFunction () | |
void | setConversionToEnergyOff () |
void | setConversionToEnergyOn (const std::vector< double > &conversionFunc) |
set the look-up table to return energy, rather than Et | |
void | setCorrectionFunctionType (const CorrectionFunctionType cft) |
set the type of correction function to use | |
void | setParams (const double &htScale, const double &threshold, const std::vector< std::vector< double > > &jetCalibFunc, const std::vector< std::vector< double > > &tauCalibFunc) |
set other parameters | |
~L1GctJetEtCalibrationFunction () | |
Static Public Attributes | |
static const unsigned | N_CENTRAL_ETA_VALUES = 7 |
Number of eta bins for separate tau correction. | |
static const unsigned | NUMBER_ETA_VALUES = 11 |
Number of eta bins used in correction. | |
Private Member Functions | |
double | findCorrectedEt (const double Et, const std::vector< double > &coeffs) const |
Find the corrected Et value for this jet. | |
double | orcaStyleCorrect (const double Et, const std::vector< double > &coeffs) const |
double | piecewiseCubicCorrect (const double Et, const std::vector< double > &coeffs) const |
double | powerSeriesCorrect (const double Et, const std::vector< double > &coeffs) const |
uint16_t | rank (const double Et) const |
Convert the corrected Et value to a non-linear jet rank for sorting. | |
Private Attributes | |
bool | m_convertToEnergy |
CorrectionFunctionType | m_corrFunType |
type of correction function to apply | |
std::vector< double > | m_energyConversion |
double | m_htScaleLSB |
scale and threshold parameters | |
std::vector< std::vector < double > > | m_jetCalibFunc |
the calibration function - converts jet Et to linear | |
std::vector< std::vector < double > > | m_tauCalibFunc |
double | m_threshold |
Friends | |
std::ostream & | operator<< (std::ostream &os, const L1GctJetEtCalibrationFunction &fn) |
Overload << operator. |
This used to be part of JetEtCalibrationLut, now separated out on its own.
============================================================================
The external entry points are
double L1GctJetCalibrationFunction::correctedEt (const double et, const unsigned eta, const bool tauVeto) const; uint16_t L1GctJetCalibrationFunction::calibratedEt(const double correctedEt) const;
============================================================================
Definition at line 34 of file L1GctJetEtCalibrationFunction.h.
Definition at line 37 of file L1GctJetEtCalibrationFunction.h.
00037 { POWER_SERIES_CORRECTION, 00038 ORCA_STYLE_CORRECTION, 00039 PIECEWISE_CUBIC_CORRECTION, 00040 NO_CORRECTION };
L1GctJetEtCalibrationFunction::L1GctJetEtCalibrationFunction | ( | ) |
Definition at line 15 of file L1GctJetEtCalibrationFunction.cc.
00016 : m_corrFunType(POWER_SERIES_CORRECTION), 00017 m_convertToEnergy(false), 00018 m_htScaleLSB(1.0), m_threshold(1.0), 00019 m_jetCalibFunc(), m_tauCalibFunc(), m_energyConversion() 00020 { 00021 }
L1GctJetEtCalibrationFunction::~L1GctJetEtCalibrationFunction | ( | ) |
uint16_t L1GctJetEtCalibrationFunction::calibratedEt | ( | const double | correctedEt | ) | const |
Convert the corrected Et value to a linear Et for Ht summing.
Convert the corrected Et value to an integer Et for Ht summing.
Definition at line 205 of file L1GctJetEtCalibrationFunction.cc.
References L1CaloEtScale::linScaleMax, and m_htScaleLSB.
Referenced by L1GctJetEtCalibrationLut::value().
00206 { 00207 double scaledEt = correctedEt / m_htScaleLSB; 00208 00209 uint16_t jetEtOut = static_cast<uint16_t>(scaledEt); 00210 00211 if(jetEtOut > L1CaloEtScale::linScaleMax) { 00212 return L1CaloEtScale::linScaleMax; 00213 } else { 00214 return jetEtOut; 00215 } 00216 }
double L1GctJetEtCalibrationFunction::correctedEt | ( | const double | et, | |
const unsigned | eta, | |||
const bool | tauVeto | |||
) | const |
apply jet Et correction Eta takes a value from 0-10, corresponding to jet regions running from eta=0.0 to eta=5.0
Definition at line 104 of file L1GctJetEtCalibrationFunction.cc.
References findCorrectedEt(), m_convertToEnergy, m_energyConversion, m_jetCalibFunc, m_tauCalibFunc, m_threshold, N_CENTRAL_ETA_VALUES, NUMBER_ETA_VALUES, and HLT_VtxMuL3::result.
Referenced by L1GctJetEtCalibrationLut::value().
00107 { 00108 if ((tauVeto && eta>=NUMBER_ETA_VALUES) || (!tauVeto && eta>=N_CENTRAL_ETA_VALUES)) { 00109 return 0; 00110 } else { 00111 double result=0; 00112 if (tauVeto) { 00113 assert(eta<m_jetCalibFunc.size()); 00114 result=findCorrectedEt(et, m_jetCalibFunc.at(eta)); 00115 } else { 00116 assert(eta<m_tauCalibFunc.size()); 00117 result=findCorrectedEt(et, m_tauCalibFunc.at(eta)); 00118 } 00119 if (m_convertToEnergy) { result *= m_energyConversion.at(eta); } 00120 if (result>m_threshold) { return result; } 00121 else { return 0; } 00122 } 00123 }
double L1GctJetEtCalibrationFunction::findCorrectedEt | ( | const double | Et, | |
const std::vector< double > & | coeffs | |||
) | const [private] |
Find the corrected Et value for this jet.
Definition at line 127 of file L1GctJetEtCalibrationFunction.cc.
References m_corrFunType, ORCA_STYLE_CORRECTION, orcaStyleCorrect(), PIECEWISE_CUBIC_CORRECTION, piecewiseCubicCorrect(), POWER_SERIES_CORRECTION, powerSeriesCorrect(), and HLT_VtxMuL3::result.
Referenced by correctedEt().
00128 { 00129 double result=0; 00130 switch (m_corrFunType) 00131 { 00132 case POWER_SERIES_CORRECTION: 00133 result = powerSeriesCorrect(Et, coeffs); 00134 break; 00135 case ORCA_STYLE_CORRECTION: 00136 result = orcaStyleCorrect(Et, coeffs); 00137 break; 00138 case PIECEWISE_CUBIC_CORRECTION: 00139 result = piecewiseCubicCorrect(Et, coeffs); 00140 break; 00141 default: 00142 result = Et; 00143 } 00144 return result; 00145 }
double L1GctJetEtCalibrationFunction::getHtScaleLSB | ( | ) | const [inline] |
Access method for Ht scale (LSB for integer->physical conversion, in GeV units).
Definition at line 73 of file L1GctJetEtCalibrationFunction.h.
References m_htScaleLSB.
00073 { return m_htScaleLSB; }
double L1GctJetEtCalibrationFunction::getThreshold | ( | ) | const [inline] |
Access method for jet threshold (in GeV units).
Definition at line 77 of file L1GctJetEtCalibrationFunction.h.
References m_threshold.
00077 { return m_threshold; }
double L1GctJetEtCalibrationFunction::orcaStyleCorrect | ( | const double | Et, | |
const std::vector< double > & | coeffs | |||
) | const [private] |
Definition at line 156 of file L1GctJetEtCalibrationFunction.cc.
References funct::A, funct::C, funct::sqrt(), and dimuonsSequences_cff::threshold.
Referenced by findCorrectedEt().
00157 { 00158 // The coefficients are arranged in groups of four. The first in each group is a threshold value of Et. 00159 std::vector<double>::const_iterator next_coeff=coeffs.begin(); 00160 while (next_coeff != coeffs.end()) { 00161 double threshold = *next_coeff++; 00162 double A = *next_coeff++; 00163 double B = *next_coeff++; 00164 double C = *next_coeff++; 00165 if (Et>threshold) { 00166 // This function is an inverse quadratic: 00167 // (input Et) = A + B*(output Et) + C*(output Et)^2 00168 return 2*(Et-A)/(B+sqrt(B*B-4*A*C+4*Et*C)); 00169 } 00170 // If we are below all specified thresholds (or the vector is empty), return output=input. 00171 } 00172 return Et; 00173 }
double L1GctJetEtCalibrationFunction::piecewiseCubicCorrect | ( | const double | Et, | |
const std::vector< double > & | coeffs | |||
) | const [private] |
Definition at line 175 of file L1GctJetEtCalibrationFunction.cc.
References funct::A, funct::C, funct::D, and dimuonsSequences_cff::threshold.
Referenced by findCorrectedEt().
00176 { 00177 // The correction fuction is a set of 3rd order polynomials 00178 // Et_out = Et_in + (p0 + p1*Et_in + p2*Et_in^2 + p3*Et_in^3) 00179 // with different coefficients for different energy ranges. 00180 // The parameters are arranged in groups of five. 00181 // The first in each group is a threshold value of input Et, 00182 // followed by the four coefficients for the cubic function. 00183 double etOut = Et; 00184 std::vector<double>::const_iterator next_coeff=coeffs.begin(); 00185 while (next_coeff != coeffs.end()) { 00186 00187 // Read the coefficients from the vector 00188 double threshold = *next_coeff++; 00189 double A = *next_coeff++; //p0 00190 double B = *next_coeff++; //p1 00191 double C = *next_coeff++; //p2 00192 double D = *next_coeff++; //p3 00193 00194 // Check we are in the right energy range and make correction 00195 if (Et>threshold) { 00196 etOut += (A + etOut*(B + etOut*(C + etOut*D))) ; 00197 break; 00198 } 00199 00200 } 00201 return etOut; 00202 }
double L1GctJetEtCalibrationFunction::powerSeriesCorrect | ( | const double | Et, | |
const std::vector< double > & | coeffs | |||
) | const [private] |
Definition at line 147 of file L1GctJetEtCalibrationFunction.cc.
References i, and funct::pow().
Referenced by findCorrectedEt().
00148 { 00149 double corrEt = Et; 00150 for (unsigned i=0; i<coeffs.size();i++) { 00151 corrEt += coeffs.at(i)*pow(Et,(int)i); 00152 } 00153 return corrEt; 00154 }
uint16_t L1GctJetEtCalibrationFunction::rank | ( | const double | Et | ) | const [private] |
Convert the corrected Et value to a non-linear jet rank for sorting.
void L1GctJetEtCalibrationFunction::setConversionToEnergyOff | ( | ) |
Definition at line 45 of file L1GctJetEtCalibrationFunction.cc.
References m_convertToEnergy, and m_energyConversion.
00045 { 00046 m_convertToEnergy = false; 00047 m_energyConversion.clear(); 00048 }
void L1GctJetEtCalibrationFunction::setConversionToEnergyOn | ( | const std::vector< double > & | conversionFunc | ) |
set the look-up table to return energy, rather than Et
Definition at line 39 of file L1GctJetEtCalibrationFunction.cc.
References m_convertToEnergy, m_energyConversion, and NUMBER_ETA_VALUES.
00039 { 00040 assert (conversionFunc.size() == NUMBER_ETA_VALUES); 00041 m_convertToEnergy=true; 00042 m_energyConversion = conversionFunc; 00043 }
void L1GctJetEtCalibrationFunction::setCorrectionFunctionType | ( | const CorrectionFunctionType | cft | ) | [inline] |
set the type of correction function to use
Definition at line 54 of file L1GctJetEtCalibrationFunction.h.
References m_corrFunType.
00054 { m_corrFunType = cft; 00055 }
void L1GctJetEtCalibrationFunction::setParams | ( | const double & | htScale, | |
const double & | threshold, | |||
const std::vector< std::vector< double > > & | jetCalibFunc, | |||
const std::vector< std::vector< double > > & | tauCalibFunc | |||
) |
set other parameters
Definition at line 27 of file L1GctJetEtCalibrationFunction.cc.
References m_htScaleLSB, m_jetCalibFunc, m_tauCalibFunc, m_threshold, N_CENTRAL_ETA_VALUES, and NUMBER_ETA_VALUES.
00030 { 00031 assert ((jetCalibFunc.size() == NUMBER_ETA_VALUES) && (tauCalibFunc.size() == N_CENTRAL_ETA_VALUES)); 00032 m_htScaleLSB = htScale; 00033 m_threshold = threshold; 00034 m_jetCalibFunc = jetCalibFunc; 00035 m_tauCalibFunc = tauCalibFunc; 00036 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const L1GctJetEtCalibrationFunction & | fn | |||
) | [friend] |
Overload << operator.
Definition at line 50 of file L1GctJetEtCalibrationFunction.cc.
00051 { 00052 os << "=== Level-1 GCT : Jet Et Calibration Function ===" << std::endl; 00053 os << std::setprecision(2); 00054 os << "LSB for Ht scale is " << std::fixed << fn.m_htScaleLSB << ", jet veto threshold is " << fn.m_threshold << std::endl; 00055 if (fn.m_corrFunType == L1GctJetEtCalibrationFunction::NO_CORRECTION) { 00056 os << "No jet energy corrections applied" << std::endl; 00057 } else { 00058 switch (fn.m_corrFunType) 00059 { 00060 case L1GctJetEtCalibrationFunction::POWER_SERIES_CORRECTION: 00061 os << "Power series energy correction for jets is enabled" << std::endl; 00062 break; 00063 case L1GctJetEtCalibrationFunction::ORCA_STYLE_CORRECTION: 00064 os << "ORCA-style energy correction for jets is enabled" << std::endl; 00065 break; 00066 case L1GctJetEtCalibrationFunction::PIECEWISE_CUBIC_CORRECTION: 00067 os << "Piecewise 3rd-order polynomial energy correction for jets is enabled" << std::endl; 00068 break; 00069 default: 00070 os << "Unrecognised calibration function type" << std::endl; 00071 break; 00072 } 00073 os << "Non-tau jet correction coefficients" << std::endl; 00074 for (unsigned i=0; i<fn.m_jetCalibFunc.size(); i++){ 00075 os << "Eta =" << std::setw(2) << i; 00076 if (fn.m_jetCalibFunc.at(i).empty()) { 00077 os << ", no non-linear correction."; 00078 } else { 00079 os << " Coefficients = "; 00080 for (unsigned j=0; j<fn.m_jetCalibFunc.at(i).size();j++){ 00081 os << fn.m_jetCalibFunc.at(i).at(j) << " "; 00082 } 00083 } 00084 os << std::endl; 00085 } 00086 os << "Tau jet correction coefficients" << std::endl; 00087 for (unsigned i=0; i<fn.m_tauCalibFunc.size(); i++){ 00088 os << "Eta =" << std::setw(2) << i; 00089 if (fn.m_tauCalibFunc.at(i).empty()) { 00090 os << ", no non-linear correction."; 00091 } else { 00092 os << " Coefficients = "; 00093 for (unsigned j=0; j<fn.m_tauCalibFunc.at(i).size();j++){ 00094 os << fn.m_tauCalibFunc.at(i).at(j) << " "; 00095 } 00096 } 00097 os << std::endl; 00098 } 00099 } 00100 return os; 00101 }
Definition at line 96 of file L1GctJetEtCalibrationFunction.h.
Referenced by correctedEt(), setConversionToEnergyOff(), and setConversionToEnergyOn().
type of correction function to apply
Definition at line 94 of file L1GctJetEtCalibrationFunction.h.
Referenced by findCorrectedEt(), operator<<(), and setCorrectionFunctionType().
std::vector<double> L1GctJetEtCalibrationFunction::m_energyConversion [private] |
Definition at line 106 of file L1GctJetEtCalibrationFunction.h.
Referenced by correctedEt(), setConversionToEnergyOff(), and setConversionToEnergyOn().
double L1GctJetEtCalibrationFunction::m_htScaleLSB [private] |
scale and threshold parameters
Definition at line 99 of file L1GctJetEtCalibrationFunction.h.
Referenced by calibratedEt(), getHtScaleLSB(), operator<<(), and setParams().
std::vector< std::vector<double> > L1GctJetEtCalibrationFunction::m_jetCalibFunc [private] |
the calibration function - converts jet Et to linear
Definition at line 103 of file L1GctJetEtCalibrationFunction.h.
Referenced by correctedEt(), operator<<(), and setParams().
std::vector< std::vector<double> > L1GctJetEtCalibrationFunction::m_tauCalibFunc [private] |
Definition at line 104 of file L1GctJetEtCalibrationFunction.h.
Referenced by correctedEt(), operator<<(), and setParams().
double L1GctJetEtCalibrationFunction::m_threshold [private] |
Definition at line 100 of file L1GctJetEtCalibrationFunction.h.
Referenced by correctedEt(), getThreshold(), operator<<(), and setParams().
const unsigned L1GctJetEtCalibrationFunction::N_CENTRAL_ETA_VALUES = 7 [static] |
Number of eta bins for separate tau correction.
Definition at line 43 of file L1GctJetEtCalibrationFunction.h.
Referenced by correctedEt(), L1GctCalibFunConfigurer::L1GctCalibFunConfigurer(), and setParams().
const unsigned L1GctJetEtCalibrationFunction::NUMBER_ETA_VALUES = 11 [static] |
Number of eta bins used in correction.
Definition at line 42 of file L1GctJetEtCalibrationFunction.h.
Referenced by correctedEt(), L1GctCalibFunConfigurer::L1GctCalibFunConfigurer(), setConversionToEnergyOn(), and setParams().