CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

LTCDigi Class Reference

#include <LTCDigi.h>

List of all members.

Public Member Functions

uint64_t bstGpsTime () const
unsigned int bunchNumber () const
unsigned int bxMask () const
unsigned char cyclicTriggerMask () const
int daqPartition () const
unsigned int eventID () const
unsigned int eventNumber () const
unsigned char externTriggerMask () const
bool HasTriggered (int i) const
 LTCDigi (const unsigned char *data)
 LTCDigi ()
uint32_t orbitNumber () const
unsigned int ramTrigger () const
unsigned int runNumber () const
int sourceID () const
uint32_t triggerInhibitNumber () const
uint32_t triggerInputStatus () const
int version () const
unsigned int vmeTrigger () const

Static Public Member Functions

static uint32_t GetEventNumberFromBuffer (const unsigned char *databuffer)
static uint32_t GetRunNumberFromBuffer (const unsigned char *databuffer)
static std::string locTime (uint64_t t)
static std::string utcTime (uint64_t t)

Private Attributes

uint64_t bstGpsTime_
unsigned int bunchNumber_
int daqPartition_
unsigned int eventID_
uint32_t eventNumber_
uint32_t orbitNumber_
unsigned int runNumber_
unsigned int sourceID_
uint32_t trigInhibitNumber_
uint32_t trigInputStat_
unsigned int trigType_
int versionNumber_

Detailed Description

Data from the Local Trigger Controller (LTC)

Id:
LTCDigi.h,v 1.4 2006/06/29 19:13:04 wittich Exp

Definition at line 17 of file LTCDigi.h.


Constructor & Destructor Documentation

LTCDigi::LTCDigi ( ) [inline]

Definition at line 21 of file LTCDigi.h.

{}
LTCDigi::LTCDigi ( const unsigned char *  data)

Definition at line 5 of file LTCDigi.cc.

References bstGpsTime_, bunchNumber_, daqPartition_, eventID_, eventNumber_, orbitNumber_, runNumber_, sourceID_, trigInhibitNumber_, trigInputStat_, trigType_, and versionNumber_.

{
  // six 64 bit words
  uint64_t *ld = (uint64_t*)data;

  trigType_   = (ld[0]>>56)&        0xFULL; // 4 bits

  eventID_     = (ld[0]>>32)&0x00FFFFFFULL; // 24 bits
  runNumber_   = (ld[2]>>32)&0xFFFFFFFFULL; // 32 bits
  eventNumber_ = (ld[2])    &0xFFFFFFFFULL; // 32 bits
  
  sourceID_      = (ld[0]>> 8)&0x00000FFFULL; // 12 bits
  // this should always be 815?
  //assert(sourceID_ == 815);

  bunchNumber_   = (ld[0]>>20)&     0xFFFULL; // 12 bits
  orbitNumber_   = (ld[1]>>32)&0xFFFFFFFFULL; // 32 bits

  versionNumber_ = (ld[1]>>24)&0xFFULL;       // 8 bits
  
  daqPartition_  = (ld[1]    )&0xFULL;        // 4 bits


  trigInputStat_ = (ld[3]    )&0xFFFFFFFFULL; // 32 bits

  trigInhibitNumber_ = (ld[3]>>32)&0xFFFFFFFFULL; // 32 bits

  bstGpsTime_    = ld[4]; // 64 bits

}

Member Function Documentation

uint64_t LTCDigi::bstGpsTime ( ) const [inline]

Definition at line 49 of file LTCDigi.h.

References bstGpsTime_.

Referenced by operator<<().

{ return bstGpsTime_;};
unsigned int LTCDigi::bunchNumber ( ) const [inline]

Definition at line 38 of file LTCDigi.h.

References bunchNumber_.

Referenced by operator<<().

{ return bunchNumber_;};
unsigned int LTCDigi::bxMask ( ) const [inline]

Definition at line 51 of file LTCDigi.h.

References triggerInputStatus().

{ return ((triggerInputStatus()>>28)&0x1); } ;
unsigned char LTCDigi::cyclicTriggerMask ( ) const [inline]

Definition at line 64 of file LTCDigi.h.

References triggerInputStatus().

  { 
    return (triggerInputStatus()&0x3FU); 
  } ;
int LTCDigi::daqPartition ( ) const [inline]

Definition at line 44 of file LTCDigi.h.

References daqPartition_.

Referenced by operator<<().

{ return daqPartition_; };
unsigned int LTCDigi::eventID ( ) const [inline]

Definition at line 35 of file LTCDigi.h.

References eventID_.

{ return eventID_; };
unsigned int LTCDigi::eventNumber ( ) const [inline]

Definition at line 34 of file LTCDigi.h.

References eventNumber_.

Referenced by GetEventNumberFromBuffer(), and operator<<().

{ return eventNumber_; };
unsigned char LTCDigi::externTriggerMask ( ) const [inline]

Definition at line 60 of file LTCDigi.h.

References triggerInputStatus().

Referenced by HasTriggered().

  { 
    return ((triggerInputStatus()>>20)&0x3FU); 
  } ;
uint32_t LTCDigi::GetEventNumberFromBuffer ( const unsigned char *  databuffer) [static]

Definition at line 36 of file LTCDigi.cc.

References eventNumber().

{
  // six 64 bit words
  uint64_t *ld = (uint64_t*)data;
  uint32_t eventNumber = (ld[2])    &0xFFFFFFFFULL; // 32 bits
  return eventNumber;
}
uint32_t LTCDigi::GetRunNumberFromBuffer ( const unsigned char *  databuffer) [static]

Definition at line 44 of file LTCDigi.cc.

References runNumber().

{
  // six 64 bit words
  uint64_t *ld = (uint64_t*)data;
  uint32_t runNumber   = (ld[2]>>32)&0xFFFFFFFFULL; // 32 bits
  return runNumber;
}
bool LTCDigi::HasTriggered ( int  i) const [inline]

Definition at line 71 of file LTCDigi.h.

References externTriggerMask().

Referenced by operator<<().

                                   {
    if ( i > 5 ) return false; // throw exception?
    return ((externTriggerMask()&(0x1U<<i))!=0);
  }
std::string LTCDigi::locTime ( uint64_t  t) [static]

Definition at line 110 of file LTCDigi.cc.

References a.

Referenced by operator<<().

{
  time_t tsmall = t/1000000;
  std::string a("LOC: ");
  a+= std::string(ctime(&tsmall));
  a.replace(a.find("\n"),a.size(), "");
  return a;
}
uint32_t LTCDigi::orbitNumber ( ) const [inline]

Definition at line 39 of file LTCDigi.h.

References orbitNumber_.

Referenced by operator<<().

{ return orbitNumber_;};
unsigned int LTCDigi::ramTrigger ( ) const [inline]

Definition at line 56 of file LTCDigi.h.

References triggerInputStatus().

Referenced by operator<<().

  { 
    return ((triggerInputStatus()>>26)&0x1); 
  } ;
unsigned int LTCDigi::runNumber ( ) const [inline]

Definition at line 36 of file LTCDigi.h.

References runNumber_.

Referenced by GetRunNumberFromBuffer(), and operator<<().

{ return runNumber_;   };
int LTCDigi::sourceID ( ) const [inline]

Definition at line 42 of file LTCDigi.h.

References sourceID_.

Referenced by operator<<().

{ return sourceID_; };
uint32_t LTCDigi::triggerInhibitNumber ( ) const [inline]

Definition at line 47 of file LTCDigi.h.

References trigInhibitNumber_.

Referenced by operator<<().

{ return trigInhibitNumber_; };
uint32_t LTCDigi::triggerInputStatus ( ) const [inline]

Definition at line 46 of file LTCDigi.h.

References trigInputStat_.

Referenced by bxMask(), cyclicTriggerMask(), externTriggerMask(), operator<<(), ramTrigger(), and vmeTrigger().

{ return trigInputStat_; };
std::string LTCDigi::utcTime ( uint64_t  t) [static]

Definition at line 99 of file LTCDigi.cc.

Referenced by operator<<().

{
  // note that gmtime isn't reentrant and we don't own the data
  time_t tsmall = t/1000000;
  tm *utct = gmtime(&tsmall);
  std::string tstr("UTC: ");
  tstr += asctime(utct);
  tstr.replace(tstr.find("\n"),tstr.size(), "");
  return tstr;
}
int LTCDigi::version ( ) const [inline]

Definition at line 41 of file LTCDigi.h.

References versionNumber_.

{ return versionNumber_; } ;
unsigned int LTCDigi::vmeTrigger ( ) const [inline]

Definition at line 52 of file LTCDigi.h.

References triggerInputStatus().

Referenced by operator<<().

  { 
    return ((triggerInputStatus()>>27)&0x1); 
  } ;

Member Data Documentation

uint64_t LTCDigi::bstGpsTime_ [private]

Definition at line 98 of file LTCDigi.h.

Referenced by bstGpsTime(), and LTCDigi().

unsigned int LTCDigi::bunchNumber_ [private]

Definition at line 87 of file LTCDigi.h.

Referenced by bunchNumber(), and LTCDigi().

int LTCDigi::daqPartition_ [private]

Definition at line 92 of file LTCDigi.h.

Referenced by daqPartition(), and LTCDigi().

unsigned int LTCDigi::eventID_ [private]

Definition at line 82 of file LTCDigi.h.

Referenced by eventID(), and LTCDigi().

uint32_t LTCDigi::eventNumber_ [private]

Definition at line 94 of file LTCDigi.h.

Referenced by eventNumber(), and LTCDigi().

uint32_t LTCDigi::orbitNumber_ [private]

Definition at line 88 of file LTCDigi.h.

Referenced by LTCDigi(), and orbitNumber().

unsigned int LTCDigi::runNumber_ [private]

Definition at line 83 of file LTCDigi.h.

Referenced by LTCDigi(), and runNumber().

unsigned int LTCDigi::sourceID_ [private]

Definition at line 85 of file LTCDigi.h.

Referenced by LTCDigi(), and sourceID().

uint32_t LTCDigi::trigInhibitNumber_ [private]

Definition at line 97 of file LTCDigi.h.

Referenced by LTCDigi(), and triggerInhibitNumber().

uint32_t LTCDigi::trigInputStat_ [private]

Definition at line 96 of file LTCDigi.h.

Referenced by LTCDigi(), and triggerInputStatus().

unsigned int LTCDigi::trigType_ [private]

Definition at line 80 of file LTCDigi.h.

Referenced by LTCDigi().

int LTCDigi::versionNumber_ [private]

Definition at line 90 of file LTCDigi.h.

Referenced by LTCDigi(), and version().