CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

L1MuCSCPtLut Class Reference

#include <L1MuCSCPtLut.h>

List of all members.

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 Attributes

unsigned short pt_lut [1<< 21]

Friends

class CSCTFConfigProducer

Detailed Description

Definition at line 9 of file L1MuCSCPtLut.h.


Constructor & Destructor Documentation

L1MuCSCPtLut::L1MuCSCPtLut ( void  ) [inline]

Definition at line 27 of file L1MuCSCPtLut.h.

References pt_lut.

{ bzero(pt_lut,sizeof(pt_lut)); }
L1MuCSCPtLut::L1MuCSCPtLut ( const L1MuCSCPtLut lut) [inline]

Definition at line 28 of file L1MuCSCPtLut.h.

References pt_lut.

{ memcpy(pt_lut,lut.pt_lut,sizeof(pt_lut)); }
L1MuCSCPtLut::~L1MuCSCPtLut ( void  ) [inline]

Definition at line 29 of file L1MuCSCPtLut.h.

{}

Member Function Documentation

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

Definition at line 23 of file L1MuCSCPtLut.h.

References pt_lut.

{ return pt_lut; }
L1MuCSCPtLut& L1MuCSCPtLut::operator= ( const L1MuCSCPtLut lut) [inline]

Definition at line 25 of file L1MuCSCPtLut.h.

References pt_lut.

{ memcpy(pt_lut,lut.pt_lut,sizeof(pt_lut)); return *this; }
unsigned short L1MuCSCPtLut::pt ( unsigned long  addr) const throw () [inline]

Definition at line 18 of file L1MuCSCPtLut.h.

References pt_lut.

Referenced by CSCTFPtLUT::Pt().

                                                            {
          if( addr<(1<<21) ) return pt_lut[(unsigned int)addr];
                else return 0;
        }
void L1MuCSCPtLut::readFromDBS ( std::string &  ptLUT)

Definition at line 7 of file L1MuCSCPtLut.cc.

References Exception, mergeVDriftHistosByStation::file, pos, and pt_lut.

Referenced by L1MuCSCPtLutConfigOnlineProd::newObject().

{

  //edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) <<" Reading from DBS";

  // the ptLUT returned by the OMDS query will have a structure like number"\n"number"\n"
  // e.g., 32896\n32896\n32896\n32896\n and so on
  // remove the \n separator to write the pt_lut[1<<21] line-by-line
  for(size_t pos=ptLUT.find("\\n"); pos!=std::string::npos; pos=ptLUT.find("\\n",pos)){ 
    ptLUT[pos]=' '; 
    ptLUT[pos+1]='\n'; 
  }
  
  unsigned long length = 1<<21; //length of the ptLUT file

  std::stringstream file(ptLUT);
  if( file.fail() )
    throw cms::Exception("Cannot open the ptLUT")<<"L1MuCSCPtLut cannot open "
                                                 <<"ptLUT from DBS (errno="
                                                 <<errno<<")"<<std::endl;
  
  // filling the ptLUT
  unsigned int address=0;
  for(address=0; !file.eof() && address<length; address++) {
    char buff[1024];
    file.getline(buff,1024);
    int ptOutput = atoi(buff);

    // uncomment if you want to see line-by-line
    //edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) << "writing line " 
    //                                 << ptOutput;

    // Warning: this may throw non-cms like exception
    pt_lut[address] = ptOutput; 
  }
  
  if( address!=length ) 
    throw cms::Exception("Incorrect LUT size")<<"L1MuCSCPtLut read "<<address
                                              <<" words from DBS instead of expected "
                                              <<length <<std::endl;
}

Friends And Related Function Documentation

friend class CSCTFConfigProducer [friend]

Definition at line 12 of file L1MuCSCPtLut.h.


Member Data Documentation

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

Definition at line 11 of file L1MuCSCPtLut.h.

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