#include <CondTools/L1TriggerConfigOnlineProd/src/L1TriggerConfigOnlineProd.cc>
Public Member Functions | |
L1TriggerConfigOnlineProd (const edm::ParameterSet &) | |
boost::shared_ptr < L1RCTParameters > | produceL1RCTParameters (const L1RCTParametersRcd &) |
boost::shared_ptr< L1RPCConfig > | produceL1RPCConfig (const L1RPCConfigRcd &) |
~L1TriggerConfigOnlineProd () | |
Private Member Functions | |
template<class TRcd, class TData> | |
bool | getSubsystemKey (const TRcd &record, boost::shared_ptr< TData > data, std::string &subsystemKey) |
Private Attributes | |
bool | m_forceGeneration |
l1t::OMDSReader | m_omdsReader |
Implementation: <Notes on="" implementation>="">
Usage: <usage>
Definition at line 50 of file L1TriggerConfigOnlineProd.h.
L1TriggerConfigOnlineProd::L1TriggerConfigOnlineProd | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 44 of file L1TriggerConfigOnlineProd.cc.
References produceL1RCTParameters(), produceL1RPCConfig(), and edm::ESProducer::setWhatProduced().
00045 : m_omdsReader( iConfig.getParameter< std::string >( "onlineDB" ), 00046 iConfig.getParameter< std::string >( "onlineAuthentication" ) 00047 ), 00048 m_forceGeneration( iConfig.getParameter< bool >( "forceGeneration") ) 00049 { 00050 //the following line is needed to tell the framework what 00051 // data is being produced 00052 setWhatProduced( this, &L1TriggerConfigOnlineProd::produceL1RCTParameters ) ; 00053 setWhatProduced( this, &L1TriggerConfigOnlineProd::produceL1RPCConfig ) ; 00054 00055 //now do what ever other initialization is needed 00056 }
L1TriggerConfigOnlineProd::~L1TriggerConfigOnlineProd | ( | ) |
Definition at line 59 of file L1TriggerConfigOnlineProd.cc.
00060 { 00061 00062 // do anything here that needs to be done at desctruction time 00063 // (e.g. close files, deallocate resources etc.) 00064 00065 }
bool L1TriggerConfigOnlineProd::getSubsystemKey | ( | const TRcd & | record, | |
boost::shared_ptr< TData > | data, | |||
std::string & | subsystemKey | |||
) | [inline, private] |
Definition at line 77 of file L1TriggerConfigOnlineProd.h.
References className(), HLT_VtxMuL3::dataType, false, edm::eventsetup::EventSetupRecordImplementation< T >::get(), getDQMSummary::key, and HLT_VtxMuL3::recordName.
Referenced by produceL1RCTParameters(), and produceL1RPCConfig().
00080 { 00081 // Get L1TriggerKey 00082 const L1TriggerKeyRcd& keyRcd = 00083 record.template getRecord< L1TriggerKeyRcd >() ; 00084 00085 // Explanation of funny syntax: since record is dependent, we are not 00086 // expecting getRecord to be a template so the compiler parses it 00087 // as a non-template. https://gcc.gnu.org/ml/gcc-bugs/2005-11/msg03685.html 00088 00089 // If L1TriggerKey is invalid, then all configuration objects are 00090 // already in ORCON. 00091 edm::ESHandle< L1TriggerKey > key ; 00092 try 00093 { 00094 keyRcd.get( key ) ; 00095 } 00096 catch( l1t::DataAlreadyPresentException& ex ) 00097 { 00098 subsystemKey = std::string() ; 00099 return false ; 00100 } 00101 00102 // Get subsystem key from L1TriggerKey 00103 std::string recordName = 00104 edm::eventsetup::heterocontainer::HCTypeTagTemplate< TRcd, 00105 edm::eventsetup::EventSetupRecordKey >::className() ; 00106 std::string dataType = 00107 edm::eventsetup::heterocontainer::HCTypeTagTemplate< TData, 00108 edm::eventsetup::DataKey >::className() ; 00109 00110 subsystemKey = key->get( recordName, dataType ) ; 00111 00112 edm::LogVerbatim( "L1-O2O" ) 00113 << "L1TriggerConfigOnlineProd record " << recordName 00114 << " type " << dataType 00115 << " sub key " << subsystemKey ; 00116 00117 // Get L1TriggerKeyList 00118 const L1TriggerKeyListRcd& keyListRcd = 00119 record.template getRecord< L1TriggerKeyListRcd >() ; 00120 edm::ESHandle< L1TriggerKeyList > keyList ; 00121 keyListRcd.get( keyList ) ; 00122 00123 // If L1TriggerKeyList does not contain subsystem key, token is empty 00124 return 00125 keyList->token( recordName, dataType, subsystemKey ) == std::string() ; 00126 }
boost::shared_ptr< L1RCTParameters > L1TriggerConfigOnlineProd::produceL1RCTParameters | ( | const L1RCTParametersRcd & | iRecord | ) |
Definition at line 34 of file produceL1RCTParameters.cc.
References l1t::OMDSReader::basicQuery(), end, getSubsystemKey(), i, int, getDQMSummary::key, m_forceGeneration, m_omdsReader, row, and l1t::OMDSReader::singleAttribute().
Referenced by L1TriggerConfigOnlineProd().
00035 { 00036 using namespace edm::es; 00037 boost::shared_ptr<L1RCTParameters> pL1RCTParameters ; 00038 00039 // Get subsystem key and check if already in ORCON 00040 std::string key ; 00041 if( getSubsystemKey( iRecord, pL1RCTParameters, key ) || 00042 m_forceGeneration ) 00043 { 00044 // Key not in ORCON -- get data from OMDS and make C++ object 00045 // std::cout << "RCT key = " << key << std::endl ; 00046 00047 // ~~~~~~~~~ Get rct_parameter from rct_key ~~~~~~~~~ 00048 00049 std::string rctSchema = "CMS_RCT" ; 00050 00051 // SELECT RCT_PARAMETER FROM RCT_CONF WHERE RCT_CONF.RCT_KEY = key 00052 l1t::OMDSReader::QueryResults paremKeyResults = 00053 m_omdsReader.basicQuery( "RCT_PARAMETER", 00054 rctSchema, 00055 "RCT_CONF", 00056 "RCT_CONF.RCT_KEY", 00057 m_omdsReader.singleAttribute( key ) ); 00058 00059 // ~~~~~~~~~ Cut values ~~~~~~~~~ 00060 00061 // select egamma_lsb, jetmet_lsb, e_min_for_fg_cut, e_max_for_fg_cut, h_over_e_cut, e_min_for_h_over_e_cut, e_max_for_h_over_e_cut, h_min_for_h_over_e_cut, e_activity_cut, h_activity_cut, eic_isolation_threshold, jsc_quiet_threshold_barrel, jsc_quiet_threshold_endcap, noisevetohb, noisevetoheplus, noisevetoheminus from parem_conf where parem_conf.parem_key = (select rct_parameter from rct_conf where rct_conf.rct_key = 'rct_cmssw_def'); 00062 00063 std::vector< std::string > queryStrings ; 00064 queryStrings.push_back( "EGAMMA_LSB" ) ; 00065 queryStrings.push_back( "JETMET_LSB" ) ; 00066 queryStrings.push_back( "E_MIN_FOR_FG_CUT" ) ; 00067 queryStrings.push_back( "E_MAX_FOR_FG_CUT" ) ; 00068 queryStrings.push_back( "H_OVER_E_CUT" ) ; 00069 queryStrings.push_back( "E_MIN_FOR_H_OVER_E_CUT" ) ; 00070 queryStrings.push_back( "E_MAX_FOR_H_OVER_E_CUT" ) ; 00071 queryStrings.push_back( "H_MIN_FOR_H_OVER_E_CUT" ) ; 00072 queryStrings.push_back( "E_ACTIVITY_CUT" ) ; 00073 queryStrings.push_back( "H_ACTIVITY_CUT" ) ; 00074 queryStrings.push_back( "EIC_ISOLATION_THRESHOLD" ) ; 00075 queryStrings.push_back( "JSC_QUIET_THRESHOLD_BARREL" ) ; 00076 queryStrings.push_back( "JSC_QUIET_THRESHOLD_ENDCAP" ) ; 00077 queryStrings.push_back( "NOISEVETOHB" ) ; 00078 queryStrings.push_back( "NOISEVETOHEPLUS" ) ; 00079 queryStrings.push_back( "NOISEVETOHEMINUS" ) ; 00080 00081 l1t::OMDSReader::QueryResults results2 = 00082 m_omdsReader.basicQuery( queryStrings, 00083 rctSchema, 00084 "PAREM_CONF", 00085 "PAREM_CONF.PAREM_KEY", 00086 paremKeyResults ) ; 00087 const coral::AttributeList& row2 = results2.second.front() ; 00088 00089 double eGammaLSB = row2[ "EGAMMA_LSB" ].data< double >() ; 00090 double jetMETLSB = row2[ "JETMET_LSB" ].data< double >() ; 00091 double eMinForFGCut = row2[ "E_MIN_FOR_FG_CUT" ].data< double >() ; 00092 double eMaxForFGCut = row2[ "E_MAX_FOR_FG_CUT" ].data< double >() ; 00093 double hOeCut = row2[ "H_OVER_E_CUT" ].data< double >() ; 00094 double eMinForHoECut = row2[ "E_MIN_FOR_H_OVER_E_CUT" ].data< double >(); 00095 double eMaxForHoECut = row2[ "E_MAX_FOR_H_OVER_E_CUT" ].data< double >(); 00096 double hMinForHoECut = row2[ "H_MIN_FOR_H_OVER_E_CUT" ].data< double >(); 00097 double eActivityCut = row2[ "E_ACTIVITY_CUT" ].data< double >() ; 00098 double hActivityCut = row2[ "H_ACTIVITY_CUT" ].data< double >() ; 00099 double jscQuietThreshBarrel = 00100 row2[ "JSC_QUIET_THRESHOLD_BARREL" ].data< double >() ; 00101 double jscQuietThreshEndcap = 00102 row2[ "JSC_QUIET_THRESHOLD_ENDCAP" ].data< double >() ; 00103 unsigned int eicIsolationThreshold = 00104 ( unsigned int ) row2[ "EIC_ISOLATION_THRESHOLD" ].data< double >() ; 00105 bool noiseVetoHB = row2[ "NOISEVETOHB" ].data< bool >() ; 00106 bool noiseVetoHEplus = row2[ "NOISEVETOHEPLUS" ].data< bool >() ; 00107 bool noiseVetoHEminus = row2[ "NOISEVETOHEMINUS" ].data< bool >() ; 00108 00109 // std::cout << "eGammaLSB = " << eGammaLSB << std::endl ; 00110 // std::cout << "jetMETLSB = " << jetMETLSB << std::endl ; 00111 // std::cout << "eMinForFGCut = " << eMinForFGCut << std::endl ; 00112 // std::cout << "eMaxForFGCut = " << eMaxForFGCut << std::endl ; 00113 // std::cout << "hOeCut = " << hOeCut << std::endl ; 00114 // std::cout << "eMinForHoECut = " << eMinForHoECut << std::endl ; 00115 // std::cout << "eMaxForHoECut = " << eMaxForHoECut << std::endl ; 00116 // std::cout << "hMinForHoECut = " << hMinForHoECut << std::endl ; 00117 // std::cout << "eActivityCut = " << eActivityCut << std::endl ; 00118 // std::cout << "hActivityCut = " << hActivityCut << std::endl ; 00119 // std::cout << "eicIsolationThreshold = " << eicIsolationThreshold << std::endl ; 00120 // std::cout << "jscQuietThreshBarrel = " << jscQuietThreshBarrel << std::endl ; 00121 // std::cout << "jscQuietThreshEndcap = " << jscQuietThreshEndcap << std::endl ; 00122 // std::cout << "noiseVetoHB = " << noiseVetoHB << std::endl ; 00123 // std::cout << "noiseVetoHEplus = " << noiseVetoHEplus << std::endl ; 00124 // std::cout << "noiseVetoHEminus = " << noiseVetoHEminus << std::endl ; 00125 00126 // ~~~~~~~~~ EGamma ECAL scale factors ~~~~~~~~~ 00127 00128 // select scalefactor, fk_rct_eta from egamma_ecal_scalefactor where egamma_ecal_scalefactor.fk_version = (select egamma_ecal from parem_conf where parem_conf.parem_key = (select rct_parameter from rct_conf where rct_conf.rct_key='rct_cmssw_def')); 00129 00130 std::vector< std::string > scaleFactorQueryStrings ; 00131 scaleFactorQueryStrings.push_back( "SCALEFACTOR") ; 00132 scaleFactorQueryStrings.push_back( "FK_RCT_ETA" ) ; 00133 00134 l1t::OMDSReader::QueryResults egammaEcalResults = 00135 m_omdsReader.basicQuery( 00136 scaleFactorQueryStrings, 00137 rctSchema, 00138 "EGAMMA_ECAL_SCALEFACTOR", 00139 "EGAMMA_ECAL_SCALEFACTOR.FK_VERSION", 00140 m_omdsReader.basicQuery( "EGAMMA_ECAL", 00141 rctSchema, 00142 "PAREM_CONF", 00143 "PAREM_CONF.PAREM_KEY", 00144 paremKeyResults ) ) ; 00145 00146 // Store scale factors in temporary array to get ordering right. 00147 // Reserve space for 100 bins. 00148 00149 static const int reserve = 100 ; 00150 double sfTmp[ reserve ] ; 00151 for( int i = 0 ; i < reserve ; ++i ) 00152 { 00153 sfTmp[ i ] = 0. ; 00154 } 00155 00156 int maxBin = 0 ; 00157 std::vector< coral::AttributeList >::const_iterator itr = 00158 egammaEcalResults.second.begin() ; 00159 std::vector< coral::AttributeList >::const_iterator end = 00160 egammaEcalResults.second.end() ; 00161 for( ; itr != end ; ++itr ) 00162 { 00163 const coral::AttributeList& row = *itr ; 00164 double sf = row[ "SCALEFACTOR" ].data< double >() ; 00165 int ieta = ( int ) row[ "FK_RCT_ETA" ].data< short >() ; 00166 00167 sfTmp[ ieta-1 ] = sf ; // eta bins start at 1. 00168 00169 if( ieta > maxBin ) 00170 { 00171 maxBin = ieta ; 00172 } 00173 } 00174 00175 // std::cout << "egammaEcal maxBin = " << maxBin << std::endl ; 00176 std::vector< double > egammaEcalScaleFactors ; 00177 for( int i = 0 ; i < maxBin ; ++i ) 00178 { 00179 egammaEcalScaleFactors.push_back( sfTmp[ i ] ) ; 00180 // std::cout << i+1 << " " << sfTmp[ i ] << std::endl ; 00181 } 00182 00183 // ~~~~~~~~~ EGamma HCAL scale factors ~~~~~~~~~ 00184 00185 // select scalefactor, fk_rct_eta from egamma_hcal_scalefactor where egamma_hcal_scalefactor.fk_version = (select egamma_hcal from parem_conf where parem_conf.parem_key = (select rct_parameter from rct_conf where rct_conf.rct_key='rct_cmssw_def')); 00186 00187 l1t::OMDSReader::QueryResults egammaHcalResults = 00188 m_omdsReader.basicQuery( 00189 scaleFactorQueryStrings, 00190 rctSchema, 00191 "EGAMMA_HCAL_SCALEFACTOR", 00192 "EGAMMA_HCAL_SCALEFACTOR.FK_VERSION", 00193 m_omdsReader.basicQuery( "EGAMMA_HCAL", 00194 rctSchema, 00195 "PAREM_CONF", 00196 "PAREM_CONF.PAREM_KEY", 00197 paremKeyResults ) ) ; 00198 00199 // Store scale factors in temporary array to get ordering right. 00200 for( int i = 0 ; i < reserve ; ++i ) 00201 { 00202 sfTmp[ i ] = 0. ; 00203 } 00204 00205 maxBin = 0 ; 00206 itr = egammaHcalResults.second.begin() ; 00207 end = egammaHcalResults.second.end() ; 00208 for( ; itr != end ; ++itr ) 00209 { 00210 const coral::AttributeList& row = *itr ; 00211 double sf = row[ "SCALEFACTOR" ].data< double >() ; 00212 int ieta = ( int ) row[ "FK_RCT_ETA" ].data< short >() ; 00213 00214 sfTmp[ ieta-1 ] = sf ; // eta bins start at 1. 00215 00216 if( ieta > maxBin ) 00217 { 00218 maxBin = ieta ; 00219 } 00220 } 00221 00222 // std::cout << "egammaHcal maxBin = " << maxBin << std::endl ; 00223 std::vector< double > egammaHcalScaleFactors ; 00224 for( int i = 0 ; i < maxBin ; ++i ) 00225 { 00226 egammaHcalScaleFactors.push_back( sfTmp[ i ] ) ; 00227 // std::cout << i+1 << " " << sfTmp[ i ] << std::endl ; 00228 } 00229 00230 // ~~~~~~~~~ JetMET ECAL scale factors ~~~~~~~~~ 00231 00232 // select scalefactor, fk_rct_eta from jetmet_ecal_scalefactor where jetmet_ecal_scalefactor.fk_version = (select jetmet_ecal from parem_conf where parem_conf.parem_key = (select rct_parameter from rct_conf where rct_conf.rct_key='rct_cmssw_def')); 00233 00234 l1t::OMDSReader::QueryResults jetmetEcalResults = 00235 m_omdsReader.basicQuery( 00236 scaleFactorQueryStrings, 00237 rctSchema, 00238 "JETMET_ECAL_SCALEFACTOR", 00239 "JETMET_ECAL_SCALEFACTOR.FK_VERSION", 00240 m_omdsReader.basicQuery( "JETMET_ECAL", 00241 rctSchema, 00242 "PAREM_CONF", 00243 "PAREM_CONF.PAREM_KEY", 00244 paremKeyResults ) ) ; 00245 00246 // Store scale factors in temporary array to get ordering right. 00247 for( int i = 0 ; i < reserve ; ++i ) 00248 { 00249 sfTmp[ i ] = 0. ; 00250 } 00251 00252 maxBin = 0 ; 00253 itr = jetmetEcalResults.second.begin() ; 00254 end = jetmetEcalResults.second.end() ; 00255 for( ; itr != end ; ++itr ) 00256 { 00257 const coral::AttributeList& row = *itr ; 00258 double sf = row[ "SCALEFACTOR" ].data< double >() ; 00259 int ieta = ( int ) row[ "FK_RCT_ETA" ].data< short >() ; 00260 00261 sfTmp[ ieta-1 ] = sf ; // eta bins start at 1. 00262 00263 if( ieta > maxBin ) 00264 { 00265 maxBin = ieta ; 00266 } 00267 } 00268 00269 // std::cout << "jetmetEcal maxBin = " << maxBin << std::endl ; 00270 std::vector< double > jetmetEcalScaleFactors ; 00271 for( int i = 0 ; i < maxBin ; ++i ) 00272 { 00273 jetmetEcalScaleFactors.push_back( sfTmp[ i ] ) ; 00274 // std::cout << i+1 << " " << sfTmp[ i ] << std::endl ; 00275 } 00276 00277 // ~~~~~~~~~ JetMET HCAL scale factors ~~~~~~~~~ 00278 00279 // select scalefactor, fk_rct_eta from jetmet_hcal_scalefactor where jetmet_hcal_scalefactor.fk_version = (select jetmet_hcal from parem_conf where parem_conf.parem_key = (select rct_parameter from rct_conf where rct_conf.rct_key='rct_cmssw_def')); 00280 00281 l1t::OMDSReader::QueryResults jetmetHcalResults = 00282 m_omdsReader.basicQuery( 00283 scaleFactorQueryStrings, 00284 rctSchema, 00285 "JETMET_HCAL_SCALEFACTOR", 00286 "JETMET_HCAL_SCALEFACTOR.FK_VERSION", 00287 m_omdsReader.basicQuery( "JETMET_HCAL", 00288 rctSchema, 00289 "PAREM_CONF", 00290 "PAREM_CONF.PAREM_KEY", 00291 paremKeyResults ) ) ; 00292 00293 // Store scale factors in temporary array to get ordering right. 00294 for( int i = 0 ; i < reserve ; ++i ) 00295 { 00296 sfTmp[ i ] = 0. ; 00297 } 00298 00299 maxBin = 0 ; 00300 itr = jetmetHcalResults.second.begin() ; 00301 end = jetmetHcalResults.second.end() ; 00302 for( ; itr != end ; ++itr ) 00303 { 00304 const coral::AttributeList& row = *itr ; 00305 double sf = row[ "SCALEFACTOR" ].data< double >() ; 00306 int ieta = ( int ) row[ "FK_RCT_ETA" ].data< short >() ; 00307 00308 sfTmp[ ieta-1 ] = sf ; // eta bins start at 1. 00309 00310 if( ieta > maxBin ) 00311 { 00312 maxBin = ieta ; 00313 } 00314 } 00315 00316 // std::cout << "jetmetHcal maxBin = " << maxBin << std::endl ; 00317 std::vector< double > jetmetHcalScaleFactors ; 00318 for( int i = 0 ; i < maxBin ; ++i ) 00319 { 00320 jetmetHcalScaleFactors.push_back( sfTmp[ i ] ) ; 00321 // std::cout << i+1 << " " << sfTmp[ i ] << std::endl ; 00322 } 00323 00324 00325 //~~~~~~~~~ Instantiate new L1RCTParameters object. ~~~~~~~~~ 00326 00327 pL1RCTParameters = boost::shared_ptr< L1RCTParameters >( 00328 new L1RCTParameters( eGammaLSB, 00329 jetMETLSB, 00330 eMinForFGCut, 00331 eMaxForFGCut, 00332 hOeCut, 00333 eMinForHoECut, 00334 eMaxForHoECut, 00335 hMinForHoECut, 00336 eActivityCut, 00337 hActivityCut, 00338 eicIsolationThreshold, 00339 (int) jscQuietThreshBarrel, 00340 (int) jscQuietThreshEndcap, 00341 noiseVetoHB, 00342 noiseVetoHEplus, 00343 noiseVetoHEminus, 00344 egammaEcalScaleFactors, 00345 egammaHcalScaleFactors, 00346 jetmetEcalScaleFactors, 00347 jetmetHcalScaleFactors ) ) ; 00348 } 00349 else 00350 { 00351 throw l1t::DataAlreadyPresentException( 00352 "L1RCTParameters for key " + key + " already in CondDB." ) ; 00353 } 00354 00355 return pL1RCTParameters ; 00356 }
boost::shared_ptr< L1RPCConfig > L1TriggerConfigOnlineProd::produceL1RPCConfig | ( | const L1RPCConfigRcd & | iRecord | ) |
Definition at line 39 of file produceL1RPCConfig.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getSubsystemKey(), getDQMSummary::key, and m_forceGeneration.
Referenced by L1TriggerConfigOnlineProd().
00040 { 00041 using namespace edm::es; 00042 boost::shared_ptr<L1RPCConfig> pL1RPCConfig ; 00043 00044 // Always throw exception because all RPCConfig objects are already 00045 // supposed to be in ORCON. 00046 00047 // Get subsystem key and check if already in ORCON 00048 std::string key ; 00049 if( getSubsystemKey( iRecord, pL1RPCConfig, key ) || 00050 m_forceGeneration ) 00051 { 00052 std::cout << "L1RPCConfig with key " << key << " missing from ORCON" 00053 << std::endl ; 00054 } 00055 00056 throw l1t::DataAlreadyPresentException( 00057 "L1RPCConfig for key " + key + " already in CondDB." ) ; 00058 00059 return pL1RPCConfig ; 00060 }
Definition at line 62 of file L1TriggerConfigOnlineProd.h.
Referenced by produceL1RCTParameters(), and produceL1RPCConfig().