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  : one::OutputModuleBase(iPSet), one::OutputModule<>(iPSet) {}
58 
59  // GetProductCheckerOutputModule::GetProductCheckerOutputModule(GetProductCheckerOutputModule const& rhs) {
60  // // do actual copying here;
61  // }
62 
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  template <typename T>
80  static void check(T const& p, std::string const& id, SelectedProducts const& iProducts) {
81  for (auto const& product : iProducts) {
82  BranchDescription const* branchDescription = product.first;
83  TypeID const& tid = branchDescription->unwrappedTypeID();
84  EDGetToken const& token = product.second;
85  BasicHandle bh = p.getByToken(token, tid);
86  if (nullptr != bh.provenance() &&
87  bh.provenance()->branchDescription().branchID() != branchDescription->branchID()) {
88  throw cms::Exception("BranchIDMissMatch")
89  << "While processing " << id << " getByToken request for " << branchDescription->moduleLabel() << " '"
90  << branchDescription->productInstanceName() << "' " << branchDescription->processName()
91  << "\n should have returned BranchID " << branchDescription->branchID() << " but returned BranchID "
92  << bh.provenance()->branchDescription().branchID() << "\n";
93  }
94  }
95  }
97  std::ostringstream str;
98  str << e.id();
99  check(e, str.str(), keptProducts()[InEvent]);
100  }
102  std::ostringstream str;
103  str << l.id();
104  check(l, str.str(), keptProducts()[InLumi]);
105  }
107  std::ostringstream str;
108  str << r.id();
109  check(r, str.str(), keptProducts()[InRun]);
110  }
111 
112  //
113  // const member functions
114  //
115 
116  //
117  // static member functions
118  //
119 
123  descriptions.add("productChecker", desc);
124  }
125 } // namespace edm
126 
ConfigurationDescriptions.h
edm::one::OutputModule
Definition: OutputModule.h:30
edm::BranchDescription::productInstanceName
std::string const & productInstanceName() const
Definition: BranchDescription.h:81
edm::GetProductCheckerOutputModule::~GetProductCheckerOutputModule
~GetProductCheckerOutputModule() override
Definition: GetProductCheckerOutputModule.cc:63
edm::BasicHandle::provenance
Provenance const * provenance() const noexcept(true)
Definition: BasicHandle.h:75
OutputModule.h
edm::BasicHandle
Definition: BasicHandle.h:43
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::GetProductCheckerOutputModule::writeLuminosityBlock
void writeLuminosityBlock(LuminosityBlockForOutput const &) override
Definition: GetProductCheckerOutputModule.cc:101
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
RunForOutput.h
edm::GetProductCheckerOutputModule::GetProductCheckerOutputModule
GetProductCheckerOutputModule(ParameterSet const &pset)
Definition: GetProductCheckerOutputModule.cc:56
EventForOutput.h
edm::InRun
Definition: BranchType.h:11
edm::SelectedProducts
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
Definition: SelectedProducts.h:11
edm::LuminosityBlockForOutput
Definition: LuminosityBlockForOutput.h:40
edm::RunForOutput
Definition: RunForOutput.h:39
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::BranchDescription::processName
std::string const & processName() const
Definition: BranchDescription.h:73
edm::Provenance::branchDescription
BranchDescription const & branchDescription() const
Definition: Provenance.h:45
str
#define str(s)
Definition: TestProcessor.cc:48
edm::BranchDescription::unwrappedTypeID
TypeID unwrappedTypeID() const
Definition: BranchDescription.h:97
edm::InEvent
Definition: BranchType.h:11
edm::one::OutputModuleBase::fillDescription
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
Definition: OutputModuleBase.cc:350
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
OutputModuleBase
edm::ParameterSet
Definition: ParameterSet.h:36
edm::GetProductCheckerOutputModule::write
void write(EventForOutput const &e) override
Definition: GetProductCheckerOutputModule.cc:96
ParameterSet
Definition: Functions.h:16
edm::InLumi
Definition: BranchType.h:11
edm::one::OutputModuleBase::keptProducts
SelectedProductsForBranchType const & keptProducts() const
Definition: OutputModuleBase.h:96
edm::GetProductCheckerOutputModule::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: GetProductCheckerOutputModule.cc:120
edm::EDGetToken
Definition: EDGetToken.h:35
edm::GetProductCheckerOutputModule::writeRun
void writeRun(RunForOutput const &) override
Definition: GetProductCheckerOutputModule.cc:106
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::check
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts)
Definition: GetProductCheckerOutputModule.cc:80
edm::EventForOutput
Definition: EventForOutput.h:50
edm::TypeID
Definition: TypeID.h:22
edm::GetProductCheckerOutputModule
Definition: GetProductCheckerOutputModule.cc:32
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:246
Exception.h
edm::BranchDescription
Definition: BranchDescription.h:32
LuminosityBlockForOutput.h
edm::BranchDescription::branchID
BranchID const & branchID() const
Definition: BranchDescription.h:74
ProductKindOfType.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316