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
|
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/Records/interface/DDSpecParRegistryRcd.h"
#include <DD4hep/SpecParRegistry.h>
#include <iostream>
using namespace std;
using namespace cms;
using namespace edm;
class DDTestSpecPars : public global::EDAnalyzer<> {
public:
explicit DDTestSpecPars(const ParameterSet& iConfig)
: m_tag(iConfig.getParameter<ESInputTag>("DDDetector")), m_token(esConsumes(m_tag)) {}
void beginJob() override {}
void analyze(StreamID, Event const& iEvent, EventSetup const&) const override;
void endJob() override {}
private:
const ESInputTag m_tag;
const ESGetToken<dd4hep::SpecParRegistry, DDSpecParRegistryRcd> m_token;
};
void DDTestSpecPars::analyze(StreamID, const Event&, const EventSetup& iEventSetup) const {
ESTransientHandle<dd4hep::SpecParRegistry> registry = iEventSetup.getTransientHandle(m_token);
LogVerbatim("Geometry").log([®istry, this](auto& log) {
log << "DDTestSpecPars::analyze: " << m_tag;
log << "DD SpecPar Registry size: " << registry->specpars.size();
for (const auto& i : registry->specpars) {
log << " " << i.first << " =>";
log << "\npaths:\n";
for (const auto& k : i.second.paths)
log << k << ", ";
log << "\nstring parameters:\n";
for (const auto& l : i.second.spars) {
log << l.first << " == " << i.second.strValue(l.first) << " = ";
for (const auto& il : l.second) {
log << il << ", ";
}
}
log << "\nnumeric parameters\n";
for (const auto& m : i.second.numpars) {
log << m.first << " => ";
for (const auto& im : m.second) {
log << im << ", ";
}
}
log << '\n';
}
});
}
DEFINE_FWK_MODULE(DDTestSpecPars);
|