1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#ifndef CommonTools_UtilAlgos_DummySelector_h
#define CommonTools_UtilAlgos_DummySelector_h
/* \class DummySelector
*
* Dummy generic selector following the
* interface proposed in the document:
*
* https://twiki.cern.ch/twiki/bin/view/CMS/SelectorInterface
*
* \author Luca Lista, INFN
*/
#include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
namespace edm {
class ParameterSet;
class Event;
class EventSetup;
} // namespace edm
class DummySelector {
public:
explicit DummySelector(const edm::ParameterSet&, edm::ConsumesCollector& iC) : updated_(false) {}
void newEvent(const edm::Event&, const edm::EventSetup&) { updated_ = true; }
template <typename T>
bool operator()(const T&) {
if (!updated_)
throw edm::Exception(edm::errors::Configuration) << "DummySelector: forgot to call newEvent\n";
return true;
}
static void fillPSetDescription(edm::ParameterSetDescription& desc) {}
private:
bool updated_;
};
namespace dummy {
template <typename T>
inline bool select(const T&) {
return true;
}
} // namespace dummy
EVENTSETUP_STD_INIT(DummySelector);
#endif
|