44 std::unique_ptr< L1CaloEcalScale >
newObject(
76 std::unique_ptr< L1CaloEcalScale >
79 std:: cout <<
"object Key " << objectKey <<std::endl;
81 if(objectKey ==
"NULL" || objectKey.empty()) {
82 return std::make_unique<L1CaloEcalScale>(0);
84 if(objectKey ==
"IDENTITY") {
85 return std::make_unique<L1CaloEcalScale>(1);
91 std::vector < std::string > mainStrings;
96 std::vector< std::string > paramStrings ;
97 paramStrings.push_back(
"LOGIC_ID");
98 paramStrings.push_back(
"ETSAT");
101 std::vector< std::string> IDStrings;
102 IDStrings.push_back(
"NAME");
103 IDStrings.push_back(
"ID1");
104 IDStrings.push_back(
"ID2");
105 IDStrings.push_back(
"maps_to");
110 "FE_CONFIG_LUTPARAM_DAT",
111 "FE_CONFIG_LUTPARAM_DAT.LUT_CONF_ID",
118 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. Unable to find lutparam dat table" ;
119 return std::unique_ptr< L1CaloEcalScale >() ;
139 "CHANNELVIEW.LOGIC_ID",
147 else if(
"EE" == ecid_name)
150 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale LOGIC_ID. unable to find channel view with appropiate logic id" ;
151 return std::unique_ptr< L1CaloEcalScale >() ;
157 std::vector< std::string > grpLUT;
158 grpLUT.push_back(
"GROUP_ID");
159 grpLUT.push_back(
"LUT_ID");
160 grpLUT.push_back(
"LUT_VALUE");
165 "FE_LUT_PER_GROUP_DAT",
166 "FE_LUT_PER_GROUP_DAT.LUT_CONF_ID",
173 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. No group info" ;
174 return std::unique_ptr< L1CaloEcalScale >() ;
179 for(
int i = 0;
i < nEntries;
i++) {
194 std::map<int, std::vector<int> > tpgValueMap;
196 std::map<int, std::vector<int>* >::iterator grpIt;
198 const std::vector<int> * lut_ = grpIt->second;
200 std::vector<int> tpgValue;
201 tpgValue.resize(256);
203 for(
int tpg = 0; tpg < 256 ; tpg++){
205 for(
int i = 0;
i < 1024 ;
i++) {
207 if(tpg == (0xff & (lut_->at(
i)))){
212 tpgValue[tpg] = lastValue;
215 tpgValueMap[grpIt->first] = tpgValue;
219 std::vector < std::string > groupMap;
220 groupMap.push_back(
"LOGIC_ID");
221 groupMap.push_back(
"GROUP_ID");
229 "FE_CONFIG_LUT_DAT.LUT_CONF_ID",
235 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. No fe_config_lut_dat info" ;
236 return std::unique_ptr< L1CaloEcalScale >() ;
240 for(
int i = 0;
i< nEntries; ++
i){
252 "CHANNELVIEW.LOGIC_ID",
258 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloEcalScale key. Unable to find logic_id channel view" ;
259 return std::unique_ptr< L1CaloEcalScale >() ;
261 for(
int j = 0; j < IDResults.
numberRows(); j++){
267 if(logic_id >= 2100001901 && logic_id <= 2100001916)
269 if(ecid_name != maps_to){
272 if(ecid_name==
"EB_trigger_tower" || ecid_name ==
"EE_trigger_tower") {
277 if(ecid_name ==
"EB_trigger_tower")
308 auto ecalScale = std::make_unique<L1CaloEcalScale>(0);
312 double et_lsb = (ieta<=17) ? eb_lsb : ee_lsb;
317 for(
int iphi = 1; iphi<=72; iphi++){
322 if(itLut != gMap.end()) {
324 std::vector<int> tpgValue = tpgValueMap[itLut->second];
328 ecalScale->setBin(irank, ieta, zside, et_lsb * tpgValue[irank]);
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
~L1CaloEcalScaleConfigOnlineProd() override
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.
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="")
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
static const unsigned short nBinEta
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Power< A, B >::type pow(const A &a, const B &b)
std::unique_ptr< L1CaloEcalScale > newObject(const std::string &objectKey) override