CMS 3D CMS Logo

List of all members | Public Member Functions
DTTFMasksOnlineProd Class Reference
Inheritance diagram for DTTFMasksOnlineProd:
L1ConfigOnlineProdBase< L1MuDTTFMasksRcd, L1MuDTTFMasks > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 DTTFMasksOnlineProd (const edm::ParameterSet &)
 
std::unique_ptr< L1MuDTTFMasksnewObject (const std::string &objectKey) override
 
 ~DTTFMasksOnlineProd () override
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1MuDTTFMasksRcd, L1MuDTTFMasks >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual std::unique_ptr< L1MuDTTFMasksproduce (const L1MuDTTFMasksRcd &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)
 

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< L1MuDTTFMasksRcd, L1MuDTTFMasks >
bool getObjectKey (const L1MuDTTFMasksRcd &record, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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< L1MuDTTFMasksRcd, L1MuDTTFMasks >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 32 of file DTTFMasksOnlineProd.cc.

Constructor & Destructor Documentation

◆ DTTFMasksOnlineProd()

DTTFMasksOnlineProd::DTTFMasksOnlineProd ( const edm::ParameterSet iConfig)

Definition at line 46 of file DTTFMasksOnlineProd.cc.

48  //the following line is needed to tell the framework what
49  // data is being produced
50 
51  //now do what ever other initialization is needed
52 }

◆ ~DTTFMasksOnlineProd()

DTTFMasksOnlineProd::~DTTFMasksOnlineProd ( )
override

Definition at line 54 of file DTTFMasksOnlineProd.cc.

54  {
55  // do anything here that needs to be done at desctruction time
56  // (e.g. close files, deallocate resources etc.)
57 }

Member Function Documentation

◆ newObject()

std::unique_ptr< L1MuDTTFMasks > DTTFMasksOnlineProd::newObject ( const std::string &  objectKey)
overridevirtual

Implements L1ConfigOnlineProdBase< L1MuDTTFMasksRcd, L1MuDTTFMasks >.

Definition at line 59 of file DTTFMasksOnlineProd.cc.

59  {
60  auto pDTTFMasks = std::make_unique<L1MuDTTFMasks>();
61 
62  pDTTFMasks->reset();
63 
64  std::string dttfSchema = "CMS_DT_TF";
65 
66  // Order of strings is used below -- don't change!
67  std::vector<std::string> crateMaskColumns;
68  crateMaskColumns.push_back("WEDGE_CRATE_1");
69  crateMaskColumns.push_back("WEDGE_CRATE_2");
70  crateMaskColumns.push_back("WEDGE_CRATE_3");
71  crateMaskColumns.push_back("WEDGE_CRATE_4");
72  crateMaskColumns.push_back("WEDGE_CRATE_5");
73  crateMaskColumns.push_back("WEDGE_CRATE_6");
74  crateMaskColumns.push_back("WEDGE_CRATE_1_E");
75  crateMaskColumns.push_back("WEDGE_CRATE_2_E");
76  crateMaskColumns.push_back("WEDGE_CRATE_3_E");
77  crateMaskColumns.push_back("WEDGE_CRATE_4_E");
78  crateMaskColumns.push_back("WEDGE_CRATE_5_E");
79  crateMaskColumns.push_back("WEDGE_CRATE_6_E");
80 
81  l1t::OMDSReader::QueryResults crateMaskResults = m_omdsReader.basicQuery(crateMaskColumns,
82  dttfSchema,
83  "DTTF_RUN_SETTINGS",
84  "DTTF_RUN_SETTINGS.ID",
85  m_omdsReader.singleAttribute(objectKey));
86 
87  if (crateMaskResults.queryFailed() || crateMaskResults.numberRows() != 1) // check query successful
88  {
89  edm::LogError("L1-O2O") << "Problem with L1MuDTTFMasks key " << objectKey;
90  return std::unique_ptr<L1MuDTTFMasks>();
91  }
92 
93  // Cache crate masks
94  unsigned long crateMaskL[6];
95  unsigned long crateMaskR[6];
96  unsigned long krateMaskL[6];
97  unsigned long krateMaskR[6];
98  for (int icrate = 0; icrate < 6; ++icrate) {
99  std::string crateMask;
100  crateMaskResults.fillVariable(crateMaskColumns[icrate], crateMask);
101  char* pEnd;
102  crateMaskL[icrate] = std::strtol(crateMask.c_str(), &pEnd, 16);
103  crateMaskR[icrate] = std::strtol(pEnd, (char**)nullptr, 16);
104 
105  crateMaskResults.fillVariable(crateMaskColumns[icrate + 6], crateMask);
106  krateMaskL[icrate] = std::strtol(crateMask.c_str(), &pEnd, 16);
107  krateMaskR[icrate] = std::strtol(pEnd, (char**)nullptr, 16);
108 
109  std::cout << "Crate " << icrate << " masks"
110  << " L: " << std::hex << crateMaskL[icrate] << " " << std::hex << krateMaskL[icrate] << " R: " << std::hex
111  << crateMaskR[icrate] << " " << std::hex << krateMaskR[icrate] << std::endl;
112  }
113 
114  // Map of sector (0-11) to name (L/R)
115  std::string sectorNames[12] = {"R", "L", "R", "L", "L", "R", "L", "R", "R", "L", "R", "L"};
116 
117  // Map of sector (0-11) to crate (0-5)
118  int crateNumbers[12] = {3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0};
119 
120  // Map of wheel array index to wheel number (+- 3, 2, 1).
121  int wheelNumbers[6] = {-3, -2, -1, 1, 2, 3};
122 
123  // Map of wheel array index to name ({N,P}{0,1,2}).
124  std::string wheelNames[6] = {"N2", "N1", "N0", "P0", "P1", "P2"};
125 
126  // Map of sector+wheel name to bit number in crate mask
127  std::map<std::string, unsigned int> crateMaskBitmap;
128  crateMaskBitmap.insert(std::make_pair("N2", 24));
129  crateMaskBitmap.insert(std::make_pair("N1", 20));
130  crateMaskBitmap.insert(std::make_pair("N0", 16));
131  crateMaskBitmap.insert(std::make_pair("P0", 8));
132  crateMaskBitmap.insert(std::make_pair("P1", 4));
133  crateMaskBitmap.insert(std::make_pair("P2", 0));
134 
135  std::map<std::string, unsigned int> krateMaskBitmap;
136  krateMaskBitmap.insert(std::make_pair("N2", 16));
137  krateMaskBitmap.insert(std::make_pair("N1", 12));
138  krateMaskBitmap.insert(std::make_pair("P0", 8));
139  krateMaskBitmap.insert(std::make_pair("P1", 4));
140  krateMaskBitmap.insert(std::make_pair("P2", 0));
141 
142  // Loop over sectors 0-11
143  for (int isc = 0; isc < 12; ++isc) {
144  int crateNumber = crateNumbers[isc];
145  unsigned long crateMask = crateMaskL[crateNumber];
146  if (sectorNames[isc] == "R")
147  crateMask = crateMaskR[crateNumber];
148  unsigned long krateMask = krateMaskL[crateNumber];
149  if (sectorNames[isc] == "R")
150  krateMask = krateMaskR[crateNumber];
151  std::cout << "isc " << isc << " icr " << crateNumber << std::endl;
152 
153  // Loop over wheels 0-5
154  for (int iwh = 0; iwh < 6; ++iwh) {
155  std::string sectorWheelName = sectorNames[isc] + wheelNames[iwh];
156 
157  unsigned int maskBit = 30;
158  std::map<std::string, unsigned int>::const_iterator itr = crateMaskBitmap.find(wheelNames[iwh]);
159  if (itr != crateMaskBitmap.end())
160  maskBit = itr->second;
161 
162  unsigned long phtfEnabled = (crateMask >> maskBit) & 0xF;
163 
164  if (wheelNames[iwh] == "P2")
165  phtfEnabled += (crateMask >> 24) & 0x10;
166  if (wheelNames[iwh] == "N2")
167  phtfEnabled += (crateMask >> 25) & 0x10;
168 
169  std::cout << "Bits " << std::dec << maskBit << " (" << sectorWheelName << ") of mask " << std::hex << crateMask
170  << " is " << std::hex << phtfEnabled << std::endl;
171 
172  int nwh = wheelNumbers[iwh];
173 
174  unsigned long chmask = phtfEnabled & 0x1;
175  std::cout << " INREC_CHDIS_ST1 " << 1 - chmask;
176  pDTTFMasks->set_inrec_chdis_st1(nwh, isc, 1 - chmask);
177  chmask = (phtfEnabled >> 1) & 0x1;
178  std::cout << " INREC_CHDIS_ST2 " << 1 - chmask;
179  pDTTFMasks->set_inrec_chdis_st2(nwh, isc, 1 - chmask);
180  chmask = (phtfEnabled >> 2) & 0x1;
181  std::cout << " INREC_CHDIS_ST3 " << 1 - chmask;
182  pDTTFMasks->set_inrec_chdis_st3(nwh, isc, 1 - chmask);
183  chmask = (phtfEnabled >> 3) & 0x1;
184  std::cout << " INREC_CHDIS_ST4 " << 1 - chmask;
185  pDTTFMasks->set_inrec_chdis_st4(nwh, isc, 1 - chmask);
186  chmask = (phtfEnabled >> 4) & 0x1;
187  std::cout << " INREC_CHDIS_CSC " << 1 - chmask << std::endl;
188  pDTTFMasks->set_inrec_chdis_csc(nwh, isc, 1 - chmask);
189 
190  if (wheelNames[iwh] == "N0")
191  continue;
192 
193  maskBit = 20;
194  itr = krateMaskBitmap.find(wheelNames[iwh]);
195  if (itr != krateMaskBitmap.end())
196  maskBit = itr->second;
197 
198  unsigned long ettfEnabled = (krateMask >> maskBit) & 0x7;
199 
200  std::cout << "Bits " << std::dec << maskBit << " (" << sectorWheelName << ") of mask " << std::hex << krateMask
201  << " is " << std::hex << ettfEnabled << std::endl;
202 
203  chmask = ettfEnabled & 0x1;
204  std::cout << " ETSOC_CHDIS_ST1 " << 1 - chmask;
205  pDTTFMasks->set_etsoc_chdis_st1(nwh, isc, 1 - chmask);
206  chmask = (ettfEnabled >> 1) & 0x1;
207  std::cout << " ETSOC_CHDIS_ST2 " << 1 - chmask;
208  pDTTFMasks->set_etsoc_chdis_st2(nwh, isc, 1 - chmask);
209  chmask = (ettfEnabled >> 2) & 0x1;
210  std::cout << " ETSOC_CHDIS_ST3 " << 1 - chmask << std::endl;
211  pDTTFMasks->set_etsoc_chdis_st3(nwh, isc, 1 - chmask);
212  }
213  }
214 
215  return pDTTFMasks;
216 }

References l1t::OMDSReader::basicQuery(), gather_cfg::cout, TauDecayModes::dec, l1t::OMDSReader::QueryResults::fillVariable(), L1ConfigOnlineProdBase< L1MuDTTFMasksRcd, L1MuDTTFMasks >::m_omdsReader, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), l1t::OMDSReader::singleAttribute(), AlCaHLTBitMon_QueryRunRegistry::string, and testProducerWithPsetDescEmpty_cfi::x1.

l1t::OMDSReader::QueryResults
Definition: OMDSReader.h:49
L1ConfigOnlineProdBase< L1MuDTTFMasksRcd, L1MuDTTFMasks >::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ConfigOnlineProdBase.h:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1t::OMDSReader::singleAttribute
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
L1ConfigOnlineProdBase< L1MuDTTFMasksRcd, L1MuDTTFMasks >
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
l1t::OMDSReader::QueryResults::fillVariable
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1t::OMDSReader::QueryResults::numberRows
int numberRows() const
Definition: OMDSReader.h:60
l1t::OMDSReader::basicQuery
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
l1t::OMDSReader::QueryResults::queryFailed
bool queryFailed() const
Definition: OMDSReader.h:59
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143