CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr< L1MuCSCPtLutproduceL1MuCSCPtLutRcd (const L1MuCSCPtLutRcd &iRecord)
 
std::auto_ptr< L1MuCSCTFAlignmentproduceL1MuCSCTFAlignmentRcd (const L1MuCSCTFAlignmentRcd &iRecord)
 
std::auto_ptr
< L1MuCSCTFConfiguration
produceL1MuCSCTFConfigurationRcd (const L1MuCSCTFConfigurationRcd &iRecord)
 
void readLUT (std::string path, unsigned short *lut, unsigned long length)
 
 ~CSCTFConfigProducer (void)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- 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 ()
 

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, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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 alignment, edm::ParameterSet::getParameter(), geometryCSVtoXML::line, mergeVDriftHistosByStation::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
std::string registers[12]
std::auto_ptr< L1MuCSCTFConfiguration > produceL1MuCSCTFConfigurationRcd(const L1MuCSCTFConfigurationRcd &iRecord)
std::auto_ptr< L1MuCSCPtLut > produceL1MuCSCPtLutRcd(const L1MuCSCPtLutRcd &iRecord)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::vector< double > alignment
std::auto_ptr< L1MuCSCTFAlignment > produceL1MuCSCTFAlignmentRcd(const L1MuCSCTFAlignmentRcd &iRecord)
CSCTFConfigProducer::~CSCTFConfigProducer ( void  )
inline

Definition at line 32 of file CSCTFConfigProducer.h.

32 {}

Member Function Documentation

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

Definition at line 46 of file CSCTFConfigProducer.cc.

References edm::hlt::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::auto_ptr<L1MuCSCPtLut> pt_lut = std::auto_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::auto_ptr< L1MuCSCTFAlignment > CSCTFConfigProducer::produceL1MuCSCTFAlignmentRcd ( const L1MuCSCTFAlignmentRcd iRecord)

Definition at line 37 of file CSCTFConfigProducer.cc.

References alignment.

Referenced by CSCTFConfigProducer().

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

Definition at line 28 of file CSCTFConfigProducer.cc.

References HDQMDatabaseProducer::config, and registers.

Referenced by CSCTFConfigProducer().

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

Definition at line 64 of file CSCTFConfigProducer.cc.

References edm::hlt::Exception, mergeVDriftHistosByStation::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)
tuple path
else: Piece not in the list, fine.
tuple lut
Definition: lumiPlot.py:244

Member Data Documentation

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

Definition at line 22 of file CSCTFConfigProducer.h.

Referenced by CSCTFConfigProducer(), and produceL1MuCSCTFAlignmentRcd().

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