CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/DQMOffline/Trigger/interface/EgHLTDebugFuncs.h

Go to the documentation of this file.
00001 #ifndef DQMOFFLINE_TRIGGER_DEBUGFUNCS
00002 #define DQMOFFLINE_TRIGGER_DEGUGFUNCS
00003 
00004 //collection of usefull functions adding to debug namespace
00005 //
00006 //author: Sam Harper (July 2008)
00007 //
00008 //
00009 //aim: to store common functions which are usefull for debuging my code,
00010 //     in theory any function here doesnt contribute to the program
00011 //     therefore the program should still work when all functions here are     
00012 //     removed from it
00013 
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "DataFormats/Provenance/interface/Provenance.h"
00016 
00017 #include "FWCore/Utilities/interface/InputTag.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 namespace egHLT {
00020   namespace debug {
00021     
00022     //function prints to LogInfo the names of all products of type PROD in event
00023     //it returns the number of products it finds
00024     template<typename PROD> int listAllProducts(const edm::Event& iEvent,const char* moduleName);
00025     
00026   }
00027   
00028   
00029   template<typename PROD> int debug::listAllProducts(const edm::Event& iEvent,const char* moduleName)
00030   {
00031     std::vector<edm::Handle<PROD> > products;
00032     iEvent.getManyByType(products);
00033     
00034     for(size_t i=0;i<products.size();i++){
00035       //  edm::LogInfo(moduleName) <<"for product "<<i+1<<"/"<<products.size()<<" "<<products[i].provenance()->moduleLabel()<<" "<<products[i].provenance()->moduleName()<<std::endl;
00036       std::cout <<"for product "<<i+1<<"/"<<products.size()<<" "<<products[i].provenance()->moduleLabel()<<" "<<products[i].provenance()->moduleName()<<std::endl; 
00037      
00038     }
00039     return products.size();
00040   }
00041 }
00042 
00043 
00044 
00045 
00046 #endif