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

void dumpEvent ( uint8 buf)

Definition at line 179 of file DumpTools.cc.

References gather_cfg::cout, and dumpEventHeader().

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 }
void dumpEventHeader(const EventMsgView *eview)
Definition: DumpTools.cc:130
void dumpEventHeader ( const EventMsgView eview)

Definition at line 130 of file DumpTools.cc.

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

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 }
uint32 lumi() const
Definition: EventMessage.cc:81
void hltTriggerBits(uint8 *put_here) const
std::string hostName() const
uint32 outModId() const
Definition: EventMessage.cc:91
uint32 run() const
Definition: EventMessage.cc:71
uint32 adler32_chksum() const
Definition: EventMessage.h:96
uint32 eventLength() const
Definition: EventMessage.h:81
uint32 code() const
Definition: EventMessage.h:76
uint32 hltCount() const
Definition: EventMessage.h:94
uint32 droppedEventsCount() const
Definition: EventMessage.cc:96
uint32 size() const
Definition: EventMessage.h:77
uint32 origDataSize() const
Definition: EventMessage.cc:86
void printBits(unsigned char c)
Definition: DumpTools.cc:123
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20
uint64 event() const
Definition: EventMessage.cc:76
void l1TriggerBits(std::vector< bool > &put_here) const
uint32 protocolVersion() const
Definition: EventMessage.cc:66
void dumpEventIndex ( const EventMsgView eview)

Definition at line 174 of file DumpTools.cc.

References gather_cfg::cout, and dumpEventHeader().

174  {
175  dumpEventHeader(eview);
176  std::cout.flush();
177 }
void dumpEventHeader(const EventMsgView *eview)
Definition: DumpTools.cc:130
void dumpEventView ( const EventMsgView eview)

Definition at line 164 of file DumpTools.cc.

References gather_cfg::cout, and dumpEventHeader().

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 }
void dumpEventHeader(const EventMsgView *eview)
Definition: DumpTools.cc:130
void dumpFRDEventView ( const FRDEventMsgView fview)

Definition at line 192 of file DumpTools.cc.

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

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 }
uint32 lumi() const
uint32 size() const
uint32 run() const
uint32 version() const
uint64 event() const
void dumpInit ( uint8 buf)

Definition at line 112 of file DumpTools.cc.

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

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 }
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:19
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.

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(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::MD5Result::toString().

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

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 }
EventSelector::Strings Strings
void hltTriggerNames(Strings &save_here) const
Definition: InitMessage.cc:141
uint32 adler32_chksum() const
Definition: InitMessage.h:89
std::string releaseTag() const
Definition: InitMessage.cc:119
std::string hostName() const
Definition: InitMessage.cc:184
void l1TriggerNames(Strings &save_here) const
Definition: InitMessage.cc:154
uint32 protocolVersion() const
Definition: InitMessage.cc:109
std::string outputModuleLabel() const
Definition: InitMessage.cc:132
std::string toString() const
Definition: Digest.cc:95
unsigned char uint8
Definition: MsgTools.h:11
uint32 outputModuleId() const
Definition: InitMessage.h:75
uint32 code() const
Definition: InitMessage.h:65
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20
std::string processName() const
Definition: InitMessage.cc:123
uint32 run() const
Definition: InitMessage.cc:104
uint32 size() const
Definition: InitMessage.h:66
void hltTriggerSelections(Strings &save_here) const
Definition: InitMessage.cc:145
void pset(uint8 *put_here) const
Definition: InitMessage.cc:114
void dumpInitVerbose ( const InitMsgView view)

Definition at line 84 of file DumpTools.cc.

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

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 }
std::string const & branchName() const
const uint8 * descData() const
Definition: InitMessage.h:86
std::vector< BranchDescription > SendDescs
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:19
double sd
TClass * getTClass(const std::type_info &ti)
uint32 descLength() const
Definition: InitMessage.h:85
void dumpInitView ( const InitMsgView view)

Definition at line 70 of file DumpTools.cc.

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

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 }
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:19
uint32 descLength() const
Definition: InitMessage.h:85
void dumpStartMsg ( const InitMsgView view)

Definition at line 79 of file DumpTools.cc.

References gather_cfg::cout, and dumpInitHeader().

79  {
80  dumpInitHeader(view);
81  std::cout.flush();
82 }
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:19
void printBits ( unsigned char  c)

Definition at line 123 of file DumpTools.cc.

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

Referenced by dumpEventHeader().

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