test
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 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::L1MuCSCPtLut ( void  )
inline

Definition at line 29 of file L1MuCSCPtLut.h.

References pt_lut.

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

Definition at line 30 of file L1MuCSCPtLut.h.

References pt_lut.

30 { memcpy(pt_lut,lut.pt_lut,sizeof(pt_lut)); }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13
L1MuCSCPtLut::~L1MuCSCPtLut ( void  )
inline

Definition at line 31 of file L1MuCSCPtLut.h.

31 {}

Member Function Documentation

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

Definition at line 25 of file L1MuCSCPtLut.h.

References pt_lut.

Referenced by CSCTFPtLUT::CSCTFPtLUT().

25 { return pt_lut; }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13
L1MuCSCPtLut& L1MuCSCPtLut::operator= ( const L1MuCSCPtLut lut)
inline

Definition at line 27 of file L1MuCSCPtLut.h.

References pt_lut.

27 { memcpy(pt_lut,lut.pt_lut,sizeof(pt_lut)); return *this; }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13
unsigned short L1MuCSCPtLut::pt ( unsigned long  addr) const
throw (
)
inline
void L1MuCSCPtLut::readFromDBS ( std::string &  ptLUT)

Definition at line 7 of file L1MuCSCPtLut.cc.

References Exception, mergeVDriftHistosByStation::file, and pt_lut.

Referenced by L1MuCSCPtLutConfigOnlineProd::newObject().

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 34 of file L1MuCSCPtLut.h.

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

Definition at line 34 of file L1MuCSCPtLut.h.

friend class CSCTFConfigProducer
friend

Definition at line 14 of file L1MuCSCPtLut.h.

Member Data Documentation

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

Definition at line 13 of file L1MuCSCPtLut.h.

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