CMS 3D CMS Logo

WhatsItWatcherAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: WhatsItWatcherAnalyzer
4 // Class: WhatsItWatcherAnalyzer
5 //
13 //
14 // Original Author: Chris Jones
15 // Created: Fri Jun 24 19:13:25 EDT 2005
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 #include <iostream>
22 
23 // user include files
25 
27 
28 #include "WhatsIt.h"
29 #include "GadgetRcd.h"
30 
32 
34 
35 //
36 // class decleration
37 //
38 
39 namespace edmtest {
40 
42  public:
44 
45  void analyze(const edm::Event&, const edm::EventSetup&) override;
46 
47  private:
48  // ----------member data ---------------------------
49  void watch1(const GadgetRcd&);
50  void watch2(const GadgetRcd&);
51 
55 
57  };
58 
59  //
60  // constants, enums and typedefs
61  //
62 
63  //
64  // static data member definitions
65  //
66 
67  //
68  // constructors and destructor
69  //
71  : watch1_(this, &WhatsItWatcherAnalyzer::watch1),
72  watch2_(std::bind(&WhatsItWatcherAnalyzer::watch2, this, std::placeholders::_1)),
73  watchBool_(),
74  token_(esConsumes()) {
75  //now do what ever initialization is needed
76  }
77 
78  //
79  // member functions
80  //
81 
82  // ------------ method called to produce the data ------------
83  void WhatsItWatcherAnalyzer::analyze(const edm::Event& /*iEvent*/, const edm::EventSetup& iSetup) {
84  bool w1 = watch1_.check(iSetup);
85  bool w2 = watch2_.check(iSetup);
86  bool w3 = watchBool_.check(iSetup);
87  assert(w1 == w2);
88  assert(w2 == w3);
89  }
90 
93 
94  std::cout << "watch1: WhatsIt " << pSetup->a << " changed" << std::endl;
95  }
96 
99 
100  std::cout << "watch2: WhatsIt " << pSetup->a << " changed" << std::endl;
101  }
102 
103 } // namespace edmtest
104 using namespace edmtest;
105 //define this as a plug-in
edm::ESWatcher< GadgetRcd > watchBool_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
edm::ESGetToken< edmtest::WhatsIt, GadgetRcd > token_
assert(be >=bs)
void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ESHandle< PRODUCT > getHandle(ESGetToken< PRODUCT, T > const &iToken) const
edm::ESWatcher< GadgetRcd > watch1_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
common ppss p3p6s2 common epss epspn46 common const1 w3
Definition: inclppp.h:1
WhatsItWatcherAnalyzer(const edm::ParameterSet &)
edm::ESWatcher< GadgetRcd > watch2_