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 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 }
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:428
FRDEventMsgView
Definition: FRDEventMessage.h:137
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
cms::Digest::digest
MD5Result digest()
Definition: Digest.cc:171
InitMsgView::processName
std::string processName() const
Definition: InitMessage.cc:123
EventMsgView::droppedEventsCount
uint32 droppedEventsCount() const
Definition: EventMessage.cc:96
StreamedProducts.h
edm
HLT enums.
Definition: AlignableModifier.h:19
dumpStartMsg
void dumpStartMsg(const InitMsgView *view)
Definition: DumpTools.cc:79
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EventMsgView::outModId
uint32 outModId() const
Definition: EventMessage.cc:91
Algorithms.h
InitMsgView::outputModuleId
uint32 outputModuleId() const
Definition: InitMessage.h:75
dumpInit
void dumpInit(uint8 *buf)
Definition: DumpTools.cc:112
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
dumpInitVerbose
void dumpInitVerbose(const InitMsgView *view)
Definition: DumpTools.cc:84
dumpEventIndex
void dumpEventIndex(const EventMsgView *eview)
Definition: DumpTools.cc:174
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
DumpTools.h
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
dumpEvent
void dumpEvent(uint8 *buf)
Definition: DumpTools.cc:179
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
dumpInitView
void dumpInitView(const InitMsgView *view)
Definition: DumpTools.cc:70
edm::BranchDescription::branchName
std::string const & branchName() const
Definition: BranchDescription.h:120
FRDEventMsgView::version
uint16 version() const
Definition: FRDEventMessage.h:145
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
Digest.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
dumpEventView
void dumpEventView(const EventMsgView *eview)
Definition: DumpTools.cc:164
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
ClassFiller.h
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
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
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
dumpFRDEventView
void dumpFRDEventView(const FRDEventMsgView *fview)
Definition: DumpTools.cc:192
InitMsgView
Definition: InitMessage.h:61