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
29 
30 // system include files
31 #include <memory>
32 #include <unordered_set>
33 #include <string>
34 
35 //
36 // class decleration
37 //
38 
39 namespace edm {
41  public:
42  explicit LogErrorHarvester(ParameterSet const&);
43  static void fillDescriptions(ConfigurationDescriptions& descriptions);
44 
45  private:
46  void beginJob() override;
47  void produce(StreamID, Event&, EventSetup const&) const override;
48  void endJob() override;
49 
50  };
51 
53 
54  produces<std::vector<ErrorSummaryEntry>>();
55 
56  const edm::TypeID endPathStatusType{typeid(edm::EndPathStatus)};
57  const edm::TypeID pathStatusType{typeid(edm::PathStatus)};
58  const edm::TypeID triggerResultsType{typeid(edm::TriggerResults)};
59 
60  auto const& ignore = iPSet.getUntrackedParameter<std::vector<std::string>>("excludeModules");
61  const std::unordered_set<std::string> excludedModules(ignore.begin(),ignore.end());
62 
63  auto const& includeM = iPSet.getUntrackedParameter<std::vector<std::string>>("includeModules");
64  const std::unordered_set<std::string> includeModules(includeM.begin(),includeM.end());
65 
66  //Need to be sure to run only after all other EDProducers have run
68  endPathStatusType,pathStatusType,triggerResultsType,
69  excludedModules, includeModules](edm::BranchDescription const& iBD)
70  {
71  if((iBD.branchType() == edm::InEvent and moduleDescription().processName() == iBD.processName()) and
72  ( (includeModules.empty() or
73  includeModules.end() != includeModules.find(iBD.moduleLabel())) and
74  (iBD.unwrappedTypeID() != endPathStatusType and
75  iBD.unwrappedTypeID() != pathStatusType and
76  iBD.unwrappedTypeID() != triggerResultsType))) {
77  if(excludedModules.end() == excludedModules.find(iBD.moduleLabel())) {
80  iBD.productInstanceName(),
81  iBD.processName()});
82  }
83  }
84  });
85  }
86 
87  void
89  const auto index = sid.value();
90  if(!FreshErrorsExist(index)) {
91  iEvent.put(std::make_unique<std::vector<ErrorSummaryEntry>>());
92  } else {
93  iEvent.put(std::make_unique<std::vector<ErrorSummaryEntry>>(LoggedErrorsSummary(index)));
94  }
95  }
96 
97  // ------------ method called once each job just before starting event loop ------------
98  void
101  }
102 
103  // ------------ method called once each job just after ending the event loop ------------
104  void
107  }
108 
109 
110  // ------------ method called once each job for validation ------------
111  void
114  desc.addUntracked<std::vector<std::string>>("excludeModules",std::vector<std::string>{})->setComment("List of module labels to exclude from consumes.");
115  desc.addUntracked<std::vector<std::string>>("includeModules",std::vector<std::string>{})->setComment("List of the only module labels to include in consumes. The empty list will include all.");
116  descriptions.add("logErrorHarvester", desc);
117  }
118 }
119 
120 //define this as a plug-in
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:76
T getUntrackedParameter(std::string const &, T const &) const
static void fillDescriptions(ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::string const & processName() const
bool FreshErrorsExist(unsigned int iStreamID)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool DisableLoggedErrorsSummary()
int iEvent
Definition: GenABIO.cc:230
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
def ignore(seq)
unsigned int value() const
Definition: StreamID.h:46
ModuleDescription const & moduleDescription() const
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 &)