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
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
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:79
static void fillDescriptions(ConfigurationDescriptions &descriptions)
BranchType const & branchType() const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void produce(StreamID, Event &, EventSetup const &) const override
bool EnableLoggedErrorsSummary()
std::string const & processName() const
std::string const & processName() const
bool FreshErrorsExist(unsigned int iStreamID)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool DisableLoggedErrorsSummary()
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string const & moduleLabel() const
std::string const & productInstanceName() const
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
TypeID unwrappedTypeID() const
EDPutTokenT< std::vector< ErrorSummaryEntry > > token_
def ignore(seq)
unsigned int value() const
Definition: StreamID.h:42
ModuleDescription const & moduleDescription() const
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:421
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
std::vector< ErrorSummaryEntry > LoggedErrorsSummary(unsigned int iStreamID)
HLTPathStatus PathStatus
Definition: PathStatus.h:7
LogErrorHarvester(ParameterSet const &)