CMS 3D CMS Logo

Public Member Functions | Private Attributes

evf::EvffedFillerRB Class Reference

#include <EvffedFillerRB.h>

List of all members.

Public Member Functions

 EvffedFillerRB (FUResourceBroker *rb)
unsigned int fedId () const
unsigned char *const getPayload ()
uint32_t getSize ()
void putHeader (unsigned int l1id, unsigned int bxid)
void putTrailer ()
void setEPProcessId (pid_t pid)
void setRBEventCount (uint32_t evtcnt)
void setRBTimeStamp (uint64_t ts)
unsigned int size () const

Private Attributes

unsigned int hostid_
unsigned char payload_ [fedinterface::EVFFED_TOTALSIZE]

Detailed Description

Definition at line 30 of file EvffedFillerRB.h.


Constructor & Destructor Documentation

evf::EvffedFillerRB::EvffedFillerRB ( FUResourceBroker rb) [inline]

Definition at line 33 of file EvffedFillerRB.h.

References evf::fedinterface::EVFFED_LENGTH, evf::fedinterface::EVFFED_RBIDENT_OFFSET, evf::fedinterface::EVFFED_RBINSTA_MASK, evf::fedinterface::EVFFED_RBINSTA_SHIFT, evf::fedinterface::EVFFED_RBPCIDE_MASK, evf::fedinterface::EVFFED_RBPCIDE_SHIFT, hostid_, i, evf::FUResourceBroker::instanceNumber(), evf::evtn::offset(), L1TEmulatorMonitor_cff::p, payload_, and SLINK_WORD_SIZE.

                                        {
      for(unsigned int i = 0; i < fedinterface::EVFFED_LENGTH; i++){
        unsigned int offset = i * evtn::SLINK_WORD_SIZE;
        *(uint64_t*)(payload_ + offset ) = 0;
      }
      char hostname[32];
      int retval = gethostname(hostname, 32);
      if(retval != 0){
        hostid_ = 0xdead;
      }
      else{
        if(strtok(hostname,"-") == 0) hostid_ = 0xdead;
        char *p = strtok(0,"-"); // rack id
        long hostid = 0xdead;
        if(p!=0) hostid = strtol(p,0,16) << 8;
        p = strtok(0,"-"); // node id
        if(p==0) hostid += 0xdead;
        else hostid += strtol(p,0,16);
        hostid_ = hostid;
      }
      *(uint32_t*)(payload_+fedinterface::EVFFED_RBIDENT_OFFSET) = 
        ((hostid_ & fedinterface::EVFFED_RBPCIDE_MASK) << fedinterface::EVFFED_RBPCIDE_SHIFT) +
        ((rb->instanceNumber() & fedinterface::EVFFED_RBINSTA_MASK) <<  fedinterface::EVFFED_RBINSTA_SHIFT);
    }

Member Function Documentation

unsigned int evf::EvffedFillerRB::fedId ( ) const [inline]

Definition at line 86 of file EvffedFillerRB.h.

References evf::fedinterface::EVFFED_ID.

Referenced by evf::FUResource::process().

unsigned char* const evf::EvffedFillerRB::getPayload ( ) [inline]

Definition at line 57 of file EvffedFillerRB.h.

References payload_.

Referenced by evf::FUResource::process().

{return payload_;}
uint32_t evf::EvffedFillerRB::getSize ( ) [inline]
void evf::EvffedFillerRB::putHeader ( unsigned int  l1id,
unsigned int  bxid 
) [inline]
void evf::EvffedFillerRB::putTrailer ( ) [inline]
void evf::EvffedFillerRB::setEPProcessId ( pid_t  pid) [inline]
void evf::EvffedFillerRB::setRBEventCount ( uint32_t  evtcnt) [inline]

Definition at line 78 of file EvffedFillerRB.h.

References evf::fedinterface::EVFFED_RBEVCNT_OFFSET, and payload_.

                                         {
      *(uint32_t*) (payload_ + fedinterface::EVFFED_RBEVCNT_OFFSET) = evtcnt;
    }
void evf::EvffedFillerRB::setRBTimeStamp ( uint64_t  ts) [inline]
unsigned int evf::EvffedFillerRB::size ( void  ) const [inline]

Member Data Documentation

unsigned int evf::EvffedFillerRB::hostid_ [private]

Definition at line 90 of file EvffedFillerRB.h.

Referenced by EvffedFillerRB().