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 
54  token_{produces<std::vector<ErrorSummaryEntry>>()}
55  {
56 
57 
58  const edm::TypeID endPathStatusType{typeid(edm::EndPathStatus)};
59  const edm::TypeID pathStatusType{typeid(edm::PathStatus)};
60  const edm::TypeID triggerResultsType{typeid(edm::TriggerResults)};
61 
62  auto const& ignore = iPSet.getUntrackedParameter<std::vector<std::string>>("excludeModules");
63  const std::unordered_set<std::string> excludedModules(ignore.begin(),ignore.end());
64 
65  auto const& includeM = iPSet.getUntrackedParameter<std::vector<std::string>>("includeModules");
66  const std::unordered_set<std::string> includeModules(includeM.begin(),includeM.end());
67 
68  //Need to be sure to run only after all other EDProducers have run
70  endPathStatusType,pathStatusType,triggerResultsType,
71  excludedModules, includeModules](edm::BranchDescription const& iBD)
72  {
73  if((iBD.branchType() == edm::InEvent and moduleDescription().processName() == iBD.processName()) and
74  ( (includeModules.empty() or
75  includeModules.end() != includeModules.find(iBD.moduleLabel())) and
76  (iBD.unwrappedTypeID() != endPathStatusType and
77  iBD.unwrappedTypeID() != pathStatusType and
78  iBD.unwrappedTypeID() != triggerResultsType))) {
79  if(excludedModules.end() == excludedModules.find(iBD.moduleLabel())) {
82  iBD.productInstanceName(),
83  iBD.processName()});
84  }
85  }
86  });
87  }
88 
89  void
91  const auto index = sid.value();
92  if(!FreshErrorsExist(index)) {
93  //puts a default constructed product in the event
94  iEvent.emplace(token_);
95  } else {
97  }
98  }
99 
100  // ------------ method called once each job just before starting event loop ------------
101  void
104  }
105 
106  // ------------ method called once each job just after ending the event loop ------------
107  void
110  }
111 
112 
113  // ------------ method called once each job for validation ------------
114  void
117  desc.addUntracked<std::vector<std::string>>("excludeModules",std::vector<std::string>{})->setComment("List of module labels to exclude from consumes.");
118  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.");
119  descriptions.add("logErrorHarvester", desc);
120  }
121 }
122 
123 //define this as a plug-in
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:76
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
#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
EDPutTokenT< std::vector< ErrorSummaryEntry > > token_
def ignore(seq)
unsigned int value() const
Definition: StreamID.h:46
ModuleDescription const & moduleDescription() const
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:453
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 &)