CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1CaloEcalScaleConfigOnlineProd Class Reference
Inheritance diagram for L1CaloEcalScaleConfigOnlineProd:
L1ConfigOnlineProdBase< L1CaloEcalScaleRcd, L1CaloEcalScale > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1CaloEcalScaleConfigOnlineProd (const edm::ParameterSet &)
 
std::unique_ptr< L1CaloEcalScalenewObject (const std::string &objectKey) override
 
 ~L1CaloEcalScaleConfigOnlineProd () override
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1CaloEcalScaleRcd, L1CaloEcalScale >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual std::unique_ptr< L1CaloEcalScaleproduce (const L1CaloEcalScaleRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Attributes

std::map< int, std::vector< int > * > groupInfo
 
EcalTPGGroupslutGrpMap
 
const EcalElectronicsMappingtheMapping_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from L1ConfigOnlineProdBase< L1CaloEcalScaleRcd, L1CaloEcalScale >
bool getObjectKey (const L1CaloEcalScaleRcd &record, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Attributes inherited from L1ConfigOnlineProdBase< L1CaloEcalScaleRcd, L1CaloEcalScale >
std::optional< edm::ESConsumesCollectorT< L1CaloEcalScaleRcd > > m_consumesCollector
 
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 37 of file L1CaloEcalScaleConfigOnlineProd.cc.

Constructor & Destructor Documentation

◆ L1CaloEcalScaleConfigOnlineProd()

L1CaloEcalScaleConfigOnlineProd::L1CaloEcalScaleConfigOnlineProd ( const edm::ParameterSet iConfig)

◆ ~L1CaloEcalScaleConfigOnlineProd()

L1CaloEcalScaleConfigOnlineProd::~L1CaloEcalScaleConfigOnlineProd ( )
override

Definition at line 56 of file L1CaloEcalScaleConfigOnlineProd.cc.

References groupInfo, and theMapping_.

56  {
57  // do anything here that needs to be done at desctruction time
58  // (e.g. close files, deallocate resources etc.)
59  delete theMapping_;
60 
61  // delete lutGrpMap;
62  groupInfo.clear();
63 }
std::map< int, std::vector< int > * > groupInfo
const EcalElectronicsMapping * theMapping_

Member Function Documentation

◆ newObject()

std::unique_ptr< L1CaloEcalScale > L1CaloEcalScaleConfigOnlineProd::newObject ( const std::string &  objectKey)
overridevirtual

Implements L1ConfigOnlineProdBase< L1CaloEcalScaleRcd, L1CaloEcalScale >.

Definition at line 65 of file L1CaloEcalScaleConfigOnlineProd.cc.

References l1t::OMDSReader::basicQuery(), gather_cfg::cout, EcalBarrel, EcalEndcap, l1t::OMDSReader::QueryResults::fillVariable(), l1t::OMDSReader::QueryResults::fillVariableFromRow(), EcalTPGGroups::getMap(), EcalElectronicsMapping::getTrigTowerDetId(), watchdog::group, groupInfo, mps_fire::i, globals_cff::id1, globals_cff::id2, LEDCalibrationChannels::ieta, createfilelist::int, LEDCalibrationChannels::iphi, dqmiolumiharvest::j, writeEcalDQMStatus::lastValue, lutGrpMap, L1ConfigOnlineProdBase< L1CaloEcalScaleRcd, L1CaloEcalScale >::m_omdsReader, L1CaloEcalScale::nBinEta, L1CaloEcalScale::nBinRank, l1t::OMDSReader::QueryResults::numberRows(), funct::pow(), l1t::OMDSReader::QueryResults::queryFailed(), EcalTPGGroups::setValue(), l1t::OMDSReader::singleAttribute(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, ctpps_dqm_sourceclient-live_cfg::test, theMapping_, EcalTrigTowerDetId::validDetId(), and ecaldqm::zside().

65  {
66  std::cout << "object Key " << objectKey << std::endl;
67 
68  if (objectKey == "NULL" || objectKey.empty()) { // return default blank ecal scale
69  return std::make_unique<L1CaloEcalScale>(0);
70  }
71  if (objectKey == "IDENTITY") { // return identity ecal scale
72  return std::make_unique<L1CaloEcalScale>(1);
73  }
74 
75  double ee_lsb = 0.;
76  double eb_lsb = 0.;
77 
78  std::vector<std::string> mainStrings;
79 
80  // ~~~~~~~~~ Cut values ~~~~~~~~~
81 
82  std::vector<std::string> paramStrings;
83  paramStrings.push_back("LOGIC_ID"); // EB/EE
84  paramStrings.push_back("ETSAT"); //Only object needed
85 
86  std::vector<std::string> IDStrings;
87  IDStrings.push_back("NAME");
88  IDStrings.push_back("ID1");
89  IDStrings.push_back("ID2");
90  IDStrings.push_back("maps_to");
91 
92  l1t::OMDSReader::QueryResults paramResults = m_omdsReader.basicQuery(paramStrings,
93  "CMS_ECAL_CONF",
94  "FE_CONFIG_LUTPARAM_DAT",
95  "FE_CONFIG_LUTPARAM_DAT.LUT_CONF_ID",
96  m_omdsReader.singleAttribute(objectKey));
97 
98  if (paramResults.queryFailed() || (paramResults.numberRows() == 0)) // check query successful
99  {
100  edm::LogError("L1-O2O") << "Problem with L1CaloEcalScale key. Unable to find lutparam dat table";
101  return std::unique_ptr<L1CaloEcalScale>();
102  }
103 
104  for (int i = 0; i < paramResults.numberRows(); i++) {
105  //EcalTPGPhysicsConst::Item item;
106  float etSat;
107  paramResults.fillVariableFromRow("ETSAT", i, etSat);
108 
109  std::string ecid_name;
110  int logic_id;
111  paramResults.fillVariableFromRow("LOGIC_ID", i, logic_id);
112 
114  IDStrings, "CMS_ECAL_COND", "CHANNELVIEW", "CHANNELVIEW.LOGIC_ID", m_omdsReader.singleAttribute(logic_id));
115 
116  logicID.fillVariable("NAME", ecid_name);
117 
118  if (ecid_name == "EB")
119  eb_lsb = etSat / 1024;
120  else if ("EE" == ecid_name)
121  ee_lsb = etSat / 1024;
122  else {
123  edm::LogError("L1-O2O")
124  << "Problem with L1CaloEcalScale LOGIC_ID. unable to find channel view with appropiate logic id";
125  return std::unique_ptr<L1CaloEcalScale>();
126  }
127  }
128  // std::cout << " eb lsb " << eb_lsb << " ee_lsb " << ee_lsb << std::endl;
129 
130  std::vector<std::string> grpLUT;
131  grpLUT.push_back("GROUP_ID");
132  grpLUT.push_back("LUT_ID");
133  grpLUT.push_back("LUT_VALUE");
134 
136  "CMS_ECAL_CONF",
137  "FE_LUT_PER_GROUP_DAT",
138  "FE_LUT_PER_GROUP_DAT.LUT_CONF_ID",
139  m_omdsReader.singleAttribute(objectKey));
140 
141  if (lutGrpResults.queryFailed() || (lutGrpResults.numberRows() % 1024 != 0)) // check query successful
142  {
143  edm::LogError("L1-O2O") << "Problem with L1CaloEcalScale key. No group info";
144  return std::unique_ptr<L1CaloEcalScale>();
145  }
146 
147  int nEntries = lutGrpResults.numberRows();
148  for (int i = 0; i < nEntries; i++) {
149  int group, lutID;
150  float lutValue;
151 
152  lutGrpResults.fillVariableFromRow("GROUP_ID", i, group);
153  if (groupInfo.find(group) == groupInfo.end()) {
154  groupInfo[group] = new std::vector<int>;
155  (groupInfo[group])->resize(1024);
156  }
157 
158  lutGrpResults.fillVariableFromRow("LUT_ID", i, lutID);
159  lutGrpResults.fillVariableFromRow("LUT_VALUE", i, lutValue);
160  groupInfo[group]->at(lutID) = (int)lutValue;
161  }
162 
163  std::map<int, std::vector<int> > tpgValueMap;
164 
165  std::map<int, std::vector<int>*>::iterator grpIt;
166  for (grpIt = groupInfo.begin(); grpIt != groupInfo.end(); ++grpIt) {
167  const std::vector<int>* lut_ = grpIt->second;
168 
169  std::vector<int> tpgValue;
170  tpgValue.resize(256);
171  int lastValue = 0;
172  for (int tpg = 0; tpg < 256; tpg++) {
173  for (int i = 0; i < 1024; i++) {
174  if (tpg == (0xff & (lut_->at(i)))) {
175  tpgValue[tpg] = i;
176  lastValue = i;
177  break;
178  }
179  tpgValue[tpg] = lastValue;
180  }
181  }
182  tpgValueMap[grpIt->first] = tpgValue;
183  }
184 
185  std::vector<std::string> groupMap;
186  groupMap.push_back("LOGIC_ID");
187  groupMap.push_back("GROUP_ID");
188 
189  l1t::OMDSReader::QueryResults grpMapResults = m_omdsReader.basicQuery(groupMap,
190  "CMS_ECAL_CONF",
191  "FE_CONFIG_LUT_DAT",
192  "FE_CONFIG_LUT_DAT.LUT_CONF_ID",
193  m_omdsReader.singleAttribute(objectKey));
194  if (grpMapResults.queryFailed() || (grpMapResults.numberRows() == 0)) // check query successful
195  {
196  edm::LogError("L1-O2O") << "Problem with L1CaloEcalScale key. No fe_config_lut_dat info";
197  return std::unique_ptr<L1CaloEcalScale>();
198  }
199 
200  nEntries = grpMapResults.numberRows();
201  for (int i = 0; i < nEntries; ++i) {
202  std::string ecid_name;
203  int logic_id;
204  grpMapResults.fillVariableFromRow("LOGIC_ID", i, logic_id);
205  int group_id;
206  grpMapResults.fillVariableFromRow("GROUP_ID", i, group_id);
207  // if(logic_id >= 2100001901 && logic_id <= 2100001916)
208  // std::cout<< "missing logic id found " <<logic_id <<std::endl;
210  IDStrings, "CMS_ECAL_COND", "CHANNELVIEW", "CHANNELVIEW.LOGIC_ID", m_omdsReader.singleAttribute(logic_id));
211  if (paramResults.queryFailed() || (paramResults.numberRows() == 0)) // check query successful
212  {
213  edm::LogError("L1-O2O") << "Problem with L1CaloEcalScale key. Unable to find logic_id channel view";
214  return std::unique_ptr<L1CaloEcalScale>();
215  }
216  for (int j = 0; j < IDResults.numberRows(); j++) {
217  std::string ecid_name, maps_to;
218 
219  IDResults.fillVariableFromRow("NAME", j, ecid_name);
220  IDResults.fillVariableFromRow("maps_to", j, maps_to);
221  if (logic_id >= 2100001901 && logic_id <= 2100001916)
222  // std::cout << " name " << ecid_name << " maps to " << maps_to <<std::endl;
223  if (ecid_name != maps_to) {
224  continue; // make sure they match
225  }
226  if (ecid_name == "EB_trigger_tower" || ecid_name == "EE_trigger_tower") {
227  int id1, id2;
228  IDResults.fillVariableFromRow("ID1", j, id1);
229  IDResults.fillVariableFromRow("ID2", j, id2);
230 
231  if (ecid_name == "EB_trigger_tower")
232  id1 += 36; //lowest TCC for barrel 37
234  /* if(ecid_name == "EE_trigger_tower"){
235  int testID = theMapping_->TCCid(temp);
236 
237  if( testID != id1 ){
238  std::cout << " unmatched mapping testID " <<testID <<std::endl;
239  std::cout << "id1 " << id1 << " id2 " <<id2<< " iphi " << temp.iphi() <<" ieta " << temp.ieta() <<std::endl;
240  }
241  }
242  if(ecid_name == "EB_trigger_tower"){
243  int testID = theMapping_->TCCid(temp);
244  if( testID != id1 ){
245  std::cout << " unmatched mapping testID " <<testID <<std::endl;
246  std::cout << "id1 " << id1 << " id2 " <<id2<< " iphi " << temp.iphi() <<" ieta " << temp.ieta() <<std::endl;
247  }
248  }
249  */
250  // if(temp.ieta() == -18 || temp.ietaAbs() == 28)
251  // if(logic_id >= 2100001901 && logic_id <= 2100001916)
252 
253  lutGrpMap->setValue(temp, group_id); // assume ee has less than 68 tt
254  break;
255  }
256  }
257  }
258 
260 
261  auto ecalScale = std::make_unique<L1CaloEcalScale>(0);
262 
263  for (unsigned short ieta = 1; ieta <= L1CaloEcalScale::nBinEta; ++ieta) {
264  EcalSubdetector subdet = (ieta <= 17) ? EcalBarrel : EcalEndcap;
265  double et_lsb = (ieta <= 17) ? eb_lsb : ee_lsb;
266  for (int pos = 0; pos <= 1; pos++) {
267  int zside = (int)pow(-1, pos);
268 
269  // std::cout << "ieta " <<zside*ieta ;
270  for (int iphi = 1; iphi <= 72; iphi++) {
272  continue;
274  EcalTPGGroups::EcalTPGGroupsMapItr itLut = gMap.find(test);
275  if (itLut != gMap.end()) {
276  // std::cout << " non mapped section iphi " << iphi << " ieta " <<ieta << " tccid " << theMapping_->TCCid(test) << " iTT " << theMapping_->iTT(test)<< std::endl;
277  std::vector<int> tpgValue = tpgValueMap[itLut->second];
278 
279  for (unsigned short irank = 0; irank < L1CaloEcalScale::nBinRank; ++irank) {
280  ecalScale->setBin(irank, ieta, zside, et_lsb * tpgValue[irank]);
281 
282  // std::cout << " irank " << irank << " etValue " << et_lsb*tpgValue[irank] << std::endl;
283  }
284 
285  break;
286  }
287  }
288  }
289  }
290 
291  // ecalScale->print(std::cout);
292 
293  // ------------ method called to produce the data ------------
294  return ecalScale;
295 }
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
std::map< int, std::vector< int > * > groupInfo
int zside(DetId const &)
Log< level::Error, false > LogError
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="")
Definition: OMDSReader.cc:75
void setValue(const uint32_t &rawId, const uint32_t &ObjectId)
Definition: EcalTPGGroups.cc:7
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
const EcalElectronicsMapping * theMapping_
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.
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
EcalSubdetector
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Member Data Documentation

◆ groupInfo

std::map<int, std::vector<int>*> L1CaloEcalScaleConfigOnlineProd::groupInfo
private

◆ lutGrpMap

EcalTPGGroups* L1CaloEcalScaleConfigOnlineProd::lutGrpMap
private

◆ theMapping_

const EcalElectronicsMapping* L1CaloEcalScaleConfigOnlineProd::theMapping_
private