CMS 3D CMS Logo

GetProductCheckerOutputModule.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Modules
4 // Class : GetProductCheckerOutputModule
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Wed Oct 7 14:41:26 CDT 2009
11 //
12 
13 // system include files
14 #include <string>
15 #include <sstream>
16 
17 // user include files
27 
28 namespace edm {
29  class ModuleCallingContext;
30  class ParameterSet;
31 
33  public:
34  // We do not take ownership of passed stream.
37  static void fillDescriptions(ConfigurationDescriptions& descriptions);
38 
39  private:
40  void write(EventForOutput const& e) override;
41  void writeLuminosityBlock(LuminosityBlockForOutput const&) override;
42  void writeRun(RunForOutput const&) override;
43  };
44 
45 //
46 // constants, enums and typedefs
47 //
48 
49 //
50 // static data member definitions
51 //
52 
53 //
54 // constructors and destructor
55 //
57  OutputModule(iPSet) {
58  }
59 
60 // GetProductCheckerOutputModule::GetProductCheckerOutputModule(GetProductCheckerOutputModule const& rhs) {
61 // // do actual copying here;
62 // }
63 
65  }
66 
67 //
68 // assignment operators
69 //
70 // GetProductCheckerOutputModule const& GetProductCheckerOutputModule::operator=(GetProductCheckerOutputModule const& rhs) {
71 // //An exception safe implementation is
72 // GetProductCheckerOutputModule temp(rhs);
73 // swap(rhs);
74 //
75 // return *this;
76 // }
77 
78 //
79 // member functions
80 //
81  template<typename T>
82  static
83  void check(T const& p, std::string const& id, SelectedProducts const& iProducts) {
84  for(auto const& product : iProducts) {
85  BranchDescription const* branchDescription = product.first;
86  TypeID const& tid = branchDescription->unwrappedTypeID();
87  EDGetToken const& token = product.second;
88  BasicHandle bh;
89  p.getByToken(token, tid, bh);
90  if(nullptr != bh.provenance() && bh.provenance()->branchDescription().branchID() != branchDescription->branchID()) {
91  throw cms::Exception("BranchIDMissMatch") << "While processing " << id << " getByToken request for " << branchDescription->moduleLabel()
92  << " '" << branchDescription->productInstanceName() << "' " << branchDescription->processName()
93  << "\n should have returned BranchID " << branchDescription->branchID() << " but returned BranchID " << bh.provenance()->branchDescription().branchID() << "\n";
94  }
95  }
96  }
98  std::ostringstream str;
99  str << e.id();
100  check(e, str.str(), keptProducts()[InEvent]);
101  }
103  std::ostringstream str;
104  str << l.id();
105  check(l, str.str(), keptProducts()[InLumi]);
106  }
108  std::ostringstream str;
109  str << r.id();
110  check(r, str.str(), keptProducts()[InRun]);
111  }
112 
113 //
114 // const member functions
115 //
116 
117 //
118 // static member functions
119 //
120 
121  void
125  descriptions.add("productChecker", desc);
126  }
127 }
128 
EventID const & id() const
RunID const & id() const
Definition: RunForOutput.h:45
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::string const & processName() const
SelectedProductsForBranchType const & keptProducts() const
Definition: OutputModule.h:76
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
Provenance const * provenance() const
Definition: BasicHandle.h:94
std::string const & moduleLabel() const
std::string const & productInstanceName() const
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
TypeID unwrappedTypeID() const
BranchID const & branchID() const
void writeRun(RunForOutput const &) override
BranchDescription const & branchDescription() const
Definition: Provenance.h:43
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
HLT enums.
void writeLuminosityBlock(LuminosityBlockForOutput const &) override
LuminosityBlockID const & id() const
GetProductCheckerOutputModule(ParameterSet const &pset)
#define str(s)
long double T
void write(EventForOutput const &e) override
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts)