CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventWithHistoryEDFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripTools
4 // Class: EventWithHistoryEDFilter
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Tue Dec 9 18:33:42 CET 2008
16 // $Id: EventWithHistoryEDFilter.cc,v 1.3 2010/01/12 09:13:04 venturia Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 #include <vector>
25 // user include files
28 
34 
37 
39 
40 //
41 // class declaration
42 //
43 
45 public:
48 
49 private:
50 
51  virtual void beginJob() override ;
52  virtual bool filter(edm::Event&, const edm::EventSetup&) override;
53  virtual void endJob() override ;
54 
55  // ----------member data ---------------------------
56 
57  std::vector<EventWithHistoryFilter> _ehfilters;
58  bool _debu;
59 };
60 
61 //
62 // constants, enums and typedefs
63 //
64 
65 //
66 // static data member definitions
67 //
68 
69 //
70 // constructors and destructor
71 //
73  _ehfilters(),
74  _debu(iConfig.getUntrackedParameter<bool>("debugPrint",false))
75 {
76  //now do what ever initialization is needed
77 
78  std::vector<edm::ParameterSet> filterconfigs(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >
79  ("filterConfigurations",std::vector<edm::ParameterSet>()));
80 
81  for(std::vector<edm::ParameterSet>::iterator ps=filterconfigs.begin();
82  ps!=filterconfigs.end();++ps) {
83 
84  ps->augment(iConfig.getUntrackedParameter<edm::ParameterSet>("commonConfiguration",edm::ParameterSet()));
85 
87  _ehfilters.push_back(filter);
88 
89  }
90 
91 
92 }
93 
94 
96 {
97 
98  // do anything here that needs to be done at desctruction time
99  // (e.g. close files, deallocate resources etc.)
100 
101 }
102 
103 
104 //
105 // member functions
106 //
107 
108 // ------------ method called on each new Event ------------
109 bool
111 {
112 
113  bool selected = false;
114 
115  for(std::vector<EventWithHistoryFilter>::const_iterator filter=_ehfilters.begin();
116  filter!=_ehfilters.end();++filter) {
117 
118  selected = selected || filter->selected(iEvent,iSetup);
119 
120  }
121 
122  if(_debu && selected ) edm::LogInfo("SELECTED") << "selected event";
123 
124  return selected;
125 
126 }
127 
128 // ------------ method called once each job just before starting event loop ------------
129 void
131 {}
132 
133 // ------------ method called once each job just after ending the event loop ------------
134 void
136 }
137 
138 //define this as a plug-in
T getUntrackedParameter(std::string const &, T const &) const
virtual void endJob() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EventWithHistoryEDFilter(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:230
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< EventWithHistoryFilter > _ehfilters
virtual bool filter(edm::Event &, const edm::EventSetup &) override
virtual void beginJob() override
volatile std::atomic< bool > shutdown_flag false