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 ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
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

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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={})
 
- 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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

Definition at line 19 of file CSCTFConfigProducer.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file CSCTFConfigProducer.cc.

References edm::ParameterSet::getParameter(), mps_splice::line, dataset::name, produceL1MuCSCPtLutRcd(), produceL1MuCSCTFAlignmentRcd(), produceL1MuCSCTFConfigurationRcd(), ptLUT_path, registers, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

9  {
10  const char *name[12] = {"registersSP1", "registersSP2", "registersSP3", "registersSP4",
11  "registersSP5", "registersSP6", "registersSP7", "registersSP8",
12  "registersSP9", "registersSP10","registersSP11","registersSP12"};
13 
14  for(int sp=0; sp<12; sp++){
15  std::vector<std::string> regs = pset.getParameter<std::vector<std::string> >(name[sp]);
16  for(std::vector<std::string>::const_iterator line=regs.begin(); line!=regs.end(); line++)
17  registers[sp] += *line + "\n";
18  }
19 
20  alignment = pset.getParameter< std::vector<double> >("alignment");
21  ptLUT_path = pset.getParameter< std::string > ("ptLUT_path");
25 
26 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
std::string registers[12]
std::unique_ptr< L1MuCSCTFAlignment > produceL1MuCSCTFAlignmentRcd(const L1MuCSCTFAlignmentRcd &iRecord)
std::unique_ptr< L1MuCSCTFConfiguration > produceL1MuCSCTFConfigurationRcd(const L1MuCSCTFConfigurationRcd &iRecord)
std::unique_ptr< L1MuCSCPtLut > produceL1MuCSCPtLutRcd(const L1MuCSCPtLutRcd &iRecord)
CSCTFConfigProducer::~CSCTFConfigProducer ( void  )
inlineoverride

Definition at line 32 of file CSCTFConfigProducer.h.

32 {}

Member Function Documentation

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

Definition at line 46 of file CSCTFConfigProducer.cc.

References Exception, ptLUT_path, and readLUT().

Referenced by CSCTFConfigProducer().

46  {
47  edm::LogInfo( "L1-O2O: CSCTFConfigProducer" ) << "Producing "
48  << " L1MuCSCPtLut from PSET";
49 
50 
51 
52  std::unique_ptr<L1MuCSCPtLut> pt_lut = std::unique_ptr<L1MuCSCPtLut>( new L1MuCSCPtLut() );
53 
54  if( ptLUT_path.length() ){
55  readLUT(ptLUT_path, (unsigned short *)pt_lut->pt_lut, 1<<21); //CSCBitWidths::kPtAddressWidth
56  } else {
57  throw cms::Exception("Undefined pT LUT")<<"CSCTFConfigProducer is unable to generate LUTs on the fly.\n"
58  "Specify full LUT file names or just avoid using CSCTFConfigProducer by uncommenting PTLUT "
59  "parameter sets in L1Trigger/CSCTrackFinder configuration."<<std::endl;
60  }
61  return pt_lut;
62 }
void readLUT(std::string path, unsigned short *lut, unsigned long length)
std::unique_ptr< L1MuCSCTFAlignment > CSCTFConfigProducer::produceL1MuCSCTFAlignmentRcd ( const L1MuCSCTFAlignmentRcd iRecord)

Definition at line 37 of file CSCTFConfigProducer.cc.

Referenced by CSCTFConfigProducer().

37  {
38  edm::LogInfo( "L1-O2O: CSCTFConfigProducer" ) << "Producing "
39  << " L1MuCSCTFAlignment from PSET";
40 
41 
42  std::unique_ptr<L1MuCSCTFAlignment> al = std::unique_ptr<L1MuCSCTFAlignment>( new L1MuCSCTFAlignment(alignment) );
43  return al;
44 }
std::unique_ptr< L1MuCSCTFConfiguration > CSCTFConfigProducer::produceL1MuCSCTFConfigurationRcd ( const L1MuCSCTFConfigurationRcd iRecord)

Definition at line 28 of file CSCTFConfigProducer.cc.

References looper::config, and registers.

Referenced by CSCTFConfigProducer().

28  {
29 
30  edm::LogInfo( "L1-O2O: CSCTFConfigProducer" ) << "Producing "
31  << " L1MuCSCTFConfiguration from PSET";
32 
33  std::unique_ptr<L1MuCSCTFConfiguration> config = std::unique_ptr<L1MuCSCTFConfiguration>( new L1MuCSCTFConfiguration(registers) );
34  return config;
35 }
std::string registers[12]
Definition: config.py:1
config
Definition: looper.py:291
void CSCTFConfigProducer::readLUT ( std::string  path,
unsigned short *  lut,
unsigned long  length 
)

Definition at line 64 of file CSCTFConfigProducer.cc.

References Exception, FrontierConditions_GlobalTag_cff::file, and LogDebug.

Referenced by produceL1MuCSCPtLutRcd().

64  {
65  // Reading
66  if( path.find(".bin") != std::string::npos ) { // Binary format
67  std::ifstream file(path.c_str(), std::ios::binary);
68  file.read((char*)lut,length*sizeof(unsigned short));
69  if( file.fail() )
70  throw cms::Exception("Reading error")<<"CSCTFConfigProducer cannot read "<<length<<" words from "<<path<<" (errno="<<errno<<")"<<std::endl;
71  if( (unsigned int)file.gcount() != length*sizeof(unsigned short) )
72  throw cms::Exception("Incorrect LUT size")<<"CSCTFConfigProducer read "<<(file.gcount()/sizeof(unsigned short))<<" words from "<<path<<" instead of "<<length<<" (errno="<<errno<<")"<<std::endl;
73  file.close();
74  } else {
75  std::ifstream file(path.c_str());
76  if( file.fail() )
77  throw cms::Exception("Cannot open file")<<"CSCTFConfigProducer cannot open "<<path<<" (errno="<<errno<<")"<<std::endl;
78  unsigned int address=0;
79  for(address=0; !file.eof() && address<length; address++)
80  file >> lut[address]; // Warning: this may throw non-cms like exception
81  if( address!=length ) throw cms::Exception("Incorrect LUT size")<<"CSCTFConfigProducer read "<<address<<" words from "<<path<<" instead of "<<length<<std::endl;
82  file.close();
83  }
84  LogDebug("CSCTFConfigProducer::readLUT")<<" read from "<<path<<" "<<length<<" words"<<std::endl;
85 }
#define LogDebug(id)

Member Data Documentation

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

Definition at line 22 of file CSCTFConfigProducer.h.

std::string CSCTFConfigProducer::ptLUT_path
private

Definition at line 23 of file CSCTFConfigProducer.h.

Referenced by CSCTFConfigProducer(), and produceL1MuCSCPtLutRcd().

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

Definition at line 21 of file CSCTFConfigProducer.h.

Referenced by CSCTFConfigProducer(), and produceL1MuCSCTFConfigurationRcd().