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>
28  int listAllProducts(const edm::Event& iEvent, const char* moduleName);
29 
30  } // namespace debug
31 
32  template <typename PROD>
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()
40  << " " << products[i].provenance()->moduleName() << std::endl;
41  }
42  return products.size();
43  }
44 } // namespace egHLT
45 
46 #endif
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
Definition: ESProducts.h:128
int iEvent
Definition: GenABIO.cc:224
#define debug
Definition: HDRShower.cc:19
int listAllProducts(const edm::Event &iEvent, const char *moduleName)