Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:19

0001 /** Init Message
0002 
0003 Protocol Versoion 2:
0004 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Seize 4| releaseTagLength 1 | ReleaseTag var| HLT count 4| HLT Trig Legth 4 | HLT Trig names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var |desc legth 4 | description blob var
0005 
0006 Protocol Version 3:
0007 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Size 4| releaseTagLength 1 | ReleaseTag var| HLT count 4| HLT Trig Legth 4 | HLT Trig names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var |desc legth 4 | description blob var
0008 
0009 Protocol Version 4:
0010 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Size 4| releaseTagLength 1 | ReleaseTag var| processNameLength 1 | processName var | HLT count 4| HLT Trig Legth 4 | HLT Trig names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var |desc legth 4 | description blob var
0011 
0012 Protocol Version 5:
0013 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Size 4| releaseTagLength 1 | ReleaseTag var| processNameLength 1 | processName var| outputModuleLabelLength 1 | outputModuleLabel var | HLT Trig count 4| HLT Trig Length 4 | HLT Trig names var | HLT Selection count 4| HLT Selection Length 4 | HLT Selection names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var |desc legth 4 | description blob var
0014 
0015 Protocol Version 6:
0016 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Size 4| releaseTagLength 1 | ReleaseTag var| processNameLength 1 | processName var| outputModuleLabelLength 1 | outputModuleLabel var | outputModuleId 4 | HLT Trig count 4| HLT Trig Length 4 | HLT Trig names var | HLT Selection count 4| HLT Selection Length 4 | HLT Selection names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var |desc legth 4 | description blob var
0017   
0018 Protocol Version 7: No change to protocol, only description blob (and event data blob) changed
0019 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Size 4| releaseTagLength 1 | ReleaseTag var| processNameLength 1 | processName var| outputModuleLabelLength 1 | outputModuleLabel var | outputModuleId 4 | HLT Trig count 4| HLT Trig Length 4 | HLT Trig names var | HLT Selection count 4| HLT Selection Length 4 | HLT Selection names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var |desc legth 4 | description blob var
0020 
0021 Protocol Version 8: added data blob checksum and hostname
0022 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Size 4| releaseTagLength 1 | ReleaseTag var| processNameLength 1 | processName var| outputModuleLabelLength 1 | outputModuleLabel var | outputModuleId 4 | HLT Trig count 4| HLT Trig Length 4 | HLT Trig names var | HLT Selection count 4| HLT Selection Length 4 | HLT Selection names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var | adler32 chksum 4| host name length 4| host name var|desc legth 4 | description blob var
0023 
0024 Protocol Version 9: identical to version 8, but incremented to keep in sync with event msg protocol version 
0025 
0026 Protocol Version 10: removed hostname
0027 code 1 | size 4 | protocol version 1 | pset 16 | run 4 | Init Header Size 4| Event Header Size 4| releaseTagLength 1 | ReleaseTag var| processNameLength 1 | processName var| outputModuleLabelLength 1 | outputModuleLabel var | outputModuleId 4 | HLT Trig count 4| HLT Trig Length 4 | HLT Trig names var | HLT Selection count 4| HLT Selection Length 4 | HLT Selection names var | L1 Trig Count 4| L1 TrigName len 4| L1 Trig Names var | adler32 chksum 4| desc legth 4 | description blob var
0028 
0029 Protocol Version 11: identical to version 10, but incremented to keep in sync with event msg protocol version
0030 
0031 */
0032 
0033 #ifndef IOPool_Streamer_InitMessage_h
0034 #define IOPool_Streamer_InitMessage_h
0035 
0036 #include "IOPool/Streamer/interface/MsgTools.h"
0037 #include "IOPool/Streamer/interface/MsgHeader.h"
0038 
0039 struct Version {
0040   Version(const uint8* pset) : protocol_(11) { std::copy(pset, pset + sizeof(pset_id_), &pset_id_[0]); }
0041 
0042   uint8 protocol_;             // version of the protocol
0043   unsigned char pset_id_[16];  // parameter set ID
0044 };
0045 
0046 struct InitHeader {
0047   InitHeader(const Header& h, uint32 run, const Version& v, uint32 init_header_size = 0, uint32 event_header_size = 0)
0048       : header_(h), version_(v) {
0049     convert(run, run_);
0050     convert(init_header_size, init_header_size_);
0051     convert(event_header_size, event_header_size_);
0052   }
0053 
0054   Header header_;
0055   Version version_;
0056   char_uint32 run_;
0057   char_uint32 init_header_size_;
0058   char_uint32 event_header_size_;
0059 };
0060 
0061 class InitMsgView {
0062 public:
0063   InitMsgView(void* buf);
0064 
0065   uint32 code() const { return head_.code(); }
0066   uint32 size() const { return head_.size(); }
0067   uint8* startAddress() const { return buf_; }
0068 
0069   uint32 run() const;
0070   uint32 protocolVersion() const;
0071   void pset(uint8* put_here) const;
0072   std::string releaseTag() const;
0073   std::string processName() const;
0074   std::string outputModuleLabel() const;
0075   uint32 outputModuleId() const { return outputModuleId_; }
0076 
0077   void hltTriggerNames(Strings& save_here) const;
0078   void hltTriggerSelections(Strings& save_here) const;
0079   void l1TriggerNames(Strings& save_here) const;
0080 
0081   uint32 get_hlt_bit_cnt() const { return hlt_trig_count_; }
0082   uint32 get_l1_bit_cnt() const { return l1_trig_count_; }
0083 
0084   // needed for streamer file
0085   uint32 descLength() const { return desc_len_; }
0086   const uint8* descData() const { return desc_start_; }
0087   uint32 headerSize() const { return desc_start_ - buf_; }
0088   uint32 eventHeaderSize() const;
0089   uint32 adler32_chksum() const { return adler32_chksum_; }
0090   std::string hostName() const;
0091   uint32 hostName_len() const { return host_name_len_; }
0092 
0093 private:
0094   uint8* buf_;
0095   HeaderView head_;
0096 
0097   uint8* release_start_;  // points to the string
0098   uint32 release_len_;
0099 
0100   uint8* processName_start_;  // points to the string
0101   uint32 processName_len_;
0102 
0103   uint8* outputModuleLabel_start_;  // points to the string
0104   uint32 outputModuleLabel_len_;
0105   uint32 outputModuleId_;
0106 
0107   uint8* hlt_trig_start_;    // points to the string
0108   uint32 hlt_trig_count_;    // number of strings
0109   uint32 hlt_trig_len_;      // length of strings character array only
0110   uint8* hlt_select_start_;  // points to the string
0111   uint32 hlt_select_count_;  // number of strings
0112   uint32 hlt_select_len_;    // length of strings character array only
0113   uint8* l1_trig_start_;     // points to the string
0114   uint32 l1_trig_count_;     // number of strings
0115   uint32 l1_trig_len_;       // length of strings character array only
0116   uint32 adler32_chksum_;
0117   uint8* host_name_start_;
0118   uint32 host_name_len_;
0119 
0120   // does not need to be present in the message sent over the network,
0121   // but is needed for the index file
0122   uint8* desc_start_;  // point to the bytes
0123   uint32 desc_len_;
0124 };
0125 
0126 #endif