CMS 3D CMS Logo

Public Member Functions | Private Attributes

EventMsgView Class Reference

#include <EventMessage.h>

List of all members.

Public Member Functions

uint32 adler32_chksum () const
uint32 code () const
uint32 droppedEventsCount () const
uint32 event () const
const uint8eventData () const
uint32 eventLength () const
 EventMsgView (void *buf)
uint32 headerSize () const
uint32 hltCount () const
void hltTriggerBits (uint8 *put_here) const
std::string hostName () const
uint32 hostName_len () const
uint32 l1Count () const
void l1TriggerBits (std::vector< bool > &put_here) const
uint32 lumi () const
uint32 origDataSize () const
uint32 outModId () const
uint32 protocolVersion () const
uint32 run () const
uint32 size () const
uint8startAddress () const

Private Attributes

uint32 adler32_chksum_
uint8buf_
uint32 event_len_
uint8event_start_
HeaderView head_
uint32 hlt_bits_count_
uint8hlt_bits_start_
uint32 host_name_len_
uint8host_name_start_
uint32 l1_bits_count_
uint8l1_bits_start_
bool v2Detected_

Detailed Description

Definition at line 69 of file EventMessage.h.


Constructor & Destructor Documentation

EventMsgView::EventMsgView ( void *  buf)

Definition at line 5 of file EventMessage.cc.

References adler32_chksum_, buf_, convert32(), event_len_, event_start_, Exception, hlt_bits_count_, hlt_bits_start_, host_name_len_, host_name_start_, l1_bits_count_, l1_bits_start_, protocolVersion(), and v2Detected_.

                                   :
  buf_((uint8*)buf),head_(buf),
  v2Detected_(false)
{ 
  // 29-Jan-2008, KAB - adding an explicit version number.
  // We'll start with 5 to match the new version of the INIT message.
  // We support earlier versions of the full protocol, of course, but since
  // we didn't have an explicit version number in the Event Message before
  // now, we have to limit what we can handle to versions that have the
  // version number included (>= 5).

  // 18-Jul-2008, wmtan - payload changed for version 7.
  // So we no longer support previous formats.
  if (protocolVersion() != 9) {
    throw cms::Exception("EventMsgView", "Invalid Message Version:")
      << "Only message version 9 is currently supported \n"
      << "(invalid value = " << protocolVersion() << ").\n"
      << "We support only reading and converting streamer files\n"
      << "using the same version of CMSSW used to created the\n"
      << "streamer file. This is because the streamer format is\n"
      << "only a temporary format, as such we do not support\n"
      << "backwards compatibility. If you really need a streamer\n"
      << "file for some reason, the work around is that you convert\n"
      << "the streamer file to a Root file using the CMSSW version\n"
      << "that created the streamer file, then convert the Root file\n"
      << "to a streamer file using a newer release that will produce\n"
      << "the version of streamer file that you desire.\n";
  }

  uint8* l1_bit_size_ptr = buf_ + sizeof(EventHeader); //Just after Header 
  l1_bits_count_ = convert32(l1_bit_size_ptr); 
  uint32 l1_sz = l1_bits_count_;
// No point! Not supporting older versions and causes problems in unit
// tests that uses l1_bits_count_ == 11, and could cause problems later if using 11
  //Lets detect if thats V2 message 
  //if (l1_bits_count_ == 11) {
  //        l1_sz = 1; 
  //        v2Detected_=true;
  //}

  l1_bits_start_ = buf_ + sizeof(EventHeader) + sizeof(uint32); 

  if (v2Detected_ == false) { 
     if (l1_sz != 0) l1_sz = 1 + ((l1_sz-1)/8);
  }
  uint8* hlt_bit_size_ptr = l1_bits_start_ + l1_sz; 
  hlt_bits_count_ = convert32(hlt_bit_size_ptr); 
  hlt_bits_start_ = hlt_bit_size_ptr + sizeof(uint32); 
  uint32 hlt_sz = hlt_bits_count_;
  if (hlt_sz != 0) hlt_sz = 1+ ((hlt_sz-1)/4);

  if(v2Detected_) hlt_sz=2;
  uint8* adler32_start = hlt_bits_start_ + hlt_sz; 
  adler32_chksum_ = convert32(adler32_start);
  host_name_start_ = adler32_start + sizeof(uint32);
  host_name_len_ = *host_name_start_;
  host_name_start_ += sizeof(uint8);
  event_start_ = host_name_start_ + host_name_len_;
  event_len_ = convert32(event_start_); 
  event_start_ += sizeof(char_uint32); 
}

Member Function Documentation

uint32 EventMsgView::adler32_chksum ( ) const [inline]

Definition at line 95 of file EventMessage.h.

References adler32_chksum_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

{return adler32_chksum_;}
uint32 EventMsgView::code ( ) const [inline]

Definition at line 75 of file EventMessage.h.

References HeaderView::code(), and head_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

{ return head_.code(); }
uint32 EventMsgView::droppedEventsCount ( ) const
uint32 EventMsgView::event ( ) const
const uint8* EventMsgView::eventData ( ) const [inline]

Definition at line 78 of file EventMessage.h.

References event_start_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and StreamerOutputFile::write().

{ return event_start_; }
uint32 EventMsgView::eventLength ( ) const [inline]

Definition at line 80 of file EventMessage.h.

References event_len_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

{ return event_len_; }
uint32 EventMsgView::headerSize ( ) const [inline]
uint32 EventMsgView::hltCount ( ) const [inline]

Definition at line 93 of file EventMessage.h.

References hlt_bits_count_.

Referenced by dumpEventHeader().

{return hlt_bits_count_;}
void EventMsgView::hltTriggerBits ( uint8 put_here) const

Definition at line 119 of file EventMessage.cc.

References filterCSVwithJSON::copy, hlt_bits_count_, hlt_bits_start_, and v2Detected_.

Referenced by edm::FUShmOutputModule::countEventForDatasets(), edm::StreamerFileWriter::doOutputEvent(), and dumpEventHeader().

{
  uint32 hlt_sz = hlt_bits_count_;
  if (hlt_sz != 0) hlt_sz = 1 + ((hlt_sz-1)/4);

  if(v2Detected_) hlt_sz=2;

  std::copy(hlt_bits_start_,hlt_bits_start_ + hlt_sz,
            put_here);
}
std::string EventMsgView::hostName ( ) const

Definition at line 130 of file EventMessage.cc.

References newFWLiteAna::found, host_name_len_, host_name_start_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

{
   //return std::string(reinterpret_cast<char *>(host_name_start_),host_name_len_);
   std::string host_name(reinterpret_cast<char *>(host_name_start_),host_name_len_);
   size_t found = host_name.find('\0');
   if(found != std::string::npos) {
     return std::string(host_name, 0, found);
   } else {
     return host_name;
   }
}
uint32 EventMsgView::hostName_len ( ) const [inline]

Definition at line 97 of file EventMessage.h.

References host_name_len_.

{return host_name_len_;}
uint32 EventMsgView::l1Count ( ) const [inline]

Definition at line 94 of file EventMessage.h.

References l1_bits_count_.

{return l1_bits_count_;}
void EventMsgView::l1TriggerBits ( std::vector< bool > &  put_here) const

Definition at line 110 of file EventMessage.cc.

References i, l1_bits_count_, and l1_bits_start_.

Referenced by dumpEventHeader().

{
  put_here.clear();
  put_here.resize(l1_bits_count_);

  for(std::vector<bool>::size_type i = 0; i < l1_bits_count_; ++i)
    put_here[i] = (bool)(l1_bits_start_[i/8] & (1<<((i&0x07))));
}
uint32 EventMsgView::lumi ( ) const
uint32 EventMsgView::origDataSize ( ) const
uint32 EventMsgView::outModId ( ) const

Definition at line 97 of file EventMessage.cc.

References buf_, convert32(), h, and EventHeader::outModId_.

Referenced by dumpEventHeader().

uint32 EventMsgView::protocolVersion ( ) const

Definition at line 67 of file EventMessage.cc.

References buf_, h, and EventHeader::protocolVersion_.

Referenced by dumpEventHeader(), and EventMsgView().

uint32 EventMsgView::run ( void  ) const
uint32 EventMsgView::size ( void  ) const [inline]
uint8* EventMsgView::startAddress ( ) const [inline]

Definition at line 79 of file EventMessage.h.

References buf_.

Referenced by smproxy::EventMsg::EventMsg(), and StreamerOutputFile::writeEventHeader().

{ return buf_; }

Member Data Documentation

Definition at line 109 of file EventMessage.h.

Referenced by adler32_chksum(), and EventMsgView().

Definition at line 108 of file EventMessage.h.

Referenced by eventLength(), and EventMsgView().

Definition at line 107 of file EventMessage.h.

Referenced by eventData(), EventMsgView(), and headerSize().

Definition at line 101 of file EventMessage.h.

Referenced by code(), and size().

Definition at line 104 of file EventMessage.h.

Referenced by EventMsgView(), hltCount(), and hltTriggerBits().

Definition at line 103 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().

Definition at line 111 of file EventMessage.h.

Referenced by EventMsgView(), hostName(), and hostName_len().

Definition at line 110 of file EventMessage.h.

Referenced by EventMsgView(), and hostName().

Definition at line 106 of file EventMessage.h.

Referenced by EventMsgView(), l1Count(), and l1TriggerBits().

Definition at line 105 of file EventMessage.h.

Referenced by EventMsgView(), and l1TriggerBits().

bool EventMsgView::v2Detected_ [private]

Definition at line 112 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().