CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 void dumpInitHeader(const InitMsgView* view) {
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 }
69 
70 void dumpInitView(const InitMsgView* view) {
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 }
78 
79 void dumpStartMsg(const InitMsgView* view) {
80  dumpInitHeader(view);
81  std::cout.flush();
82 }
83 
84 void dumpInitVerbose(const InitMsgView* view) {
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 }
111 
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 }
122 
123 void printBits(unsigned char c) {
124  for (int i = 7; i >= 0; --i) {
125  int bit = ((c >> i) & 1);
126  std::cout << " " << bit;
127  }
128 }
129 
130 void dumpEventHeader(const EventMsgView* eview) {
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 }
163 
164 void dumpEventView(const EventMsgView* eview) {
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 }
173 
174 void dumpEventIndex(const EventMsgView* eview) {
175  dumpEventHeader(eview);
176  std::cout.flush();
177 }
178 
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 }
191 
192 void dumpFRDEventView(const FRDEventMsgView* fview) {
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 }
void dumpEventIndex(const EventMsgView *eview)
Definition: DumpTools.cc:174
void dumpEventHeader(const EventMsgView *eview)
Definition: DumpTools.cc:130
std::string const & branchName() const
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:19
uint32 lumi() const
Definition: EventMessage.cc:81
void printBits(unsigned char c)
Definition: DumpTools.cc:123
const edm::EventSetup & c
void dumpEventView(const EventMsgView *eview)
Definition: DumpTools.cc:164
void hltTriggerBits(uint8 *put_here) const
const uint8 * descData() const
Definition: InitMessage.h:86
EventSelector::Strings Strings
std::string hostName() const
std::vector< BranchDescription > SendDescs
uint32 lumi() const
uint32 size() const
void dumpInitView(const InitMsgView *view)
Definition: DumpTools.cc:70
uint32 outModId() const
Definition: EventMessage.cc:91
void dumpInitVerbose(const InitMsgView *view)
Definition: DumpTools.cc:84
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:63
void hltTriggerNames(Strings &save_here) const
Definition: InitMessage.cc:141
uint32 run() const
Definition: EventMessage.cc:71
uint32 adler32_chksum() const
Definition: EventMessage.h:96
uint32 eventLength() const
Definition: EventMessage.h:81
void dumpEvent(uint8 *buf)
Definition: DumpTools.cc:179
void dumpFRDEventView(const FRDEventMsgView *fview)
Definition: DumpTools.cc:192
uint32 adler32_chksum() const
Definition: InitMessage.h:89
std::string releaseTag() const
Definition: InitMessage.cc:119
uint32 run() const
MD5Result digest()
Definition: Digest.cc:171
void dumpInit(uint8 *buf)
Definition: DumpTools.cc:112
uint32 code() const
Definition: EventMessage.h:76
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
double sd
std::string toString() const
Definition: Digest.cc:95
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 dumpStartMsg(const InitMsgView *view)
Definition: DumpTools.cc:79
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
tuple cout
Definition: gather_cfg.py:144
uint32 size() const
Definition: InitMessage.h:66
uint32 descLength() const
Definition: InitMessage.h:85
uint64 event() const
Definition: EventMessage.cc:76
void l1TriggerBits(std::vector< bool > &put_here) const
uint16 version() const
void hltTriggerSelections(Strings &save_here) const
Definition: InitMessage.cc:145
uint64 event() const
void pset(uint8 *put_here) const
Definition: InitMessage.cc:114
uint32 protocolVersion() const
Definition: EventMessage.cc:66