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 m_metEtaMask(iConfig.getParameter<unsigned>("MEtEtaMask")),
00040 m_tetEtaMask(iConfig.getParameter<unsigned>("TEtEtaMask")),
00041 m_mhtEtaMask(iConfig.getParameter<unsigned>("MHtEtaMask")),
00042 m_thtEtaMask(iConfig.getParameter<unsigned>("HtEtaMask"))
00043 {
00044
00045
00046
00047 setWhatProduced(this,&L1GctConfigProducers::produceJfParams);
00048 setWhatProduced(this,&L1GctConfigProducers::produceChanMask);
00049
00050
00051 std::string CalibStyle = iConfig.getParameter<std::string>("CalibrationStyle");
00052 edm::ParameterSet calibCoeffs;
00053
00054 if (CalibStyle == "PowerSeries") {
00055 m_corrFunType = 1;
00056 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PowerSeriesCoefficients");
00057 }
00058
00059 if (CalibStyle == "ORCAStyle") {
00060 m_corrFunType = 2;
00061 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("OrcaStyleCoefficients");
00062 }
00063
00064 if (CalibStyle == "Simple") {
00065 m_corrFunType = 3;
00066 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("SimpleCoefficients");
00067 }
00068
00069 if (CalibStyle == "PiecewiseCubic") {
00070 m_corrFunType = 4;
00071 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PiecewiseCubicCoefficients");
00072 }
00073
00074 if (CalibStyle == "PF") {
00075 m_corrFunType = 5;
00076 calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PFCoefficients");
00077 }
00078
00079
00080 if (CalibStyle != "None") {
00081
00082
00083
00084 for (unsigned i=0; i<L1GctJetFinderParams::NUMBER_ETA_VALUES; ++i) {
00085 std::stringstream ss;
00086 std::string str;
00087 ss << "nonTauJetCalib" << i;
00088 ss >> str;
00089 m_jetCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
00090 }
00091
00092 for (unsigned i=0; i<L1GctJetFinderParams::N_CENTRAL_ETA_VALUES; ++i) {
00093 std::stringstream ss;
00094 std::string str;
00095 ss << "tauJetCalib" << i;
00096 ss >> str;
00097 m_tauCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
00098 }
00099
00100 } else {
00101
00102 m_corrFunType = 0;
00103
00104 m_jetCalibFunc.resize(L1GctJetFinderParams::NUMBER_ETA_VALUES);
00105 m_tauCalibFunc.resize(L1GctJetFinderParams::N_CENTRAL_ETA_VALUES);
00106 }
00107
00108 edm::LogWarning("L1GctConfig") << "Calibration Style option " << CalibStyle << std::endl;
00109
00110 }
00111
00112
00113 L1GctConfigProducers::~L1GctConfigProducers()
00114 {
00115
00116
00117
00118
00119 }
00120
00121
00122
00123 L1GctConfigProducers::JfParamsReturnType
00124 L1GctConfigProducers::produceJfParams(const L1GctJetFinderParamsRcd& aRcd)
00125 {
00126
00127 const L1CaloGeometryRecord& geomRcd = aRcd.getRecord< L1CaloGeometryRecord >() ;
00128 edm::ESHandle< L1CaloGeometry > geom ;
00129 geomRcd.get( geom ) ;
00130
00131
00132 boost::shared_ptr<L1GctJetFinderParams> pL1GctJetFinderParams =
00133 boost::shared_ptr<L1GctJetFinderParams> (new L1GctJetFinderParams(m_rgnEtLsb,
00134 m_htLsb,
00135 m_CenJetSeed,
00136 m_FwdJetSeed,
00137 m_TauJetSeed,
00138 m_tauIsoThresh,
00139 m_htJetThresh,
00140 m_mhtJetThresh,
00141 m_EtaBoundry,
00142 m_corrFunType,
00143 m_jetCalibFunc,
00144 m_tauCalibFunc,
00145 m_convertToEnergy,
00146 etToEnergyConversion(geom.product())) );
00147
00148 return pL1GctJetFinderParams ;
00149
00150 }
00151
00152 L1GctConfigProducers::ChanMaskReturnType
00153 L1GctConfigProducers::produceChanMask(const L1GctChannelMaskRcd&) {
00154
00155 L1GctChannelMask* mask = new L1GctChannelMask;
00156
00157 for (unsigned ieta=0; ieta<22; ++ieta) {
00158 if (((m_metEtaMask>>ieta)&0x1)==1) mask->maskMissingEt(ieta);
00159 if (((m_tetEtaMask>>ieta)&0x1)==1) mask->maskTotalEt(ieta);
00160 if (((m_mhtEtaMask>>ieta)&0x1)==1) mask->maskMissingHt(ieta);
00161 if (((m_thtEtaMask>>ieta)&0x1)==1) mask->maskTotalHt(ieta);
00162 }
00163
00164 return boost::shared_ptr<L1GctChannelMask>(mask);
00165
00166 }
00167
00168
00170
00172 std::vector<double>
00173 L1GctConfigProducers::etToEnergyConversion(
00174 const L1CaloGeometry* geom) const {
00175
00176 std::vector<double> result;
00177
00178 for (unsigned ieta=0; ieta<7; ieta++) {
00179 double bineta = geom->etaBinCenter(ieta, true);
00180 double factor = 0.5*(exp(bineta)+exp(-bineta));
00181 result.push_back(factor);
00182 }
00183
00184 for (unsigned ieta=0; ieta<4; ieta++) {
00185 double bineta = geom->etaBinCenter(ieta, false);
00186 double factor = 0.5*(exp(bineta)+exp(-bineta));
00187 result.push_back(factor);
00188 }
00189 return result;
00190 }
00191
00192
00193
00194 DEFINE_FWK_EVENTSETUP_MODULE(L1GctConfigProducers);