CMS 3D CMS Logo

Functions
DumpTools.cc File Reference
#include "IOPool/Streamer/interface/DumpTools.h"
#include "FWCore/Utilities/interface/Digest.h"
#include "FWCore/Utilities/interface/Algorithms.h"
#include <iostream>
#include <iterator>
#include "DataFormats/Streamer/interface/StreamedProducts.h"
#include "IOPool/Streamer/interface/ClassFiller.h"
#include "TBufferFile.h"
#include <memory>

Go to the source code of this file.

Functions

void dumpEvent (uint8 *buf)
 
void dumpEventHeader (const EventMsgView *eview)
 
void dumpEventIndex (const EventMsgView *eview)
 
void dumpEventView (const EventMsgView *eview)
 
void dumpFRDEventView (const FRDEventMsgView *fview)
 
void dumpInit (uint8 *buf)
 
void dumpInitHeader (const InitMsgView *view)
 
void dumpInitVerbose (const InitMsgView *view)
 
void dumpInitView (const InitMsgView *view)
 
void dumpStartMsg (const InitMsgView *view)
 
void printBits (unsigned char c)
 

Function Documentation

◆ dumpEvent()

void dumpEvent ( uint8 buf)

Definition at line 179 of file DumpTools.cc.

179  {
180  EventMsgView eview(buf);
181 
182  dumpEventHeader(&eview);
183 
184  //const uint8* edata = eview.eventData();
185  //std::cout << "\nevent data=\n(";
186  //std::copy(&edata[0],&edata[0]+eview.eventLength(),
187  // std::ostream_iterator<char>(std::cout,""));
188  //std::cout << ")\n";
189  std::cout.flush();
190 }

References visDQMUpload::buf, gather_cfg::cout, and dumpEventHeader().

◆ dumpEventHeader()

void dumpEventHeader ( const EventMsgView eview)

Definition at line 130 of file DumpTools.cc.

130  {
131  std::cout << "code=" << eview->code() << "\n"
132  << "size=" << eview->size() << "\n"
133  << "protocolVersion=" << eview->protocolVersion() << "\n"
134  << "run=" << eview->run() << "\n"
135  << "event=" << eview->event() << "\n"
136  << "lumi=" << eview->lumi() << "\n"
137  << "origDataSize=" << eview->origDataSize() << "\n"
138  << "outModId=0x" << std::hex << eview->outModId() << std::dec << "\n"
139  << "adler32 chksum= " << eview->adler32_chksum() << "\n"
140  << "host name= " << eview->hostName() << "\n"
141  << "event length=" << eview->eventLength() << "\n"
142  << "droppedEventsCount=" << eview->droppedEventsCount() << "\n";
143 
144  std::vector<bool> l1_out;
145  eview->l1TriggerBits(l1_out);
146 
147  std::cout << "\nl1 size= " << l1_out.size() << "\n l1 bits=\n";
148  edm::copy_all(l1_out, std::ostream_iterator<bool>(std::cout, " "));
149 
150  std::vector<unsigned char> hlt_out;
151  if (eview->hltCount() > 0) {
152  hlt_out.resize(1 + (eview->hltCount() - 1) / 4);
153  }
154  eview->hltTriggerBits(&hlt_out[0]);
155 
156  std::cout << "\nhlt Count:" << eview->hltCount();
157  std::cout << "\nhlt bits=\n(";
158  for (int i = (hlt_out.size() - 1); i != -1; --i)
159  printBits(hlt_out[i]);
160  std::cout << ")\n";
161  std::cout.flush();
162 }

References EventMsgView::adler32_chksum(), EventMsgView::code(), edm::copy_all(), gather_cfg::cout, TauDecayModes::dec, EventMsgView::droppedEventsCount(), EventMsgView::event(), EventMsgView::eventLength(), EventMsgView::hltCount(), EventMsgView::hltTriggerBits(), EventMsgView::hostName(), mps_fire::i, EventMsgView::l1TriggerBits(), EventMsgView::lumi(), EventMsgView::origDataSize(), EventMsgView::outModId(), printBits(), EventMsgView::protocolVersion(), EventMsgView::run(), and EventMsgView::size().

Referenced by dumpEvent(), dumpEventIndex(), and dumpEventView().

◆ dumpEventIndex()

void dumpEventIndex ( const EventMsgView eview)

Definition at line 174 of file DumpTools.cc.

174  {
175  dumpEventHeader(eview);
176  std::cout.flush();
177 }

References gather_cfg::cout, and dumpEventHeader().

◆ dumpEventView()

void dumpEventView ( const EventMsgView eview)

Definition at line 164 of file DumpTools.cc.

164  {
165  dumpEventHeader(eview);
166  //const uint8* edata = eview->eventData();
167  //std::cout << "\nevent data=\n(";
168  //std::copy(&edata[0],&edata[0]+eview->eventLength(),
169  // std::ostream_iterator<char>(std::cout,""));
170  //std::cout << ")\n";
171  std::cout.flush();
172 }

References gather_cfg::cout, and dumpEventHeader().

◆ dumpFRDEventView()

void dumpFRDEventView ( const FRDEventMsgView fview)

Definition at line 192 of file DumpTools.cc.

192  {
193  std::cout << "\n>>>>> FRDEvent Message Dump (begin) >>>>>" << std::endl;
194  std::cout.flush();
195 
196  std::cout << "size = " << fview->size() << "\n"
197  << "version = " << fview->version() << "\n"
198  << "run = " << fview->run() << "\n"
199  << "lumi = " << fview->lumi() << "\n"
200  << "event = " << fview->event() << "\n";
201  std::cout.flush();
202 
203  std::cout << ">>>>> FRDEvent Message Dump (end) >>>>>" << std::endl;
204  std::cout.flush();
205 }

References gather_cfg::cout, FRDEventMsgView::event(), FRDEventMsgView::lumi(), FRDEventMsgView::run(), FRDEventMsgView::size(), and FRDEventMsgView::version().

◆ dumpInit()

void dumpInit ( uint8 buf)

Definition at line 112 of file DumpTools.cc.

112  {
113  InitMsgView view(buf);
114  dumpInitHeader(&view);
115 
116  std::cout << "desc len = " << view.descLength() << "\n";
117  //const uint8* pos = view.descData();
118  //std::copy(pos,pos+view.descLength(),std::ostream_iterator<uint8>(std::cout,""));
119  //std::cout << "\n";
120  std::cout.flush();
121 }

References visDQMUpload::buf, gather_cfg::cout, InitMsgView::descLength(), and dumpInitHeader().

◆ dumpInitHeader()

void dumpInitHeader ( const InitMsgView view)

File contains simple tools to dump Init and Event Messages on screen.

Definition at line 19 of file DumpTools.cc.

19  {
20  std::cout << "code = " << view->code() << ", "
21  << "size = " << view->size() << "\n"
22  << "run = " << view->run() << ", "
23  << "proto = " << view->protocolVersion() << "\n"
24  << "release = " << view->releaseTag() << "\n"
25  << "processName = " << view->processName() << "\n";
26  if (view->protocolVersion() >= 5) {
27  std::cout << "outModuleLabel = " << view->outputModuleLabel() << "\n";
28  }
29  if (view->protocolVersion() >= 6) {
30  std::cout << "outputModuleId=0x" << std::hex << view->outputModuleId() << std::dec << std::endl;
31  }
32  if (view->protocolVersion() >= 8) {
33  std::cout << "Checksum for Registry data = " << view->adler32_chksum() << " Hostname = " << view->hostName()
34  << std::endl;
35  }
36 
37  //PSet 16 byte non-printable representation, stored in message.
38  uint8 vpset[16];
39  view->pset(vpset);
40 
41  //Lets convert it to printable hex form
42  std::string pset_str(vpset, vpset + sizeof(vpset));
43  pset_str += '\0';
44  cms::Digest dig(pset_str);
45  cms::MD5Result r1 = dig.digest();
46  std::string hexy = r1.toString();
47  std::cout << "PSetID= " << hexy << std::endl;
48 
49  Strings vhltnames, vhltselections, vl1names;
50  view->hltTriggerNames(vhltnames);
51  if (view->protocolVersion() >= 5) {
52  view->hltTriggerSelections(vhltselections);
53  }
54  view->l1TriggerNames(vl1names);
55 
56  std::cout << "HLT names :- \n ";
57  edm::copy_all(vhltnames, std::ostream_iterator<std::string>(std::cout, "\n"));
58 
59  if (view->protocolVersion() >= 5) {
60  std::cout << "HLT selections :- \n ";
61  edm::copy_all(vhltselections, std::ostream_iterator<std::string>(std::cout, "\n"));
62  }
63 
64  std::cout << "L1 names :- \n ";
65  edm::copy_all(vl1names, std::ostream_iterator<std::string>(std::cout, "\n"));
66  std::cout << "\n";
67  std::cout.flush();
68 }

References InitMsgView::adler32_chksum(), InitMsgView::code(), edm::copy_all(), gather_cfg::cout, TauDecayModes::dec, cms::Digest::digest(), InitMsgView::hltTriggerNames(), InitMsgView::hltTriggerSelections(), InitMsgView::hostName(), InitMsgView::l1TriggerNames(), InitMsgView::outputModuleId(), InitMsgView::outputModuleLabel(), InitMsgView::processName(), InitMsgView::protocolVersion(), InitMsgView::pset(), diffTwoXMLs::r1, InitMsgView::releaseTag(), InitMsgView::run(), InitMsgView::size(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dumpInit(), dumpInitVerbose(), dumpInitView(), and dumpStartMsg().

◆ dumpInitVerbose()

void dumpInitVerbose ( const InitMsgView view)

Definition at line 84 of file DumpTools.cc.

84  {
85  std::cout << ">>>>> INIT Message Dump (begin) >>>>>" << std::endl;
86  dumpInitHeader(view);
87 
88  TClass* desc = getTClass(typeid(SendJobHeader));
89  TBufferFile xbuf(TBuffer::kRead, view->descLength(), (char*)view->descData(), kFALSE);
90  std::unique_ptr<SendJobHeader> sd((SendJobHeader*)xbuf.ReadObjectAny(desc));
91 
92  if (sd.get() == nullptr) {
93  std::cout << "Unable to determine the product registry - "
94  << "Registry deserialization error." << std::endl;
95  } else {
96  std::cout << "Branch Descriptions:" << std::endl;
97  SendDescs const& descs = sd->descs();
98  SendDescs::const_iterator iDesc(descs.begin()), eDesc(descs.end());
99  while (iDesc != eDesc) {
100  BranchDescription branchDesc = *iDesc;
101  branchDesc.init();
102  //branchDesc.write(std::cout);
103  std::cout << branchDesc.branchName() << std::endl;
104  iDesc++;
105  }
106  }
107 
108  std::cout << "<<<<< INIT Message Dump (end) <<<<<" << std::endl;
109  std::cout.flush();
110 }

References edm::BranchDescription::branchName(), gather_cfg::cout, InitMsgView::descData(), InitMsgView::descLength(), dumpInitHeader(), edm::getTClass(), edm::BranchDescription::init(), and sd.

◆ dumpInitView()

void dumpInitView ( const InitMsgView view)

Definition at line 70 of file DumpTools.cc.

70  {
71  dumpInitHeader(view);
72  std::cout << "desc len = " << view->descLength() << "\n";
73  //const uint8* pos = view->descData();
74  //std::copy(pos,pos+view->descLength(),std::ostream_iterator<uint8>(std::cout,""));
75  //std::cout << "\n";
76  std::cout.flush();
77 }

References gather_cfg::cout, InitMsgView::descLength(), and dumpInitHeader().

◆ dumpStartMsg()

void dumpStartMsg ( const InitMsgView view)

Definition at line 79 of file DumpTools.cc.

79  {
80  dumpInitHeader(view);
81  std::cout.flush();
82 }

References gather_cfg::cout, and dumpInitHeader().

◆ printBits()

void printBits ( unsigned char  c)

Definition at line 123 of file DumpTools.cc.

123  {
124  for (int i = 7; i >= 0; --i) {
125  int bit = ((c >> i) & 1);
126  std::cout << " " << bit;
127  }
128 }

References HltBtagPostValidation_cff::c, gather_cfg::cout, and mps_fire::i.

Referenced by dumpEventHeader().

edm::copy_all
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20
InitMsgView::adler32_chksum
uint32 adler32_chksum() const
Definition: InitMessage.h:89
InitMsgView::protocolVersion
uint32 protocolVersion() const
Definition: InitMessage.cc:109
mps_fire.i
i
Definition: mps_fire.py:355
InitMsgView::releaseTag
std::string releaseTag() const
Definition: InitMessage.cc:119
InitMsgView::descLength
uint32 descLength() const
Definition: InitMessage.h:85
uint8
unsigned char uint8
Definition: MsgTools.h:11
InitMsgView::processName
std::string processName() const
Definition: InitMessage.cc:123
EventMsgView::droppedEventsCount
uint32 droppedEventsCount() const
Definition: EventMessage.cc:96
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EventMsgView::outModId
uint32 outModId() const
Definition: EventMessage.cc:91
InitMsgView::outputModuleId
uint32 outputModuleId() const
Definition: InitMessage.h:75
InitMsgView::size
uint32 size() const
Definition: InitMessage.h:66
InitMsgView::run
uint32 run() const
Definition: InitMessage.cc:104
EventMsgView
Definition: EventMessage.h:72
FRDEventMsgView::run
uint32 run() const
Definition: FRDEventMessage.h:147
FRDEventMsgView::size
uint32 size() const
Definition: FRDEventMessage.h:143
InitMsgView::l1TriggerNames
void l1TriggerNames(Strings &save_here) const
Definition: InitMessage.cc:154
EventMsgView::origDataSize
uint32 origDataSize() const
Definition: EventMessage.cc:86
EventMsgView::hltCount
uint32 hltCount() const
Definition: EventMessage.h:94
EventMsgView::adler32_chksum
uint32 adler32_chksum() const
Definition: EventMessage.h:96
InitMsgView::hostName
std::string hostName() const
Definition: InitMessage.cc:183
dumpEventHeader
void dumpEventHeader(const EventMsgView *eview)
Definition: DumpTools.cc:130
cms::Digest
Definition: Digest.h:46
EventMsgView::code
uint32 code() const
Definition: EventMessage.h:76
EventMsgView::hltTriggerBits
void hltTriggerBits(uint8 *put_here) const
Definition: EventMessage.cc:110
EventMsgView::protocolVersion
uint32 protocolVersion() const
Definition: EventMessage.cc:66
EventMsgView::run
uint32 run() const
Definition: EventMessage.cc:71
edm::getTClass
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::MD5Result
Definition: Digest.h:11
FRDEventMsgView::lumi
uint32 lumi() const
Definition: FRDEventMessage.h:148
edm::Strings
EventSelector::Strings Strings
Definition: EventSelector.cc:48
EventMsgView::hostName
std::string hostName() const
Definition: EventMessage.cc:121
EventMsgView::event
uint64 event() const
Definition: EventMessage.cc:76
EventMsgView::eventLength
uint32 eventLength() const
Definition: EventMessage.h:81
printBits
void printBits(unsigned char c)
Definition: DumpTools.cc:123
dumpInitHeader
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:19
edm::BranchDescription::branchName
std::string const & branchName() const
Definition: BranchDescription.h:119
FRDEventMsgView::version
uint16 version() const
Definition: FRDEventMessage.h:145
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
InitMsgView::code
uint32 code() const
Definition: InitMessage.h:65
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
InitMsgView::hltTriggerSelections
void hltTriggerSelections(Strings &save_here) const
Definition: InitMessage.cc:145
EventMsgView::size
uint32 size() const
Definition: EventMessage.h:77
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
EventMsgView::l1TriggerBits
void l1TriggerBits(std::vector< bool > &put_here) const
Definition: EventMessage.cc:102
InitMsgView::hltTriggerNames
void hltTriggerNames(Strings &save_here) const
Definition: InitMessage.cc:141
sd
double sd
Definition: CascadeWrapper.h:113
edm::BranchDescription::init
void init()
Definition: BranchDescription.h:59
edm::BranchDescription
Definition: BranchDescription.h:32
InitMsgView::outputModuleLabel
std::string outputModuleLabel() const
Definition: InitMessage.cc:132
EventMsgView::lumi
uint32 lumi() const
Definition: EventMessage.cc:81
InitMsgView::descData
const uint8 * descData() const
Definition: InitMessage.h:86
edm::SendJobHeader
Definition: StreamedProducts.h:102
InitMsgView::pset
void pset(uint8 *put_here) const
Definition: InitMessage.cc:114
edm::SendDescs
std::vector< BranchDescription > SendDescs
Definition: StreamedProducts.h:100
FRDEventMsgView::event
uint64 event() const
Definition: FRDEventMessage.h:149
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
InitMsgView
Definition: InitMessage.h:61