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 using namespace edm;
16 
17 void dumpInitHeader(const InitMsgView* view)
18 {
19  std::cout
20  << "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()
31  << std::dec << std::endl;
32  }
33  if (view->protocolVersion() >= 8) {
34  std::cout << "Checksum for Registry data = " << view->adler32_chksum()
35  << " Hostname = " << view->hostName() << 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 
72 void dumpInitView(const InitMsgView* view)
73 {
74 
75 
76  dumpInitHeader(view);
77  std::cout << "desc len = " << view->descLength() << "\n";
78  //const uint8* pos = view->descData();
79  //std::copy(pos,pos+view->descLength(),std::ostream_iterator<uint8>(std::cout,""));
80  //std::cout << "\n";
81  std::cout.flush();
82 
83 }
84 
85 void dumpStartMsg(const InitMsgView* view)
86 {
87  dumpInitHeader(view);
88  std::cout.flush();
89 }
90 
91 void dumpInitVerbose(const InitMsgView* view)
92 {
93  std::cout << ">>>>> INIT Message Dump (begin) >>>>>" << std::endl;
94  dumpInitHeader(view);
95 
96  TClass* desc = getTClass(typeid(SendJobHeader));
97  TBufferFile xbuf(TBuffer::kRead, view->descLength(),
98  (char*)view->descData(), kFALSE);
99  std::auto_ptr<SendJobHeader> sd((SendJobHeader*)xbuf.ReadObjectAny(desc));
100 
101  if (sd.get() == 0) {
102  std::cout << "Unable to determine the product registry - "
103  << "Registry deserialization error." << std::endl;
104  }
105  else {
106  std::cout << "Branch Descriptions:" << std::endl;
107  SendDescs const& descs = sd->descs();
108  SendDescs::const_iterator iDesc(descs.begin()), eDesc(descs.end());
109  while (iDesc != eDesc) {
110  BranchDescription branchDesc = *iDesc;
111  branchDesc.init();
112  //branchDesc.write(std::cout);
113  std::cout << branchDesc.branchName() << std::endl;
114  iDesc++;
115  }
116  }
117 
118  std::cout << "<<<<< INIT Message Dump (end) <<<<<" << std::endl;
119  std::cout.flush();
120 }
121 
122 void dumpInit(uint8* buf)
123 {
124  InitMsgView view(buf);
125  dumpInitHeader(&view);
126 
127  std::cout << "desc len = " << view.descLength() << "\n";
128  //const uint8* pos = view.descData();
129  //std::copy(pos,pos+view.descLength(),std::ostream_iterator<uint8>(std::cout,""));
130  //std::cout << "\n";
131  std::cout.flush();
132 }
133 
134 void printBits(unsigned char c){
135 
136  for (int i = 7; i >= 0; --i) {
137  int bit = ((c >> i) & 1);
138  std::cout << " "<<bit;
139  }
140 }
141 
142 void dumpEventHeader(const EventMsgView* eview)
143 {
144  std::cout << "code=" << eview->code() << "\n"
145  << "size=" << eview->size() << "\n"
146  << "protocolVersion=" << eview->protocolVersion() << "\n"
147  << "run=" << eview->run() << "\n"
148  << "event=" << eview->event() << "\n"
149  << "lumi=" << eview->lumi() << "\n"
150  << "origDataSize=" << eview->origDataSize() << "\n"
151  << "outModId=0x" << std::hex << eview->outModId() << std::dec << "\n"
152  << "adler32 chksum= " << eview->adler32_chksum() << "\n"
153  << "host name= " << eview->hostName() << "\n"
154  << "event length=" << eview->eventLength() << "\n"
155  << "droppedEventsCount=" << eview->droppedEventsCount() << "\n";
156 
157  std::vector<bool> l1_out;
158  eview->l1TriggerBits(l1_out);
159 
160  std::cout << "\nl1 size= " << l1_out.size() << "\n l1 bits=\n";
161  edm::copy_all(l1_out,std::ostream_iterator<bool>(std::cout," "));
162 
163  std::vector<unsigned char> hlt_out;
164  if (eview->hltCount() > 0) {hlt_out.resize(1 + (eview->hltCount()-1)/4);}
165  eview->hltTriggerBits(&hlt_out[0]);
166 
167  std::cout << "\nhlt Count:" << eview->hltCount();
168  std::cout << "\nhlt bits=\n(";
169  for(int i=(hlt_out.size()-1); i != -1 ; --i)
170  printBits(hlt_out[i]);
171  std::cout << ")\n";
172  std::cout.flush();
173 }
174 
175 void dumpEventView(const EventMsgView* eview)
176  {
177  dumpEventHeader(eview);
178  //const uint8* edata = eview->eventData();
179  //std::cout << "\nevent data=\n(";
180  //std::copy(&edata[0],&edata[0]+eview->eventLength(),
181  // std::ostream_iterator<char>(std::cout,""));
182  //std::cout << ")\n";
183  std::cout.flush();
184 
185 }
186 
187 void dumpEventIndex(const EventMsgView* eview)
188 {
189  dumpEventHeader(eview);
190  std::cout.flush();
191 }
192 
193 void dumpEvent(uint8* buf)
194 {
195  EventMsgView eview(buf);
196 
197  dumpEventHeader(&eview);
198 
199  //const uint8* edata = eview.eventData();
200  //std::cout << "\nevent data=\n(";
201  //std::copy(&edata[0],&edata[0]+eview.eventLength(),
202  // std::ostream_iterator<char>(std::cout,""));
203  //std::cout << ")\n";
204  std::cout.flush();
205 
206 }
207 
209 {
210  std::cout << "code = " << dview->code() << "\n"
211  << "size = " << dview->size() << "\n"
212  << "protocolVersion = " << dview->protocolVersion() << "\n"
213  << "run = " << dview->runNumber() << "\n"
214  << "event = " << dview->eventNumberAtUpdate() << "\n"
215  << "lumi = " << dview->lumiSection() << "\n"
216  << "update = " << dview->updateNumber() << "\n"
217  << "checksum = " << dview->adler32_chksum() << "\n"
218  << "host name= " << dview->hostName() << "\n"
219  << "compressionFlag = " << dview->compressionFlag() << "\n"
220  << "fuProcessId = " << dview->fuProcessId() << "\n"
221  << "fuGuid = 0x" << std::hex << dview->fuGuid() << std::dec << "\n"
222  << "mergeCount = " << dview->mergeCount() << "\n"
223  << "release = " << dview->releaseTag() << "\n"
224  << "topFolder = " << dview->topFolderName() << "\n"
225  << "event length = " << dview->eventLength() << "\n";
226  std::cout.flush();
227  }
228 
230 {
231  std::cout << "\n>>>>> DQMEvent Message Dump (begin) >>>>>" << std::endl;
232  dumpDQMEventHeader(dview);
233 
234  boost::shared_ptr< std::vector<std::string> > subFolders =
235  dview->subFolderNames();
236  for (uint32 idx = 0; idx < subFolders->size(); idx++) {
237  std::string name = subFolders->at(idx);
238  uint32 count = dview->meCount(name);
239  std::cout << "Subfolder " << name << " has " << count
240  << " monitor elements." << std::endl;
241  }
242 
243  std::cout << ">>>>> DQMEvent Message Dump (end) >>>>>" << std::endl;
244  std::cout.flush();
245 }
246 
248 {
249  std::cout << "\n>>>>> FRDEvent Message Dump (begin) >>>>>" << std::endl;
250  std::cout.flush();
251 
252  std::cout << "size = " << fview->size() << "\n"
253  << "version = " << fview->version() << "\n"
254  << "run = " << fview->run() << "\n"
255  << "lumi = " << fview->lumi() << "\n"
256  << "event = " << fview->event() << "\n";
257  std::cout.flush();
258 
259  std::cout << ">>>>> FRDEvent Message Dump (end) >>>>>" << std::endl;
260  std::cout.flush();
261 }
void dumpEventIndex(const EventMsgView *eview)
Definition: DumpTools.cc:187
void dumpEventHeader(const EventMsgView *eview)
Definition: DumpTools.cc:142
int i
Definition: DBlmapReader.cc:9
std::string const & branchName() const
void dumpInitHeader(const InitMsgView *view)
Definition: DumpTools.cc:17
uint32 lumi() const
Definition: EventMessage.cc:85
void printBits(unsigned char c)
Definition: DumpTools.cc:134
void dumpEventView(const EventMsgView *eview)
Definition: DumpTools.cc:175
void hltTriggerBits(uint8 *put_here) const
const uint8 * descData() const
Definition: InitMessage.h:91
std::string hostName() const
std::vector< BranchDescription > SendDescs
uint32 lumi() const
std::vector< std::string > Strings
Definition: MsgTools.h:18
uint32 size() const
uint32 protocolVersion() const
void dumpInitView(const InitMsgView *view)
Definition: DumpTools.cc:72
uint32 outModId() const
Definition: EventMessage.cc:97
uint32 eventNumberAtUpdate() const
void dumpInitVerbose(const InitMsgView *view)
Definition: DumpTools.cc:91
MD5Result digest() const
Definition: Digest.cc:194
uint32 adler32_chksum() const
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:78
void hltTriggerNames(Strings &save_here) const
Definition: InitMessage.cc:146
uint32 updateNumber() const
uint32 run() const
Definition: EventMessage.cc:73
uint32 meCount(std::string const &subFolderName) const
uint32 adler32_chksum() const
Definition: EventMessage.h:97
uint32 eventLength() const
Definition: EventMessage.h:82
void dumpEvent(uint8 *buf)
Definition: DumpTools.cc:193
void dumpDQMEventView(const DQMEventMsgView *dview)
Definition: DumpTools.cc:229
void dumpFRDEventView(const FRDEventMsgView *fview)
Definition: DumpTools.cc:247
std::string topFolderName() const
uint32 adler32_chksum() const
Definition: InitMessage.h:94
std::string releaseTag() const
Definition: InitMessage.cc:122
uint32 run() const
void dumpInit(uint8 *buf)
Definition: DumpTools.cc:122
uint32 code() const
Definition: EventMessage.h:77
uint32 eventLength() const
uint32 fuGuid() const
std::string hostName() const
Definition: InitMessage.cc:190
uint32 event() const
Definition: EventMessage.cc:79
uint32 compressionFlag() const
void l1TriggerNames(Strings &save_here) const
Definition: InitMessage.cc:160
uint32 version() const
unsigned int uint32
Definition: MsgTools.h:13
uint32 protocolVersion() const
Definition: InitMessage.cc:110
std::string releaseTag() const
std::string outputModuleLabel() const
Definition: InitMessage.cc:136
double sd
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::string toString() const
Definition: Digest.cc:87
uint32 hltCount() const
Definition: EventMessage.h:95
uint32 droppedEventsCount() const
uint32 size() const
Definition: EventMessage.h:78
void dumpDQMEventHeader(const DQMEventMsgView *dview)
Definition: DumpTools.cc:208
uint32 origDataSize() const
Definition: EventMessage.cc:91
void dumpStartMsg(const InitMsgView *view)
Definition: DumpTools.cc:85
unsigned char uint8
Definition: MsgTools.h:11
uint32 outputModuleId() const
Definition: InitMessage.h:80
uint32 lumiSection() const
uint32 code() const
Definition: InitMessage.h:70
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:24
boost::shared_ptr< std::vector< std::string > > subFolderNames() const
std::string processName() const
Definition: InitMessage.cc:127
uint32 code() const
uint32 run() const
Definition: InitMessage.cc:104
tuple cout
Definition: gather_cfg.py:121
uint32 size() const
Definition: InitMessage.h:71
uint32 event() const
uint32 descLength() const
Definition: InitMessage.h:90
uint32 fuProcessId() const
std::string hostName() const
uint32 size() const
void l1TriggerBits(std::vector< bool > &put_here) const
uint32 runNumber() const
void hltTriggerSelections(Strings &save_here) const
Definition: InitMessage.cc:151
uint32 mergeCount() const
void pset(uint8 *put_here) const
Definition: InitMessage.cc:116
uint32 protocolVersion() const
Definition: EventMessage.cc:67