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
51
52
53
54
55
56
57
58
59
|
#ifndef CalibTracker_SiStripESProducer_DummyCondObjPrinter_h
#define CalibTracker_SiStripESProducer_DummyCondObjPrinter_h
// user include files
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include <string>
template <typename TObject, typename TRecord>
class DummyCondObjPrinter : public edm::one::EDAnalyzer<> {
public:
explicit DummyCondObjPrinter(const edm::ParameterSet& iConfig);
~DummyCondObjPrinter() override;
void analyze(const edm::Event& e, const edm::EventSetup& es) override;
private:
edm::ParameterSet iConfig_;
edm::ESWatcher<TRecord> watcher_;
edm::ESGetToken<TObject, TRecord> token_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
};
template <typename TObject, typename TRecord>
DummyCondObjPrinter<TObject, TRecord>::DummyCondObjPrinter(const edm::ParameterSet& iConfig)
: iConfig_(iConfig), token_(esConsumes()), tTopoToken_(esConsumes()) {
edm::LogInfo("DummyCondObjPrinter") << "DummyCondObjPrinter constructor for typename " << typeid(TObject).name()
<< " and record " << typeid(TRecord).name() << std::endl;
}
template <typename TObject, typename TRecord>
DummyCondObjPrinter<TObject, TRecord>::~DummyCondObjPrinter() {
edm::LogInfo("DummyCondObjPrinter") << "DummyCondObjPrinter::~DummyCondObjPrinter()" << std::endl;
}
template <typename TObject, typename TRecord>
void DummyCondObjPrinter<TObject, TRecord>::analyze(const edm::Event& e, const edm::EventSetup& es) {
if (!watcher_.check(es))
return;
const auto& esobj = es.getData(token_);
const auto tTopo = &es.getData(tTopoToken_);
std::stringstream sSummary, sDebug;
esobj.printSummary(sSummary, tTopo);
esobj.printDebug(sDebug, tTopo);
// edm::LogInfo("DummyCondObjPrinter") << "\nPrintSummary \n" << sSummary.str() << std::endl;
// edm::LogWarning("DummyCondObjPrinter") << "\nPrintDebug \n" << sDebug.str() << std::endl;
edm::LogPrint("DummyCondObjContentPrinter") << "\nPrintSummary \n" << sSummary.str() << std::endl;
edm::LogVerbatim("DummyCondObjContentPrinter") << "\nPrintDebug \n" << sDebug.str() << std::endl;
}
#endif
|