CMS 3D CMS Logo

EgHLTDebugFuncs.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_DEBUGFUNCS
2 #define DQMOFFLINE_TRIGGER_DEBUGFUNCS
3 
4 //collection of usefull functions adding to debug namespace
5 //
6 //author: Sam Harper (July 2008)
7 //
8 //
9 //aim: to store common functions which are usefull for debuging my code,
10 // in theory any function here doesnt contribute to the program
11 // therefore the program should still work when all functions here are
12 // removed from it
13 
16 
19 
20 #include <iostream>
21 
22 namespace egHLT {
23  namespace debug {
24 
25  //function prints to LogInfo the names of all products of type PROD in event
26  //it returns the number of products it finds
27  template<typename PROD> int listAllProducts(const edm::Event& iEvent,const char* moduleName);
28 
29  }
30 
31 
32  template<typename PROD> int debug::listAllProducts(const edm::Event& iEvent,const char* moduleName)
33  {
34  std::vector<edm::Handle<PROD> > products;
35  iEvent.getManyByType(products);
36 
37  for(size_t i=0;i<products.size();i++){
38  // edm::LogInfo(moduleName) <<"for product "<<i+1<<"/"<<products.size()<<" "<<products[i].provenance()->moduleLabel()<<" "<<products[i].provenance()->moduleName()<<std::endl;
39  std::cout <<"for product "<<i+1<<"/"<<products.size()<<" "<<products[i].provenance()->moduleLabel()<<" "<<products[i].provenance()->moduleName()<<std::endl;
40 
41  }
42  return products.size();
43  }
44 }
45 
46 
47 
48 
49 #endif
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:498
int iEvent
Definition: GenABIO.cc:230
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
ESProducts< T, S > products(const T &i1, const S &i2)
Definition: ESProducts.h:191
#define debug
Definition: HDRShower.cc:19
int listAllProducts(const edm::Event &iEvent, const char *moduleName)