Go to the documentation of this file.00001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00002 #include "FWCore/Utilities/interface/Exception.h"
00003
00004 #include "L1TriggerConfig/GctConfigProducers/interface/L1GctConfigProducers.h"
00005
00006 #include "CondFormats/DataRecord/interface/L1GctJetFinderParamsRcd.h"
00007 #include "CondFormats/DataRecord/interface/L1JetEtScaleRcd.h"
00008 #include "CondFormats/DataRecord/interface/L1GctChannelMaskRcd.h"
00009
00010 #include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
00011 #include "CondFormats/L1TObjects/interface/L1GctJetFinderParams.h"
00012 #include "CondFormats/L1TObjects/interface/L1GctChannelMask.h"
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 L1GctConfigProducers::L1GctConfigProducers(const edm::ParameterSet& iConfig) :
00026 m_rgnEtLsb(iConfig.getParameter<double>("RctRegionEtLSB")),
00027 m_htLsb(iConfig.getParameter<double>("GctHtLSB")),
00028 m_CenJetSeed(iConfig.getParameter<double>("JetFinderCentralJetSeed")),
00029 m_FwdJetSeed(iConfig.getParameter<double>("JetFinderForwardJetSeed")),
00030 m_TauJetSeed(iConfig.getParameter<double>("JetFinderCentralJetSeed")),
00031 m_tauIsoThresh(iConfig.getParameter<double>("TauIsoEtThreshold")),
00032 m_htJetThresh(iConfig.getParameter<double>("HtJetEtThreshold")),
00033 m_mhtJetThresh(iConfig.getParameter<double>("MHtJetEtThreshold")),
00034 m_EtaBoundry(7),
00035 m_corrFunType(0),
00036 m_convertToEnergy (iConfig.getParameter<bool>("ConvertEtValuesToEnergy")),
00037 m_jetCalibFunc(),
00038 m_tauCalibFunc()
00039 {
00040
00041
00042
00043 setWhatProduced(this,&L1GctConfigProducers::produceJfParams);
00044 setWhatProduced(this,&L1GctConfigProducers::produceChanMask);
00045
00046
00047 std::string CalibStyle = iConfig.getParameter<std::string>("CalibrationStyle");
00048 edm::ParameterSet calibCoeffs;
00049
00050 if (CalibStyle == "PowerSeries") {
00051 m_corrFunType = 1;
00052 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PowerSeriesCoefficients");
00053 }
00054
00055 if (CalibStyle == "ORCAStyle") {
00056 m_corrFunType = 2;
00057 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("OrcaStyleCoefficients");
00058 }
00059
00060 if (CalibStyle == "Simple") {
00061 m_corrFunType = 3;
00062 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("SimpleCoefficients");
00063 }
00064
00065 if (CalibStyle == "PiecewiseCubic") {
00066 m_corrFunType = 4;
00067 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PiecewiseCubicCoefficients");
00068 }
00069
00070 if (CalibStyle == "PF") {
00071 m_corrFunType = 5;
00072 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PFCoefficients");
00073 }
00074
00075
00076 if (CalibStyle != "None") {
00077
00078
00079
00080 for (unsigned i=0; i<L1GctJetFinderParams::NUMBER_ETA_VALUES; ++i) {
00081 std::stringstream ss;
00082 std::string str;
00083 ss << "nonTauJetCalib" << i;
00084 ss >> str;
00085 m_jetCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
00086 }
00087
00088 for (unsigned i=0; i<L1GctJetFinderParams::N_CENTRAL_ETA_VALUES; ++i) {
00089 std::stringstream ss;
00090 std::string str;
00091 ss << "tauJetCalib" << i;
00092 ss >> str;
00093 m_tauCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
00094 }
00095
00096 } else {
00097
00098 m_corrFunType = 0;
00099
00100 m_jetCalibFunc.resize(L1GctJetFinderParams::NUMBER_ETA_VALUES);
00101 m_tauCalibFunc.resize(L1GctJetFinderParams::N_CENTRAL_ETA_VALUES);
00102 }
00103
00104 edm::LogWarning("L1GctConfig") << "Calibration Style option " << CalibStyle << std::endl;
00105
00106 }
00107
00108
00109 L1GctConfigProducers::~L1GctConfigProducers()
00110 {
00111
00112
00113
00114
00115 }
00116
00117
00118
00119 L1GctConfigProducers::JfParamsReturnType
00120 L1GctConfigProducers::produceJfParams(const L1GctJetFinderParamsRcd& aRcd)
00121 {
00122
00123 const L1CaloGeometryRecord& geomRcd = aRcd.getRecord< L1CaloGeometryRecord >() ;
00124 edm::ESHandle< L1CaloGeometry > geom ;
00125 geomRcd.get( geom ) ;
00126
00127
00128 boost::shared_ptr<L1GctJetFinderParams> pL1GctJetFinderParams =
00129 boost::shared_ptr<L1GctJetFinderParams> (new L1GctJetFinderParams(m_rgnEtLsb,
00130 m_htLsb,
00131 m_CenJetSeed,
00132 m_FwdJetSeed,
00133 m_TauJetSeed,
00134 m_tauIsoThresh,
00135 m_htJetThresh,
00136 m_mhtJetThresh,
00137 m_EtaBoundry,
00138 m_corrFunType,
00139 m_jetCalibFunc,
00140 m_tauCalibFunc,
00141 m_convertToEnergy,
00142 etToEnergyConversion(geom.product())) );
00143
00144 return pL1GctJetFinderParams ;
00145
00146 }
00147
00148 L1GctConfigProducers::ChanMaskReturnType
00149 L1GctConfigProducers::produceChanMask(const L1GctChannelMaskRcd&) {
00150 return boost::shared_ptr<L1GctChannelMask>(new L1GctChannelMask);
00151 }
00152
00153
00155
00157 std::vector<double>
00158 L1GctConfigProducers::etToEnergyConversion(
00159 const L1CaloGeometry* geom) const {
00160
00161 std::vector<double> result;
00162
00163 for (unsigned ieta=0; ieta<7; ieta++) {
00164 double bineta = geom->etaBinCenter(ieta, true);
00165 double factor = 0.5*(exp(bineta)+exp(-bineta));
00166 result.push_back(factor);
00167 }
00168
00169 for (unsigned ieta=0; ieta<4; ieta++) {
00170 double bineta = geom->etaBinCenter(ieta, false);
00171 double factor = 0.5*(exp(bineta)+exp(-bineta));
00172 result.push_back(factor);
00173 }
00174 return result;
00175 }
00176
00177
00178
00179 DEFINE_FWK_EVENTSETUP_MODULE(L1GctConfigProducers);