CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
28 
29 namespace edm {
30  class ParameterSet;
32  public:
33  // We do not take ownership of passed stream.
34  explicit GetProductCheckerOutputModule(ParameterSet const& pset);
36  static void fillDescriptions(ConfigurationDescriptions& descriptions);
37 
38  private:
39  virtual void write(EventPrincipal const& e);
41  virtual void writeRun(RunPrincipal const&);
42  };
43 
44 //
45 // constants, enums and typedefs
46 //
47 
48 //
49 // static data member definitions
50 //
51 
52 //
53 // constructors and destructor
54 //
56  OutputModule(iPSet) {
57  }
58 
59 // GetProductCheckerOutputModule::GetProductCheckerOutputModule(GetProductCheckerOutputModule const& rhs) {
60 // // do actual copying here;
61 // }
62 
64  }
65 
66 //
67 // assignment operators
68 //
69 // GetProductCheckerOutputModule const& GetProductCheckerOutputModule::operator=(GetProductCheckerOutputModule const& rhs) {
70 // //An exception safe implementation is
71 // GetProductCheckerOutputModule temp(rhs);
72 // swap(rhs);
73 //
74 // return *this;
75 // }
76 
77 //
78 // member functions
79 //
80  static void check(Principal const& p, std::string const& id) {
81  for(Principal::const_iterator it = p.begin(), itEnd = p.end();
82  it != itEnd;
83  ++it) {
84  if(*it) {
85  if (!(*it)->singleProduct()) continue;
86 
87  BranchID branchID = (*it)->branchDescription().branchID();
88  OutputHandle const oh = p.getForOutput(branchID, false);
89 
90  if(0 != oh.desc() && oh.desc()->branchID() != branchID) {
91  throw cms::Exception("BranchIDMissMatch") << "While processing " << id << " request for BranchID " << branchID << " returned BranchID " << oh.desc()->branchID() << "\n";
92  }
93 
94  TypeID const& tid((*it)->branchDescription().unwrappedTypeID());
96  (*it)->branchDescription().moduleLabel(),
97  (*it)->branchDescription().productInstanceName(),
98  (*it)->branchDescription().processName());
99 
100  /*This doesn't appear to be an error, it just means the Product isn't available, which can be legitimate
101  if(!bh.product()) {
102  throw cms::Exception("GetByLabelFailure") << "While processing " << id << " getByLabel request for " << (*it)->productDescription().moduleLabel()
103  << " '" << (*it)->productDescription().productInstanceName() << "' " << (*it)->productDescription().processName() << " failed\n.";
104  }*/
105  if(0 != bh.provenance() && bh.provenance()->branchDescription().branchID() != branchID) {
106  throw cms::Exception("BranchIDMissMatch") << "While processing " << id << " getByLabel request for " << (*it)->branchDescription().moduleLabel()
107  << " '" << (*it)->branchDescription().productInstanceName() << "' " << (*it)->branchDescription().processName()
108  << "\n should have returned BranchID " << branchID << " but returned BranchID " << bh.provenance()->branchDescription().branchID() << "\n";
109  }
110  }
111  }
112  }
114  std::ostringstream str;
115  str << e.id();
116  check(e, str.str());
117  }
119  std::ostringstream str;
120  str << l.id();
121  check(l, str.str());
122  }
124  std::ostringstream str;
125  str << r.id();
126  check(r, str.str());
127  }
128 
129 //
130 // const member functions
131 //
132 
133 //
134 // static member functions
135 //
136 
137  void
141  descriptions.add("productChecker", desc);
142  }
143 }
144 
const_iterator end() const
Definition: Principal.h:146
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ConstBranchDescription const * desc() const
Definition: OutputHandle.h:105
EventID const & id() const
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &)
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag) const
Definition: Principal.cc:421
BranchID const & branchID() const
virtual void write(EventPrincipal const &e)
OutputHandle getForOutput(BranchID const &bid, bool getProd) const
Definition: Principal.cc:673
RunID const & id() const
Definition: RunPrincipal.h:50
static void check(Principal const &p, std::string const &id)
const_iterator begin() const
Definition: Principal.h:145
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static void fillDescription(ParameterSetDescription &desc)
boost::filter_iterator< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
Definition: Principal.h:55
GetProductCheckerOutputModule(ParameterSet const &pset)
virtual void writeRun(RunPrincipal const &)