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
27 
28 namespace edm {
29  class ParameterSet;
31  public:
32  // We do not take ownership of passed stream.
35  static void fillDescriptions(ConfigurationDescriptions& descriptions);
36 
37  private:
38  virtual void write(EventPrincipal const& e);
40  virtual void writeRun(RunPrincipal const&);
41  };
42 
43 //
44 // constants, enums and typedefs
45 //
46 
47 //
48 // static data member definitions
49 //
50 
51 //
52 // constructors and destructor
53 //
55  OutputModule(iPSet) {
56  }
57 
58 // GetProductCheckerOutputModule::GetProductCheckerOutputModule(GetProductCheckerOutputModule const& rhs) {
59 // // do actual copying here;
60 // }
61 
63  }
64 
65 //
66 // assignment operators
67 //
68 // GetProductCheckerOutputModule const& GetProductCheckerOutputModule::operator=(GetProductCheckerOutputModule const& rhs) {
69 // //An exception safe implementation is
70 // GetProductCheckerOutputModule temp(rhs);
71 // swap(rhs);
72 //
73 // return *this;
74 // }
75 
76 //
77 // member functions
78 //
79  static void check(Principal const& p, std::string const& id) {
80  for(Principal::const_iterator it = p.begin(), itEnd = p.end();
81  it != itEnd;
82  ++it) {
83  if(*it) {
84  BranchID branchID = (*it)->branchDescription().branchID();
85  OutputHandle const oh = p.getForOutput(branchID, false);
86 
87  if(0 != oh.desc() && oh.desc()->branchID() != branchID) {
88  throw cms::Exception("BranchIDMissMatch") << "While processing " << id << " request for BranchID " << branchID << " returned BranchID " << oh.desc()->branchID() << "\n";
89  }
90 
91  TypeID tid((*it)->branchDescription().type().TypeInfo());
92  size_t temp = 0;
93  int tempCount = -1;
94  BasicHandle bh = p.getByLabel(tid,
95  (*it)->branchDescription().moduleLabel(),
96  (*it)->branchDescription().productInstanceName(),
97  (*it)->branchDescription().processName(),
98  temp, tempCount);
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 
BasicHandle getByLabel(TypeID const &tid, std::string const &label, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const
Definition: Principal.cc:254
const_iterator end() const
Definition: Principal.h:131
#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 &)
Provenance const * provenance() const
Definition: BasicHandle.h:95
BranchID const & branchID() const
virtual void write(EventPrincipal const &e)
OutputHandle getForOutput(BranchID const &bid, bool getProd) const
Definition: Principal.cc:523
BranchID const & branchID() const
tuple pset
Definition: CrabTask.py:85
RunID const & id() const
Definition: RunPrincipal.h:51
BranchDescription const & branchDescription() const
Definition: Provenance.h:46
static void check(Principal const &p, std::string const &id)
const_iterator begin() const
Definition: Principal.h:130
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static void fillDescription(ParameterSetDescription &desc)
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
Definition: Principal.h:48
GetProductCheckerOutputModule(ParameterSet const &pset)
virtual void writeRun(RunPrincipal const &)