CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCTFConfigProducer Class Reference

#include <CSCTFConfigProducer.h>

Inheritance diagram for CSCTFConfigProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 CSCTFConfigProducer (const edm::ParameterSet &pset)
 
std::unique_ptr< L1MuCSCPtLutproduceL1MuCSCPtLutRcd (const L1MuCSCPtLutRcd &iRecord)
 
std::unique_ptr< L1MuCSCTFAlignmentproduceL1MuCSCTFAlignmentRcd (const L1MuCSCTFAlignmentRcd &iRecord)
 
std::unique_ptr< L1MuCSCTFConfigurationproduceL1MuCSCTFConfigurationRcd (const L1MuCSCTFConfigurationRcd &iRecord)
 
void readLUT (std::string path, unsigned short *lut, unsigned long length)
 
 ~CSCTFConfigProducer (void) 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::vector< double > alignment
 
std::string ptLUT_path
 
std::string registers [12]
 

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 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)
 

Detailed Description

Definition at line 19 of file CSCTFConfigProducer.h.

Constructor & Destructor Documentation

◆ CSCTFConfigProducer()

CSCTFConfigProducer::CSCTFConfigProducer ( const edm::ParameterSet pset)

Definition at line 10 of file CSCTFConfigProducer.cc.

10  {
11  const char* name[12] = {"registersSP1",
12  "registersSP2",
13  "registersSP3",
14  "registersSP4",
15  "registersSP5",
16  "registersSP6",
17  "registersSP7",
18  "registersSP8",
19  "registersSP9",
20  "registersSP10",
21  "registersSP11",
22  "registersSP12"};
23 
24  for (int sp = 0; sp < 12; sp++) {
25  std::vector<std::string> regs = pset.getParameter<std::vector<std::string> >(name[sp]);
26  for (std::vector<std::string>::const_iterator line = regs.begin(); line != regs.end(); line++)
27  registers[sp] += *line + "\n";
28  }
29 
30  alignment = pset.getParameter<std::vector<double> >("alignment");
31  ptLUT_path = pset.getParameter<std::string>("ptLUT_path");
35 }

References mps_splice::line, Skims_PA_cff::name, produceL1MuCSCPtLutRcd(), produceL1MuCSCTFAlignmentRcd(), produceL1MuCSCTFConfigurationRcd(), muonDTDigis_cfi::pset, ptLUT_path, registers, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~CSCTFConfigProducer()

CSCTFConfigProducer::~CSCTFConfigProducer ( void  )
inlineoverride

Definition at line 32 of file CSCTFConfigProducer.h.

32 {}

Member Function Documentation

◆ produceL1MuCSCPtLutRcd()

std::unique_ptr< L1MuCSCPtLut > CSCTFConfigProducer::produceL1MuCSCPtLutRcd ( const L1MuCSCPtLutRcd iRecord)

Definition at line 55 of file CSCTFConfigProducer.cc.

55  {
56  edm::LogInfo("L1-O2O: CSCTFConfigProducer") << "Producing "
57  << " L1MuCSCPtLut from PSET";
58 
59  std::unique_ptr<L1MuCSCPtLut> pt_lut = std::make_unique<L1MuCSCPtLut>();
60 
61  if (ptLUT_path.length()) {
62  readLUT(ptLUT_path, (unsigned short*)pt_lut->pt_lut, 1 << 21); //CSCBitWidths::kPtAddressWidth
63  } else {
64  throw cms::Exception("Undefined pT LUT")
65  << "CSCTFConfigProducer is unable to generate LUTs on the fly.\n"
66  "Specify full LUT file names or just avoid using CSCTFConfigProducer by uncommenting PTLUT "
67  "parameter sets in L1Trigger/CSCTrackFinder configuration."
68  << std::endl;
69  }
70  return pt_lut;
71 }

References Exception, ptLUT_path, and readLUT().

Referenced by CSCTFConfigProducer().

◆ produceL1MuCSCTFAlignmentRcd()

std::unique_ptr< L1MuCSCTFAlignment > CSCTFConfigProducer::produceL1MuCSCTFAlignmentRcd ( const L1MuCSCTFAlignmentRcd iRecord)

Definition at line 46 of file CSCTFConfigProducer.cc.

47  {
48  edm::LogInfo("L1-O2O: CSCTFConfigProducer") << "Producing "
49  << " L1MuCSCTFAlignment from PSET";
50 
51  std::unique_ptr<L1MuCSCTFAlignment> al = std::make_unique<L1MuCSCTFAlignment>(alignment);
52  return al;
53 }

Referenced by CSCTFConfigProducer().

◆ produceL1MuCSCTFConfigurationRcd()

std::unique_ptr< L1MuCSCTFConfiguration > CSCTFConfigProducer::produceL1MuCSCTFConfigurationRcd ( const L1MuCSCTFConfigurationRcd iRecord)

Definition at line 37 of file CSCTFConfigProducer.cc.

38  {
39  edm::LogInfo("L1-O2O: CSCTFConfigProducer") << "Producing "
40  << " L1MuCSCTFConfiguration from PSET";
41 
42  std::unique_ptr<L1MuCSCTFConfiguration> config = std::make_unique<L1MuCSCTFConfiguration>(registers);
43  return config;
44 }

References submitPVResolutionJobs::config, and registers.

Referenced by CSCTFConfigProducer().

◆ readLUT()

void CSCTFConfigProducer::readLUT ( std::string  path,
unsigned short *  lut,
unsigned long  length 
)

Definition at line 73 of file CSCTFConfigProducer.cc.

73  {
74  // Reading
75  if (path.find(".bin") != std::string::npos) { // Binary format
76  std::ifstream file(path.c_str(), std::ios::binary);
77  file.read((char*)lut, length * sizeof(unsigned short));
78  if (file.fail())
79  throw cms::Exception("Reading error") << "CSCTFConfigProducer cannot read " << length << " words from " << path
80  << " (errno=" << errno << ")" << std::endl;
81  if ((unsigned int)file.gcount() != length * sizeof(unsigned short))
82  throw cms::Exception("Incorrect LUT size")
83  << "CSCTFConfigProducer read " << (file.gcount() / sizeof(unsigned short)) << " words from " << path
84  << " instead of " << length << " (errno=" << errno << ")" << std::endl;
85  file.close();
86  } else {
87  std::ifstream file(path.c_str());
88  if (file.fail())
89  throw cms::Exception("Cannot open file")
90  << "CSCTFConfigProducer cannot open " << path << " (errno=" << errno << ")" << std::endl;
91  unsigned int address = 0;
92  for (address = 0; !file.eof() && address < length; address++)
93  file >> lut[address]; // Warning: this may throw non-cms like exception
94  if (address != length)
95  throw cms::Exception("Incorrect LUT size")
96  << "CSCTFConfigProducer read " << address << " words from " << path << " instead of " << length << std::endl;
97  file.close();
98  }
99  LogDebug("CSCTFConfigProducer::readLUT") << " read from " << path << " " << length << " words" << std::endl;
100 }

References Exception, geometryDiff::file, LogDebug, and castor_dqm_sourceclient_file_cfg::path.

Referenced by produceL1MuCSCPtLutRcd().

Member Data Documentation

◆ alignment

std::vector<double> CSCTFConfigProducer::alignment
private

Definition at line 22 of file CSCTFConfigProducer.h.

◆ ptLUT_path

std::string CSCTFConfigProducer::ptLUT_path
private

Definition at line 23 of file CSCTFConfigProducer.h.

Referenced by CSCTFConfigProducer(), and produceL1MuCSCPtLutRcd().

◆ registers

std::string CSCTFConfigProducer::registers[12]
private

Definition at line 21 of file CSCTFConfigProducer.h.

Referenced by CSCTFConfigProducer(), and produceL1MuCSCTFConfigurationRcd().

edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
CSCTFConfigProducer::produceL1MuCSCTFAlignmentRcd
std::unique_ptr< L1MuCSCTFAlignment > produceL1MuCSCTFAlignmentRcd(const L1MuCSCTFAlignmentRcd &iRecord)
Definition: CSCTFConfigProducer.cc:46
CSCTFConfigProducer::registers
std::string registers[12]
Definition: CSCTFConfigProducer.h:21
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
alignment
Definition: alignment.py:1
config
Definition: config.py:1
submitPVResolutionJobs.config
config
parse the configuration file
Definition: submitPVResolutionJobs.py:281
geometryDiff.file
file
Definition: geometryDiff.py:13
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
CSCTFConfigProducer::ptLUT_path
std::string ptLUT_path
Definition: CSCTFConfigProducer.h:23
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Exception
Definition: hltDiff.cc:245
CSCTFConfigProducer::readLUT
void readLUT(std::string path, unsigned short *lut, unsigned long length)
Definition: CSCTFConfigProducer.cc:73
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CSCTFConfigProducer::produceL1MuCSCTFConfigurationRcd
std::unique_ptr< L1MuCSCTFConfiguration > produceL1MuCSCTFConfigurationRcd(const L1MuCSCTFConfigurationRcd &iRecord)
Definition: CSCTFConfigProducer.cc:37
cms::Exception
Definition: Exception.h:70
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
mps_splice.line
line
Definition: mps_splice.py:76
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
CSCTFConfigProducer::produceL1MuCSCPtLutRcd
std::unique_ptr< L1MuCSCPtLut > produceL1MuCSCPtLutRcd(const L1MuCSCPtLutRcd &iRecord)
Definition: CSCTFConfigProducer.cc:55