Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:03

0001 #ifndef FWCore_Framework_InputTagMatch_h
0002 #define FWCore_Framework_InputTagMatch_h
0003 
0004 /** \class edm::InputTagMatch
0005 
0006 This is intended to be used with the class GetterOfProducts.
0007 See comments in the file GetterOfProducts.h for a description.
0008 
0009 \author V. Adler
0010 
0011 */
0012 
0013 #include "FWCore/Utilities/interface/InputTag.h"
0014 #include "DataFormats/Provenance/interface/BranchDescription.h"
0015 
0016 #include <string>
0017 
0018 namespace edm {
0019 
0020   class InputTagMatch {
0021   public:
0022     InputTagMatch(edm::InputTag const& inputTag) : inputTag_(inputTag) {}
0023 
0024     bool operator()(edm::BranchDescription const& branchDescription) {
0025       bool result(true);
0026       bool match(false);
0027       if (!inputTag_.label().empty()) {
0028         match = true;
0029         result = (result && branchDescription.moduleLabel() == inputTag_.label());
0030       }
0031       if (!inputTag_.instance().empty()) {
0032         match = true;
0033         result = (result && branchDescription.productInstanceName() == inputTag_.instance());
0034       }
0035       if (!inputTag_.process().empty()) {
0036         match = true;
0037         result = (result && branchDescription.processName() == inputTag_.process());
0038       }
0039       if (match)
0040         return result;
0041       return false;
0042     }
0043 
0044   private:
0045     edm::InputTag inputTag_;
0046   };
0047 }  // namespace edm
0048 #endif