CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | 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)
 

Public Attributes

 COND_SERIALIZABLE
 

Private Attributes

unsigned short pt_lut [1<< 21]
 

Friends

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

Definition at line 20 of file L1MuCSCPtLut.h.

References pt_lut.

20  {
21  if( addr<(1<<21) ) return pt_lut[(unsigned int)addr];
22  else return 0;
23  }
unsigned short pt_lut[1<< 21]
Definition: L1MuCSCPtLut.h:13
void L1MuCSCPtLut::readFromDBS ( std::string &  ptLUT)

Definition at line 7 of file L1MuCSCPtLut.cc.

References edm::hlt::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

Friends And Related Function Documentation

friend class CSCTFConfigProducer
friend

Definition at line 14 of file L1MuCSCPtLut.h.

Member Data Documentation

L1MuCSCPtLut::COND_SERIALIZABLE

Definition at line 34 of file L1MuCSCPtLut.h.

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

Definition at line 13 of file L1MuCSCPtLut.h.

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