CMS 3D CMS Logo

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