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", "")),
33  m_token(esConsumes<DTGeometry, MuonGeometryRecord>(edm::ESInputTag{"", m_label})) {}
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 
DTGeometry
Definition: DTGeometry.h:28
EDAnalyzer.h
edm::ESInputTag
Definition: ESInputTag.h:87
ESTransientHandle.h
MessageLogger.h
DTGeometryTest::m_token
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > m_token
Definition: DTGeometryTest.cc:28
cms_rounding::roundVecIfNear0
constexpr valType roundVecIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
Rounding.h
DTTopology::channels
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
DTTopology::cellWidth
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:69
DTTopology
Definition: DTTopology.h:28
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
DTTopology::firstChannel
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:79
DTGeometry::layers
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
DTGeometry::chambers
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
DTGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DTGeometry.cc:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTGeometryTest
Definition: DTGeometryTest.cc:18
DTGeometry.h
DTTopology::cellLenght
float cellLenght() const
Definition: DTTopology.h:74
DTGeometryTest::analyze
void analyze(Event const &iEvent, EventSetup const &) override
Definition: DTGeometryTest.cc:35
DTGeometryTest::m_label
const string m_label
Definition: DTGeometryTest.cc:27
edm::ParameterSet
Definition: ParameterSet.h:36
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogVerbatim::log
LogVerbatim & log(F &&iF)
Definition: MessageLogger.h:327
DTGeometry::superLayers
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86
edm::LogVerbatim
Definition: MessageLogger.h:297
cms_rounding
Definition: Rounding.h:8
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:57
DTGeometryTest::endJob
void endJob() override
Definition: DTGeometryTest.cc:24
edm::EventSetup::getTransientHandle
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:152
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
edm::ESGetToken< DTGeometry, MuonGeometryRecord >
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
DTTopology::lastChannel
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:81
DTTopology::cellHeight
float cellHeight() const
Returns the cell height.
Definition: DTTopology.h:71
DTGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: DTGeometry.cc:61
std
Definition: JetResolutionObject.h:76
BoundPlane
EventSetup.h
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
DTGeometryTest::beginJob
void beginJob() override
Definition: DTGeometryTest.cc:22
MuonGeometryRecord.h
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTGeometryTest::DTGeometryTest
DTGeometryTest(const ParameterSet &)
Definition: DTGeometryTest.cc:31
DTGeometry::detTypes
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:37
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21