CMS 3D CMS Logo

LogErrorHarvester.cc
Go to the documentation of this file.
1 //
2 // Package: LogErrorHarvester
3 // Class: LogErrorHarvester
4 
13 //
14 // Original Author: Giovanni Petrucciani
15 // Created: Thu Dec 4 16:22:40 CET 2008
16 //
17 
18 // user include files
30 
31 // system include files
32 #include <memory>
33 #include <unordered_set>
34 #include <string>
35 
36 //
37 // class decleration
38 //
39 
40 namespace edm {
42  public:
43  explicit LogErrorHarvester(ParameterSet const&);
44  static void fillDescriptions(ConfigurationDescriptions& descriptions);
45 
46  private:
47  void beginJob() override;
48  void produce(StreamID, Event&, EventSetup const&) const override;
49  void endJob() override;
51  };
52 
53  LogErrorHarvester::LogErrorHarvester(ParameterSet const& iPSet) : token_{produces<std::vector<ErrorSummaryEntry>>()} {
54  const edm::TypeID endPathStatusType{typeid(edm::EndPathStatus)};
55  const edm::TypeID pathStatusType{typeid(edm::PathStatus)};
56  const edm::TypeID triggerResultsType{typeid(edm::TriggerResults)};
57 
58  auto const& ignore = iPSet.getUntrackedParameter<std::vector<std::string>>("excludeModules");
59  const std::unordered_set<std::string> excludedModules(ignore.begin(), ignore.end());
60 
61  auto const& includeM = iPSet.getUntrackedParameter<std::vector<std::string>>("includeModules");
62  const std::unordered_set<std::string> includeModules(includeM.begin(), includeM.end());
63 
64  //Need to be sure to run only after all other EDProducers have run
65  callWhenNewProductsRegistered(
66  [this, endPathStatusType, pathStatusType, triggerResultsType, excludedModules, includeModules](
67  edm::BranchDescription const& iBD) {
68  if ((iBD.branchType() == edm::InEvent and moduleDescription().processName() == iBD.processName()) and
69  ((includeModules.empty() or includeModules.end() != includeModules.find(iBD.moduleLabel())) and
70  (iBD.unwrappedTypeID() != endPathStatusType and iBD.unwrappedTypeID() != pathStatusType and
71  iBD.unwrappedTypeID() != triggerResultsType))) {
72  if (excludedModules.end() == excludedModules.find(iBD.moduleLabel())) {
75  }
76  }
77  });
78  }
79 
80  void LogErrorHarvester::produce(StreamID const sid, Event& iEvent, EventSetup const&) const {
81  const auto index = sid.value();
82  if (!FreshErrorsExist(index)) {
83  //puts a default constructed product in the event
84  iEvent.emplace(token_);
85  } else {
87  }
88  }
89 
90  // ------------ method called once each job just before starting event loop ------------
92 
93  // ------------ method called once each job just after ending the event loop ------------
95 
96  // ------------ method called once each job for validation ------------
99  desc.addUntracked<std::vector<std::string>>("excludeModules", std::vector<std::string>{})
100  ->setComment("List of module labels to exclude from consumes.");
101  desc.addUntracked<std::vector<std::string>>("includeModules", std::vector<std::string>{})
102  ->setComment("List of the only module labels to include in consumes. The empty list will include all.");
103  descriptions.add("logErrorHarvester", desc);
104  }
105 } // namespace edm
106 
107 //define this as a plug-in
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
edm::BranchDescription::productInstanceName
std::string const & productInstanceName() const
Definition: BranchDescription.h:81
edm::PRODUCT_TYPE
Definition: ProductKindOfType.h:5
TriggerResults.h
edm::LogErrorHarvester::token_
EDPutTokenT< std::vector< ErrorSummaryEntry > > token_
Definition: LogErrorHarvester.cc:50
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT
Definition: EDPutToken.h:33
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::EndPathStatus
Definition: EndPathStatus.h:5
EndPathStatus.h
LoggedErrorsSummary.h
edm::StreamID::value
unsigned int value() const
Definition: StreamID.h:43
edm::PathStatus
HLTPathStatus PathStatus
Definition: PathStatus.h:7
edm::DisableLoggedErrorsSummary
bool DisableLoggedErrorsSummary()
Definition: MessageSender.cc:154
MakerMacros.h
edm::LogErrorHarvester
Definition: LogErrorHarvester.cc:41
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::LogErrorHarvester::beginJob
void beginJob() override
Definition: LogErrorHarvester.cc:91
edm::LogErrorHarvester::endJob
void endJob() override
Definition: LogErrorHarvester.cc:94
edm::BranchDescription::unwrappedTypeID
TypeID unwrappedTypeID() const
Definition: BranchDescription.h:97
ErrorSummaryEntry.h
edm::InEvent
Definition: BranchType.h:11
ParameterSetDescription.h
edm::LogErrorHarvester::LogErrorHarvester
LogErrorHarvester(ParameterSet const &)
Definition: LogErrorHarvester.cc:53
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
edm::EnableLoggedErrorsSummary
bool EnableLoggedErrorsSummary()
Definition: MessageSender.cc:149
Event.h
PathStatus.h
edm::LogErrorHarvester::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: LogErrorHarvester.cc:97
EDPutToken.h
iEvent
int iEvent
Definition: GenABIO.cc:224
Reconstruction_cff.includeModules
includeModules
Definition: Reconstruction_cff.py:209
edm::BranchDescription::branchType
BranchType const & branchType() const
Definition: BranchDescription.h:121
edm::EventSetup
Definition: EventSetup.h:57
edm::LogErrorHarvester::produce
void produce(StreamID, Event &, EventSetup const &) const override
Definition: LogErrorHarvester.cc:80
edm::LoggedErrorsSummary
std::vector< ErrorSummaryEntry > LoggedErrorsSummary(unsigned int iStreamID)
Definition: MessageSender.cc:164
SequenceTypes.ignore
def ignore(seq)
Definition: SequenceTypes.py:630
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::TypeID
Definition: TypeID.h:22
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::BranchDescription
Definition: BranchDescription.h:32
edm::FreshErrorsExist
bool FreshErrorsExist(unsigned int iStreamID)
Definition: MessageSender.cc:159
EDProducer.h
edm::TypeToGet
Definition: TypeToGet.h:32
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition: HLTObjectsMonitor_cfi.py:9
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15