Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTD geometry, digitization, reconstruction and validation: technical cleaning of code #33374

Merged
merged 14 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using namespace cms;
class DD4hep_TestMTDIdealGeometry : public edm::one::EDAnalyzer<> {
public:
explicit DD4hep_TestMTDIdealGeometry(const edm::ParameterSet&);
~DD4hep_TestMTDIdealGeometry() = default;
~DD4hep_TestMTDIdealGeometry() override = default;

void beginJob() override {}
void analyze(edm::Event const&, edm::EventSetup const&) override;
Expand Down
17 changes: 9 additions & 8 deletions Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,25 @@ class TestMTDIdealGeometry : public edm::one::EDAnalyzer<> {
void theBaseNumber(const DDGeoHistory& gh);

private:
std::string label_;
int nNodes_;
std::string ddTopNodeName_;
uint32_t theLayout_;

MTDBaseNumber thisN_;
BTLNumberingScheme btlNS_;
ETLNumberingScheme etlNS_;

edm::ESGetToken<DDCompactView, IdealGeometryRecord> cpvToken_;
};

TestMTDIdealGeometry::TestMTDIdealGeometry(const edm::ParameterSet& iConfig)
: label_(iConfig.getUntrackedParameter<std::string>("label", "")),
ddTopNodeName_(iConfig.getUntrackedParameter<std::string>("ddTopNodeName", "BarrelTimingLayer")),
: ddTopNodeName_(iConfig.getUntrackedParameter<std::string>("ddTopNodeName", "BarrelTimingLayer")),
theLayout_(iConfig.getUntrackedParameter<uint32_t>("theLayout", 1)),
thisN_(),
btlNS_(),
etlNS_() {}
etlNS_() {
cpvToken_ = esConsumes<DDCompactView, IdealGeometryRecord>();
}

TestMTDIdealGeometry::~TestMTDIdealGeometry() {}

Expand All @@ -74,8 +76,7 @@ void TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::EventSet
return;
}

edm::ESTransientHandle<DDCompactView> pDD;
iSetup.get<IdealGeometryRecord>().get(label_, pDD);
auto pDD = iSetup.getTransientHandle(cpvToken_);

if (!pDD.isValid()) {
edm::LogError("TestMTDIdealGeometry") << "ESTransientHandle<DDCompactView> pDD is not valid!";
Expand Down Expand Up @@ -145,9 +146,9 @@ void TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::EventSet

bool isSens = false;

if (fv.geoHistory()[num - 1].logicalPart().specifics().size() > 0) {
if (!fv.geoHistory()[num - 1].logicalPart().specifics().empty()) {
for (auto vec : fv.geoHistory()[num - 1].logicalPart().specifics()) {
for (auto elem : *vec) {
for (const auto& elem : *vec) {
if (elem.second.name() == "SensitiveDetector") {
isSens = true;
break;
Expand Down
2 changes: 0 additions & 2 deletions Geometry/MTDCommonData/test/testMTDinDDD.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@
process.load('Configuration.Geometry.GeometryExtended2026D76_cff')

process.testBTL = cms.EDAnalyzer("TestMTDIdealGeometry",
label = cms.untracked.string(''),
ddTopNodeName = cms.untracked.string('BarrelTimingLayer'),
theLayout = cms.untracked.uint32(4)
)

process.testETL = cms.EDAnalyzer("TestMTDIdealGeometry",
label = cms.untracked.string(''),
ddTopNodeName = cms.untracked.string('EndcapTimingLayer'),
theLayout = cms.untracked.uint32(4)
)
Expand Down
11 changes: 8 additions & 3 deletions Geometry/MTDGeometryBuilder/test/MTDDigiGeometryAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class MTDDigiGeometryAnalyzer : public edm::one::EDAnalyzer<> {
public:
explicit MTDDigiGeometryAnalyzer(const edm::ParameterSet&) {}
explicit MTDDigiGeometryAnalyzer(const edm::ParameterSet&);
~MTDDigiGeometryAnalyzer() override = default;

void beginJob() override {}
Expand All @@ -42,17 +42,22 @@ class MTDDigiGeometryAnalyzer : public edm::one::EDAnalyzer<> {
void checkRotation(const GeomDetUnit& det);

std::stringstream sunitt;

edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> mtdgeoToken_;
};

using cms_rounding::roundIfNear0, cms_rounding::roundVecIfNear0;

MTDDigiGeometryAnalyzer::MTDDigiGeometryAnalyzer(const edm::ParameterSet& iConfig) {
mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
}

// ------------ method called to produce the data ------------
void MTDDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
//
// get the MTDGeometry
//
edm::ESHandle<MTDGeometry> pDD;
iSetup.get<MTDDigiGeometryRecord>().get(pDD);
auto pDD = iSetup.getTransientHandle(mtdgeoToken_);
edm::LogInfo("MTDDigiGeometryAnalyzer")
<< "Geometry node for MTDGeom is " << &(*pDD) << "\n"
<< " # detectors = " << pDD->detUnits().size() << "\n"
Expand Down
2 changes: 1 addition & 1 deletion Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CmsMTDStringToEnum::Impl::Impl() {
GeometricTimingDet::GeometricTimingEnumType CmsMTDStringToEnum::type(std::string const& s) const {
// remove namespace if present
std::string_view v = s;
auto first = v.find_first_of(":");
auto first = v.find_first_of(':');
v.remove_prefix(std::min(first + 1, v.size()));
MapEnumType::const_iterator p = map().find({v.data(), v.size()});
if (p != map().end())
Expand Down
27 changes: 0 additions & 27 deletions Geometry/MTDNumberingBuilder/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,4 @@
<flags EDM_PLUGIN="1"/>
</library>

<library name="MTDTopologyAnalyzer" file="MTDTopologyAnalyzer.cc">
<use name="DataFormats/ForwardDetId"/>
<use name="DetectorDescription/Core"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="Geometry/MTDCommonData"/>
<use name="Geometry/MTDNumberingBuilder"/>
<use name="Geometry/Records"/>
<use name="rootcling"/>
<flags EDM_PLUGIN="1"/>
</library>

<library name="DD4hep_MTDTopologyAnalyzer" file="DD4hep_MTDTopologyAnalyzer.cc">
<use name="DataFormats/ForwardDetId"/>
<use name="DetectorDescription/DDCMS"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="Geometry/MTDCommonData"/>
<use name="Geometry/MTDNumberingBuilder"/>
<use name="Geometry/Records"/>
<use name="dd4hep"/>
<use name="rootcling"/>
<flags EDM_PLUGIN="1"/>
</library>

<test name="GeometryMTDNumberingBuilderTestDriver" command="runTest.sh"/>
225 changes: 0 additions & 225 deletions Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc

This file was deleted.

Loading