CMS 3D CMS Logo

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