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

cms_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 ()
cms_uint32_t orbitNumber () const
unsigned int ramTrigger () const
unsigned int runNumber () const
int sourceID () const
cms_uint32_t triggerInhibitNumber () const
cms_uint32_t triggerInputStatus () const
int version () const
unsigned int vmeTrigger () const

Static Public Member Functions

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

Private Attributes

cms_uint64_t bstGpsTime_
unsigned int bunchNumber_
int daqPartition_
unsigned int eventID_
cms_uint32_t eventNumber_
cms_uint32_t orbitNumber_
unsigned int runNumber_
unsigned int sourceID_
cms_uint32_t trigInhibitNumber_
cms_uint32_t trigInputStat_
unsigned int trigType_
int versionNumber_

Detailed Description

Data from the Local Trigger Controller (LTC)

Id:
LTCDigi.h,v 1.5 2011/08/25 20:18:06 wmtan 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
  cms_uint64_t *ld = (cms_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

cms_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); 
  } ;
cms_uint32_t LTCDigi::GetEventNumberFromBuffer ( const unsigned char *  databuffer) [static]

Definition at line 36 of file LTCDigi.cc.

References eventNumber().

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

Definition at line 44 of file LTCDigi.cc.

References runNumber().

{
  // six 64 bit words
  cms_uint64_t *ld = (cms_uint64_t*)data;
  cms_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 ( cms_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;
}
cms_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_; };
cms_uint32_t LTCDigi::triggerInhibitNumber ( ) const [inline]

Definition at line 47 of file LTCDigi.h.

References trigInhibitNumber_.

Referenced by operator<<().

{ return trigInhibitNumber_; };
cms_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 ( cms_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

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().

Definition at line 94 of file LTCDigi.h.

Referenced by eventNumber(), and LTCDigi().

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().

Definition at line 97 of file LTCDigi.h.

Referenced by LTCDigi(), and triggerInhibitNumber().

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().