44 virtual std::shared_ptr< L1CaloEcalScale >
newObject(
92 std::shared_ptr< L1CaloEcalScale >
95 using namespace edm::es;
97 std:: cout <<
"object Key " << objectKey <<std::endl;
99 if(objectKey ==
"NULL" || objectKey ==
"")
100 return std::shared_ptr< L1CaloEcalScale >(
ecalScale );
101 if(objectKey ==
"IDENTITY"){
104 return std::shared_ptr< L1CaloEcalScale >(
ecalScale);
111 std::vector < std::string > mainStrings;
116 std::vector< std::string > paramStrings ;
117 paramStrings.push_back(
"LOGIC_ID");
118 paramStrings.push_back(
"ETSAT");
121 std::vector< std::string> IDStrings;
122 IDStrings.push_back(
"NAME");
123 IDStrings.push_back(
"ID1");
124 IDStrings.push_back(
"ID2");
125 IDStrings.push_back(
"maps_to");
130 "FE_CONFIG_LUTPARAM_DAT",
131 "FE_CONFIG_LUTPARAM_DAT.LUT_CONF_ID",
135 if( paramResults.queryFailed()
136 || (paramResults.numberRows()==0) )
138 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. Unable to find lutparam dat table" ;
139 return std::shared_ptr< L1CaloEcalScale >() ;
144 for(
int i = 0;
i < paramResults.numberRows() ;
i++){
148 paramResults.fillVariableFromRow(
"ETSAT",
i,etSat);
152 paramResults.fillVariableFromRow(
"LOGIC_ID",
i, logic_id);
159 "CHANNELVIEW.LOGIC_ID",
167 else if(
"EE" == ecid_name)
170 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale LOGIC_ID. unable to find channel view with appropiate logic id" ;
171 return std::shared_ptr< L1CaloEcalScale >() ;
177 std::vector< std::string > grpLUT;
178 grpLUT.push_back(
"GROUP_ID");
179 grpLUT.push_back(
"LUT_ID");
180 grpLUT.push_back(
"LUT_VALUE");
185 "FE_LUT_PER_GROUP_DAT",
186 "FE_LUT_PER_GROUP_DAT.LUT_CONF_ID",
190 if( lutGrpResults.queryFailed()
191 || (lutGrpResults.numberRows()%1024 !=0) )
193 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. No group info" ;
194 return std::shared_ptr< L1CaloEcalScale >() ;
198 int nEntries = lutGrpResults.numberRows();
199 for(
int i = 0;
i < nEntries;
i++) {
203 lutGrpResults.fillVariableFromRow(
"GROUP_ID",
i,group);
209 lutGrpResults.fillVariableFromRow(
"LUT_ID",
i,lutID);
210 lutGrpResults.fillVariableFromRow(
"LUT_VALUE",
i,lutValue);
214 std::map<int, std::vector<int> > tpgValueMap;
216 std::map<int, std::vector<int>* >::iterator grpIt;
218 const std::vector<int> * lut_ = grpIt->second;
220 std::vector<int> tpgValue;
221 tpgValue.resize(256);
223 for(
int tpg = 0; tpg < 256 ; tpg++){
225 for(
int i = 0;
i < 1024 ;
i++) {
227 if(tpg == (0xff & (lut_->at(
i)))){
235 tpgValueMap[grpIt->first] = tpgValue;
239 std::vector < std::string > groupMap;
240 groupMap.push_back(
"LOGIC_ID");
241 groupMap.push_back(
"GROUP_ID");
249 "FE_CONFIG_LUT_DAT.LUT_CONF_ID",
252 if( grpMapResults.queryFailed()
253 || (grpMapResults.numberRows()==0) )
255 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. No fe_config_lut_dat info" ;
256 return std::shared_ptr< L1CaloEcalScale >() ;
259 nEntries = grpMapResults.numberRows();
260 for(
int i = 0;
i< nEntries; ++
i){
263 grpMapResults.fillVariableFromRow(
"LOGIC_ID",
i, logic_id);
265 grpMapResults.fillVariableFromRow(
"GROUP_ID",
i, group_id);
272 "CHANNELVIEW.LOGIC_ID",
275 if( paramResults.queryFailed()
276 || (paramResults.numberRows()==0) )
278 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. Unable to find logic_id channel view" ;
279 return std::shared_ptr< L1CaloEcalScale >() ;
287 if(logic_id >= 2100001901 && logic_id <= 2100001916)
289 if(ecid_name != maps_to){
292 if(ecid_name==
"EB_trigger_tower" || ecid_name ==
"EE_trigger_tower") {
297 if(ecid_name ==
"EB_trigger_tower")
332 double et_lsb = (ieta<=17) ? eb_lsb : ee_lsb;
333 for(
int pos = 0; pos <=1; pos++){
337 for(
int iphi = 1; iphi<=72; iphi++){
342 if(itLut != gMap.end()) {
344 std::vector<int> tpgValue = tpgValueMap[itLut->second];
364 return std::shared_ptr< L1CaloEcalScale >(
ecalScale );
virtual std::shared_ptr< L1CaloEcalScale > newObject(const std::string &objectKey) override
const EcalTPGGroupsMap & getMap() const
bool fillVariable(const std::string &columnName, T &outputVariable) const
const QueryResults singleAttribute(const T &data) const
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
std::map< int, std::vector< int > * > groupInfo
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
EcalTPGGroups * lutGrpMap
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
L1CaloEcalScaleConfigOnlineProd(const edm::ParameterSet &)
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
~L1CaloEcalScaleConfigOnlineProd()
void setValue(const uint32_t &rawId, const uint32_t &ObjectId)
l1t::OMDSReader m_omdsReader
const EcalElectronicsMapping * theMapping_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
static const unsigned short nBinRank
L1CaloEcalScale * ecalScale
static const unsigned short nBinEta
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Power< A, B >::type pow(const A &a, const B &b)