CMS 3D CMS Logo

DumpTools.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 #include <iterator>
12 
13 #include "TBufferFile.h"
14 
15 #include <memory>
16 
17 using namespace edm;
18 
19 namespace edm::streamer {
21  std::cout << "code = " << view->code() << ", "
22  << "size = " << view->size() << "\n"
23  << "run = " << view->run() << ", "
24  << "proto = " << view->protocolVersion() << "\n"
25  << "release = " << view->releaseTag() << "\n"
26  << "processName = " << view->processName() << "\n";
27  if (view->protocolVersion() >= 5) {
28  std::cout << "outModuleLabel = " << view->outputModuleLabel() << "\n";
29  }
30  if (view->protocolVersion() >= 6) {
31  std::cout << "outputModuleId=0x" << std::hex << view->outputModuleId() << std::dec << std::endl;
32  }
33  if (view->protocolVersion() >= 8) {
34  std::cout << "Checksum for Registry data = " << view->adler32_chksum() << " Hostname = " << view->hostName()
35  << std::endl;
36  }
37 
38  //PSet 16 byte non-printable representation, stored in message.
39  uint8 vpset[16];
40  view->pset(vpset);
41 
42  //Lets convert it to printable hex form
43  std::string pset_str(vpset, vpset + sizeof(vpset));
44  pset_str += '\0';
45  cms::Digest dig(pset_str);
46  cms::MD5Result r1 = dig.digest();
47  std::string hexy = r1.toString();
48  std::cout << "PSetID= " << hexy << std::endl;
49 
50  Strings vhltnames, vhltselections, vl1names;
51  view->hltTriggerNames(vhltnames);
52  if (view->protocolVersion() >= 5) {
53  view->hltTriggerSelections(vhltselections);
54  }
55  view->l1TriggerNames(vl1names);
56 
57  std::cout << "HLT names :- \n ";
58  edm::copy_all(vhltnames, std::ostream_iterator<std::string>(std::cout, "\n"));
59 
60  if (view->protocolVersion() >= 5) {
61  std::cout << "HLT selections :- \n ";
62  edm::copy_all(vhltselections, std::ostream_iterator<std::string>(std::cout, "\n"));
63  }
64 
65  std::cout << "L1 names :- \n ";
66  edm::copy_all(vl1names, std::ostream_iterator<std::string>(std::cout, "\n"));
67  std::cout << "\n";
68  std::cout.flush();
69  }
70 
71  void dumpInitView(const InitMsgView* view) {
73  std::cout << "desc len = " << view->descLength() << "\n";
74  //const uint8* pos = view->descData();
75  //std::copy(pos,pos+view->descLength(),std::ostream_iterator<uint8>(std::cout,""));
76  //std::cout << "\n";
77  std::cout.flush();
78  }
79 
80  void dumpStartMsg(const InitMsgView* view) {
82  std::cout.flush();
83  }
84 
86  std::cout << ">>>>> INIT Message Dump (begin) >>>>>" << std::endl;
88 
89  TClass* desc = getTClass(typeid(SendJobHeader));
90  TBufferFile xbuf(TBuffer::kRead, view->descLength(), (char*)view->descData(), kFALSE);
91  std::unique_ptr<SendJobHeader> sd((SendJobHeader*)xbuf.ReadObjectAny(desc));
92 
93  if (sd.get() == nullptr) {
94  std::cout << "Unable to determine the product registry - "
95  << "Registry deserialization error." << std::endl;
96  } else {
97  std::cout << "Branch Descriptions:" << std::endl;
98  SendDescs const& descs = sd->descs();
99  SendDescs::const_iterator iDesc(descs.begin()), eDesc(descs.end());
100  while (iDesc != eDesc) {
101  BranchDescription branchDesc = *iDesc;
102  branchDesc.init();
103  //branchDesc.write(std::cout);
104  std::cout << branchDesc.branchName() << std::endl;
105  iDesc++;
106  }
107  }
108 
109  std::cout << "<<<<< INIT Message Dump (end) <<<<<" << std::endl;
110  std::cout.flush();
111  }
112 
113  void dumpInit(uint8* buf) {
116 
117  std::cout << "desc len = " << view.descLength() << "\n";
118  //const uint8* pos = view.descData();
119  //std::copy(pos,pos+view.descLength(),std::ostream_iterator<uint8>(std::cout,""));
120  //std::cout << "\n";
121  std::cout.flush();
122  }
123 
124  void printBits(unsigned char c) {
125  for (int i = 7; i >= 0; --i) {
126  int bit = ((c >> i) & 1);
127  std::cout << " " << bit;
128  }
129  }
130 
131  void dumpEventHeader(const EventMsgView* eview) {
132  std::cout << "code=" << eview->code() << "\n"
133  << "size=" << eview->size() << "\n"
134  << "protocolVersion=" << eview->protocolVersion() << "\n"
135  << "run=" << eview->run() << "\n"
136  << "event=" << eview->event() << "\n"
137  << "lumi=" << eview->lumi() << "\n"
138  << "origDataSize=" << eview->origDataSize() << "\n"
139  << "outModId=0x" << std::hex << eview->outModId() << std::dec << "\n"
140  << "adler32 chksum= " << eview->adler32_chksum() << "\n"
141  << "host name= " << eview->hostName() << "\n"
142  << "event length=" << eview->eventLength() << "\n"
143  << "droppedEventsCount=" << eview->droppedEventsCount() << "\n";
144 
145  std::vector<bool> l1_out;
146  eview->l1TriggerBits(l1_out);
147 
148  std::cout << "\nl1 size= " << l1_out.size() << "\n l1 bits=\n";
149  edm::copy_all(l1_out, std::ostream_iterator<bool>(std::cout, " "));
150 
151  std::vector<unsigned char> hlt_out;
152  if (eview->hltCount() > 0) {
153  hlt_out.resize(1 + (eview->hltCount() - 1) / 4);
154  }
155  eview->hltTriggerBits(&hlt_out[0]);
156 
157  std::cout << "\nhlt Count:" << eview->hltCount();
158  std::cout << "\nhlt bits=\n(";
159  for (int i = (hlt_out.size() - 1); i != -1; --i)
160  printBits(hlt_out[i]);
161  std::cout << ")\n";
162  std::cout.flush();
163  }
164 
165  void dumpEventView(const EventMsgView* eview) {
166  dumpEventHeader(eview);
167  //const uint8* edata = eview->eventData();
168  //std::cout << "\nevent data=\n(";
169  //std::copy(&edata[0],&edata[0]+eview->eventLength(),
170  // std::ostream_iterator<char>(std::cout,""));
171  //std::cout << ")\n";
172  std::cout.flush();
173  }
174 
175  void dumpEventIndex(const EventMsgView* eview) {
176  dumpEventHeader(eview);
177  std::cout.flush();
178  }
179 
180  void dumpEvent(uint8* buf) {
181  EventMsgView eview(buf);
182 
183  dumpEventHeader(&eview);
184 
185  //const uint8* edata = eview.eventData();
186  //std::cout << "\nevent data=\n(";
187  //std::copy(&edata[0],&edata[0]+eview.eventLength(),
188  // std::ostream_iterator<char>(std::cout,""));
189  //std::cout << ")\n";
190  std::cout.flush();
191  }
192 
193  void dumpFRDEventView(const FRDEventMsgView* fview) {
194  std::cout << "\n>>>>> FRDEvent Message Dump (begin) >>>>>" << std::endl;
195  std::cout.flush();
196 
197  std::cout << "size = " << fview->size() << "\n"
198  << "version = " << fview->version() << "\n"
199  << "run = " << fview->run() << "\n"
200  << "lumi = " << fview->lumi() << "\n"
201  << "event = " << fview->event() << "\n";
202  std::cout.flush();
203 
204  std::cout << ">>>>> FRDEvent Message Dump (end) >>>>>" << std::endl;
205  std::cout.flush();
206  }
207 } // namespace edm::streamer
void dumpEvent(uint8 *buf)
Definition: DumpTools.cc:180
void dumpInitView(const InitMsgView *view)
Definition: DumpTools.cc:71
std::vector< BranchDescription > SendDescs
void hltTriggerBits(uint8 *put_here) const
void dumpFRDEventView(const FRDEventMsgView *fview)
Definition: DumpTools.cc:193
uint32 protocolVersion() const
Definition: EventMessage.cc:68
MD5Result digest()
Definition: Digest.cc:171
std::string const & branchName() const
void dumpEventView(const EventMsgView *eview)
Definition: DumpTools.cc:165
void l1TriggerBits(std::vector< bool > &put_here) const
unsigned char uint8
Definition: MsgTools.h:12
void dumpInitVerbose(const InitMsgView *view)
Definition: DumpTools.cc:85
std::string hostName() const
uint32 droppedEventsCount() const
Definition: EventMessage.cc:98
uint32 adler32_chksum() const
Definition: EventMessage.h:97
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:63
void dumpStartMsg(const InitMsgView *view)
Definition: DumpTools.cc:80
std::vector< std::string > Strings
Definition: MsgTools.h:19
HLT enums.
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20
void dumpEventIndex(const EventMsgView *eview)
Definition: DumpTools.cc:175
uint32 eventLength() const
Definition: EventMessage.h:81
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:20
void dumpEventHeader(const EventMsgView *eview)
Definition: DumpTools.cc:131
void dumpInit(uint8 *buf)
Definition: DumpTools.cc:113
void printBits(unsigned char c)
Definition: DumpTools.cc:124