CMS 3D CMS Logo

DTGeometryTest.cc
Go to the documentation of this file.
8 
9 #include <iostream>
10 #include <string>
11 
12 using namespace std;
13 using namespace cms;
14 using namespace edm;
15 
16 class DTGeometryTest : public one::EDAnalyzer<> {
17 public:
18  explicit DTGeometryTest(const ParameterSet&);
19 
20  void beginJob() override {}
21  void analyze(Event const& iEvent, EventSetup const&) override;
22  void endJob() override {}
23 
24 private:
25  const string m_label;
27 };
28 
30  : m_label(iConfig.getUntrackedParameter<string>("fromDataLabel", "")),
31  m_token(esConsumes<DTGeometry, MuonGeometryRecord>(edm::ESInputTag{"", m_label}))
32 {}
33 
34 void
35 DTGeometryTest::analyze(const Event&, const EventSetup& iEventSetup)
36 {
37  LogVerbatim("Geometry") << "DTGeometryTest::analyze: " << m_label;
39 
40  LogVerbatim("Geometry") << " Geometry node for DTGeom is " << &(*pDD);
41  LogVerbatim("Geometry") << " I have " << pDD->detTypes().size() << " detTypes";
42  LogVerbatim("Geometry") << " I have " << pDD->detUnits().size() << " detUnits";
43  LogVerbatim("Geometry") << " I have " << pDD->dets().size() << " dets";
44  LogVerbatim("Geometry") << " I have " << pDD->layers().size() << " layers";
45  LogVerbatim("Geometry") << " I have " << pDD->superLayers().size() << " superlayers";
46  LogVerbatim("Geometry") << " I have " << pDD->chambers().size() << " chambers";
47 
48  // check chamber
49  LogVerbatim("Geometry") << "CHAMBERS " << string(120, '-');
50 
51  LogVerbatim("Geometry").log([&](auto& log) {
52  for(auto det : pDD->chambers()){
53  const BoundPlane& surf = det->surface();
54  log << "Chamber " << det->id()
55  << " Position " << surf.position()
56  << " normVect " << surf.normalVector()
57  << " bounds W/H/L: " << surf.bounds().width() << "/"
58  << surf.bounds().thickness() << "/" << surf.bounds().length() << "\n";
59  }
60  });
61  LogVerbatim("Geometry") << "END " << string(120, '-');
62 
63  // check superlayers
64  LogVerbatim("Geometry") << "SUPERLAYERS " << string(120, '-');
65  LogVerbatim("Geometry").log([&](auto& log) {
66  for(auto det : pDD->superLayers()) {
67  const BoundPlane& surf = det->surface();
68  log << "SuperLayer " << det->id()
69  << " chamber " << det->chamber()->id()
70  << " Position " << surf.position()
71  << " normVect " << surf.normalVector()
72  << " bounds W/H/L: " << surf.bounds().width() << "/"
73  << surf.bounds().thickness() << "/" << surf.bounds().length() << "\n";
74  }
75  });
76  LogVerbatim("Geometry") << "END " << string(120, '-');
77 
78  // check layers
79  LogVerbatim("Geometry") << "LAYERS " << string(120, '-');
80 
81  LogVerbatim("Geometry").log([&](auto& log) {
82  for(auto det : pDD->layers()){
83  const DTTopology& topo = det->specificTopology();
84  const BoundPlane& surf=det->surface();
85  log << "Layer " << det->id() << " SL " << det->superLayer()->id()
86  << " chamber " << det->chamber()->id()
87  << " Topology W/H/L: "
88  << topo.cellWidth() << "/" << topo.cellHeight() << "/" << topo.cellLenght()
89  << " first/last/# wire " << topo.firstChannel() << "/" << topo.lastChannel() << "/" << topo.channels()
90  << " Position " << surf.position()
91  << " normVect " << surf.normalVector()
92  << " bounds W/H/L: " << surf.bounds().width() << "/"
93  << surf.bounds().thickness() << "/" << surf.bounds().length() << "\n";
94  }
95  });
96  LogVerbatim("Geometry") << "END " << string(120, '-');
97 }
98 
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:102
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:68
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:78
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:80
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(Event const &iEvent, EventSetup const &) override
LogVerbatim & log(F &&iF)
float cellHeight() const
Returns the cell height.
Definition: DTTopology.h:70
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: DTGeometry.cc:66
const string m_label
Namespace of DDCMS conversion namespace.
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DTGeometry.cc:71
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:75
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:112
HLT enums.
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:150
void beginJob() override
void endJob() override
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > m_token
float cellLenght() const
Definition: DTTopology.h:73
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:38
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:107
DTGeometryTest(const ParameterSet &)