45 virtual boost::shared_ptr< L1CaloEcalScale >
newObject(
46 const std::string& objectKey ) ;
93 boost::shared_ptr< L1CaloEcalScale >
96 using namespace edm::es;
98 std:: cout <<
"object Key " << objectKey <<std::endl;
100 if(objectKey ==
"NULL" || objectKey ==
"")
101 return boost::shared_ptr< L1CaloEcalScale >(
ecalScale );
102 if(objectKey ==
"IDENTITY"){
105 return boost::shared_ptr< L1CaloEcalScale >(
ecalScale);
112 std::vector < std::string > mainStrings;
117 std::vector< std::string > paramStrings ;
118 paramStrings.push_back(
"LOGIC_ID");
119 paramStrings.push_back(
"ETSAT");
122 std::vector< std::string> IDStrings;
123 IDStrings.push_back(
"NAME");
124 IDStrings.push_back(
"ID1");
125 IDStrings.push_back(
"ID2");
126 IDStrings.push_back(
"maps_to");
131 "FE_CONFIG_LUTPARAM_DAT",
132 "FE_CONFIG_LUTPARAM_DAT.LUT_CONF_ID",
136 if( paramResults.queryFailed()
137 || (paramResults.numberRows()==0) )
139 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. Unable to find lutparam dat table" ;
140 return boost::shared_ptr< L1CaloEcalScale >() ;
145 for(
int i = 0;
i < paramResults.numberRows() ;
i++){
149 paramResults.fillVariableFromRow(
"ETSAT",
i,etSat);
151 std::string ecid_name;
153 paramResults.fillVariableFromRow(
"LOGIC_ID",
i, logic_id);
160 "CHANNELVIEW.LOGIC_ID",
168 else if(
"EE" == ecid_name)
171 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale LOGIC_ID. unable to find channel view with appropiate logic id" ;
172 return boost::shared_ptr< L1CaloEcalScale >() ;
178 std::vector< std::string > grpLUT;
179 grpLUT.push_back(
"GROUP_ID");
180 grpLUT.push_back(
"LUT_ID");
181 grpLUT.push_back(
"LUT_VALUE");
186 "FE_LUT_PER_GROUP_DAT",
187 "FE_LUT_PER_GROUP_DAT.LUT_CONF_ID",
191 if( lutGrpResults.queryFailed()
192 || (lutGrpResults.numberRows()%1024 !=0) )
194 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. No group info" ;
195 return boost::shared_ptr< L1CaloEcalScale >() ;
199 int nEntries = lutGrpResults.numberRows();
200 for(
int i = 0;
i < nEntries;
i++) {
204 lutGrpResults.fillVariableFromRow(
"GROUP_ID",
i,group);
210 lutGrpResults.fillVariableFromRow(
"LUT_ID",
i,lutID);
211 lutGrpResults.fillVariableFromRow(
"LUT_VALUE",
i,lutValue);
212 groupInfo[group]->at(lutID) = (int) lutValue;
215 std::map<int, std::vector<int> > tpgValueMap;
217 std::map<int, std::vector<int>* >::iterator grpIt;
219 const std::vector<int> * lut_ = grpIt->second;
221 std::vector<int> tpgValue;
222 tpgValue.resize(256);
224 for(
int tpg = 0; tpg < 256 ; tpg++){
226 for(
int i = 0;
i < 1024 ;
i++) {
228 if(tpg == (0xff & (lut_->at(
i)))){
236 tpgValueMap[grpIt->first] = tpgValue;
240 std::vector < std::string > groupMap;
241 groupMap.push_back(
"LOGIC_ID");
242 groupMap.push_back(
"GROUP_ID");
250 "FE_CONFIG_LUT_DAT.LUT_CONF_ID",
253 if( grpMapResults.queryFailed()
254 || (grpMapResults.numberRows()==0) )
256 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. No fe_config_lut_dat info" ;
257 return boost::shared_ptr< L1CaloEcalScale >() ;
260 nEntries = grpMapResults.numberRows();
261 for(
int i = 0;
i< nEntries; ++
i){
262 std::string ecid_name;
264 grpMapResults.fillVariableFromRow(
"LOGIC_ID",
i, logic_id);
266 grpMapResults.fillVariableFromRow(
"GROUP_ID",
i, group_id);
273 "CHANNELVIEW.LOGIC_ID",
276 if( paramResults.queryFailed()
277 || (paramResults.numberRows()==0) )
279 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. Unable to find logic_id channel view" ;
280 return boost::shared_ptr< L1CaloEcalScale >() ;
284 std::string ecid_name, maps_to;
288 if(logic_id >= 2100001901 && logic_id <= 2100001916)
290 if(ecid_name != maps_to){
293 if(ecid_name==
"EB_trigger_tower" || ecid_name ==
"EE_trigger_tower") {
298 if(ecid_name ==
"EB_trigger_tower")
333 double et_lsb = (ieta<=17) ? eb_lsb : ee_lsb;
335 int zside = (int)
pow(-1,
pos);
338 for(
int iphi = 1; iphi<=72; iphi++){
343 if(itLut != gMap.end()) {
345 std::vector<int> tpgValue = tpgValueMap[itLut->second];
365 return boost::shared_ptr< L1CaloEcalScale >(
ecalScale );
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
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="") const
L1CaloEcalScaleConfigOnlineProd(const edm::ParameterSet &)
~L1CaloEcalScaleConfigOnlineProd()
void setValue(const uint32_t &rawId, const uint32_t &ObjectId)
virtual boost::shared_ptr< L1CaloEcalScale > newObject(const std::string &objectKey)
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)