CMS 3D CMS Logo

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

#include <L1MuCSCPtLut.h>

Public Member Functions

 L1MuCSCPtLut (void)
 
 L1MuCSCPtLut (const L1MuCSCPtLut &lut)
 
const unsigned short * lut (void) const throw ()
 
L1MuCSCPtLutoperator= (const L1MuCSCPtLut &lut)
 
unsigned short pt (unsigned long addr) const throw ()
 
void readFromDBS (std::string &ptLUT)
 
 ~L1MuCSCPtLut (void)
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

unsigned short pt_lut [1<< 21]
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 
class CSCTFConfigProducer
 

Detailed Description

Definition at line 11 of file L1MuCSCPtLut.h.

Constructor & Destructor Documentation

◆ L1MuCSCPtLut() [1/2]

L1MuCSCPtLut::L1MuCSCPtLut ( void  )
inline

Definition at line 33 of file L1MuCSCPtLut.h.

References pt_lut.

33 { bzero(pt_lut, sizeof(pt_lut)); }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13

◆ L1MuCSCPtLut() [2/2]

L1MuCSCPtLut::L1MuCSCPtLut ( const L1MuCSCPtLut lut)
inline

Definition at line 34 of file L1MuCSCPtLut.h.

References lut(), and pt_lut.

34 { memcpy(pt_lut, lut.pt_lut, sizeof(pt_lut)); }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13
const unsigned short * lut(void) const
Definition: L1MuCSCPtLut.h:26

◆ ~L1MuCSCPtLut()

L1MuCSCPtLut::~L1MuCSCPtLut ( void  )
inline

Definition at line 35 of file L1MuCSCPtLut.h.

35 {}

Member Function Documentation

◆ lut()

const unsigned short* L1MuCSCPtLut::lut ( void  ) const
throw (
)
inline

Definition at line 26 of file L1MuCSCPtLut.h.

References pt_lut.

Referenced by CSCTFPtLUT::CSCTFPtLUT(), L1MuCSCPtLut(), and operator=().

26 { return pt_lut; }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13

◆ operator=()

L1MuCSCPtLut& L1MuCSCPtLut::operator= ( const L1MuCSCPtLut lut)
inline

Definition at line 28 of file L1MuCSCPtLut.h.

References lut(), and pt_lut.

28  {
29  memcpy(pt_lut, lut.pt_lut, sizeof(pt_lut));
30  return *this;
31  }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13
const unsigned short * lut(void) const
Definition: L1MuCSCPtLut.h:26

◆ pt()

unsigned short L1MuCSCPtLut::pt ( unsigned long  addr) const
throw (
)
inline

◆ readFromDBS()

void L1MuCSCPtLut::readFromDBS ( std::string &  ptLUT)

Definition at line 7 of file L1MuCSCPtLut.cc.

References make_classfiles::buff, Exception, geometryDiff::file, pt_lut, and Phase2L1GMT::ptLUT.

7  {
8  //edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) <<" Reading from DBS";
9 
10  // the ptLUT returned by the OMDS query will have a structure like number"\n"number"\n"
11  // e.g., 32896\n32896\n32896\n32896\n and so on
12  // remove the \n separator to write the pt_lut[1<<21] line-by-line
13  for (size_t pos = ptLUT.find("\\n"); pos != std::string::npos; pos = ptLUT.find("\\n", pos)) {
14  ptLUT[pos] = ' ';
15  ptLUT[pos + 1] = '\n';
16  }
17 
18  unsigned long length = 1 << 21; //length of the ptLUT file
19 
20  std::stringstream file(ptLUT);
21  if (file.fail())
22  throw cms::Exception("Cannot open the ptLUT") << "L1MuCSCPtLut cannot open "
23  << "ptLUT from DBS (errno=" << errno << ")" << std::endl;
24 
25  // filling the ptLUT
26  unsigned int address = 0;
27  for (address = 0; !file.eof() && address < length; address++) {
28  char buff[1024];
29  file.getline(buff, 1024);
30  int ptOutput = atoi(buff);
31 
32  // uncomment if you want to see line-by-line
33  //edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) << "writing line "
34  // << ptOutput;
35 
36  // Warning: this may throw non-cms like exception
37  pt_lut[address] = ptOutput;
38  }
39 
40  if (address != length)
41  throw cms::Exception("Incorrect LUT size")
42  << "L1MuCSCPtLut read " << address << " words from DBS instead of expected " << length << std::endl;
43 }
const ap_uint< BITSPT > ptLUT[2251]
Definition: TPSLUTs.h:18
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13
buff
***.cc ################

◆ serialize()

template<class Archive >
void L1MuCSCPtLut::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 37 of file L1MuCSCPtLut.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 37 of file L1MuCSCPtLut.h.

◆ CSCTFConfigProducer

friend class CSCTFConfigProducer
friend

Definition at line 14 of file L1MuCSCPtLut.h.

Member Data Documentation

◆ pt_lut

unsigned short L1MuCSCPtLut::pt_lut[1<< 21]
private

Definition at line 13 of file L1MuCSCPtLut.h.

Referenced by L1MuCSCPtLut(), lut(), operator=(), pt(), and readFromDBS().