CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 namespace egHLT {
20  namespace debug {
21 
22  //function prints to LogInfo the names of all products of type PROD in event
23  //it returns the number of products it finds
24  template<typename PROD> int listAllProducts(const edm::Event& iEvent,const char* moduleName);
25 
26  }
27 
28 
29  template<typename PROD> int debug::listAllProducts(const edm::Event& iEvent,const char* moduleName)
30  {
31  std::vector<edm::Handle<PROD> > products;
32  iEvent.getManyByType(products);
33 
34  for(size_t i=0;i<products.size();i++){
35  // edm::LogInfo(moduleName) <<"for product "<<i+1<<"/"<<products.size()<<" "<<products[i].provenance()->moduleLabel()<<" "<<products[i].provenance()->moduleName()<<std::endl;
36  std::cout <<"for product "<<i+1<<"/"<<products.size()<<" "<<products[i].provenance()->moduleLabel()<<" "<<products[i].provenance()->moduleName()<<std::endl;
37 
38  }
39  return products.size();
40  }
41 }
42 
43 
44 
45 
46 #endif
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:447
int i
Definition: DBlmapReader.cc:9
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:189
#define debug
Definition: HDRShower.cc:19
int listAllProducts(const edm::Event &iEvent, const char *moduleName)
tuple cout
Definition: gather_cfg.py:121