Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:17

0001 #ifndef DQMOFFLINE_TRIGGER_DEBUGFUNCS
0002 #define DQMOFFLINE_TRIGGER_DEBUGFUNCS
0003 
0004 //collection of usefull functions adding to debug namespace
0005 //
0006 //author: Sam Harper (July 2008)
0007 //
0008 //
0009 //aim: to store common functions which are usefull for debuging my code,
0010 //     in theory any function here doesnt contribute to the program
0011 //     therefore the program should still work when all functions here are
0012 //     removed from it
0013 
0014 #include "DataFormats/Common/interface/Handle.h"
0015 #include "DataFormats/Provenance/interface/Provenance.h"
0016 
0017 #include "FWCore/Utilities/interface/InputTag.h"
0018 #include "FWCore/Framework/interface/Event.h"
0019 
0020 #include <iostream>
0021 
0022 namespace egHLT {
0023   namespace debug {
0024 
0025     //function prints to LogInfo the names of all products of type PROD in event
0026     //it returns the number of products it finds
0027     template <typename PROD>
0028     int listAllProducts(const edm::Event& iEvent, const char* moduleName);
0029 
0030   }  // namespace debug
0031 
0032   template <typename PROD>
0033   int debug::listAllProducts(const edm::Event& iEvent, const char* moduleName) {
0034     std::vector<edm::Handle<PROD> > products;
0035     iEvent.getManyByType(products);
0036 
0037     for (size_t i = 0; i < products.size(); i++) {
0038       //  edm::LogInfo(moduleName) <<"for product "<<i+1<<"/"<<products.size()<<" "<<products[i].provenance()->moduleLabel()<<" "<<products[i].provenance()->moduleName()<<std::endl;
0039       std::cout << "for product " << i + 1 << "/" << products.size() << " " << products[i].provenance()->moduleLabel()
0040                 << " " << products[i].provenance()->moduleName() << std::endl;
0041     }
0042     return products.size();
0043   }
0044 }  // namespace egHLT
0045 
0046 #endif