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 void DTGeometryTest::analyze(const Event&, const EventSetup& iEventSetup) {
34  LogVerbatim("DTGeometryTest") << "DTGeometryTest::analyze: " << m_label;
36 
37  LogVerbatim("DTGeometryTest") << " Geometry node for DTGeom is " << (pDD.isValid() ? "valid" : "not valid");
38  LogVerbatim("DTGeometryTest") << " I have " << pDD->detTypes().size() << " detTypes";
39  LogVerbatim("DTGeometryTest") << " I have " << pDD->detUnits().size() << " detUnits";
40  LogVerbatim("DTGeometryTest") << " I have " << pDD->dets().size() << " dets";
41  LogVerbatim("DTGeometryTest") << " I have " << pDD->layers().size() << " layers";
42  LogVerbatim("DTGeometryTest") << " I have " << pDD->superLayers().size() << " superlayers";
43  LogVerbatim("DTGeometryTest") << " I have " << pDD->chambers().size() << " chambers";
44 
45  // check chamber
46  LogVerbatim("DTGeometryTest") << "CHAMBERS " << string(120, '-');
47 
48  LogVerbatim("DTGeometryTest").log([&](auto& log) {
49  for (auto det : pDD->chambers()) {
50  const BoundPlane& surf = det->surface();
51  log << "Chamber " << det->id() << " Position " << surf.position() << " normVect " << surf.normalVector()
52  << " bounds W/H/L: " << surf.bounds().width() << "/" << surf.bounds().thickness() << "/"
53  << surf.bounds().length() << "\n";
54  }
55  });
56  LogVerbatim("DTGeometryTest") << "END " << string(120, '-');
57 
58  // check superlayers
59  LogVerbatim("DTGeometryTest") << "SUPERLAYERS " << string(120, '-');
60  LogVerbatim("DTGeometryTest").log([&](auto& log) {
61  for (auto det : pDD->superLayers()) {
62  const BoundPlane& surf = det->surface();
63  log << "SuperLayer " << det->id() << " chamber " << det->chamber()->id() << " Position " << surf.position()
64  << " normVect " << surf.normalVector() << " bounds W/H/L: " << surf.bounds().width() << "/"
65  << surf.bounds().thickness() << "/" << surf.bounds().length() << "\n";
66  }
67  });
68  LogVerbatim("DTGeometryTest") << "END " << string(120, '-');
69 
70  // check layers
71  LogVerbatim("DTGeometryTest") << "LAYERS " << string(120, '-');
72 
73  LogVerbatim("DTGeometryTest").log([&](auto& log) {
74  for (auto det : pDD->layers()) {
75  const DTTopology& topo = det->specificTopology();
76  const BoundPlane& surf = det->surface();
77  log << "Layer " << det->id() << " SL " << det->superLayer()->id() << " chamber " << det->chamber()->id()
78  << " Topology W/H/L: " << topo.cellWidth() << "/" << topo.cellHeight() << "/" << topo.cellLenght()
79  << " first/last/# wire " << topo.firstChannel() << "/" << topo.lastChannel() << "/" << topo.channels()
80  << " Position " << surf.position() << " normVect " << surf.normalVector()
81  << " bounds W/H/L: " << surf.bounds().width() << "/" << surf.bounds().thickness() << "/"
82  << surf.bounds().length() << "\n";
83  }
84  });
85  LogVerbatim("DTGeometryTest") << "END " << string(120, '-');
86 }
87 
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:69
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:79
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:81
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:71
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: DTGeometry.cc:61
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:63
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
HLT enums.
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:152
void beginJob() override
void endJob() override
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > m_token
bool isValid() const
Definition: ESHandle.h:44
float cellLenght() const
Definition: DTTopology.h:74
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:37
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86
DTGeometryTest(const ParameterSet &)