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
Update of the DT migration to DD4HEP #31043
Changes from all commits
1b97ff0
38df270
bf86d1c
b897cf6
8baa5ba
37be5c6
fb3e0e6
74fabcd
da18b85
544b4dd
4a6eeab
b347b41
86c028e
2d3b727
278777a
7a02584
57b6f2f
94fbdcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,11 +82,13 @@ class DTGeometryValidate : public one::EDAnalyzer<> { | |
|
||
DTGeometryValidate::DTGeometryValidate(const edm::ParameterSet& iConfig) | ||
: dtGeometryToken_{esConsumes<DTGeometry, MuonGeometryRecord>(edm::ESInputTag{})}, | ||
infileName_(iConfig.getUntrackedParameter<string>("infileName", "cmsGeom10.root")), | ||
infileName_( | ||
iConfig.getUntrackedParameter<string>("infileName", "Geometry/DTGeometryBuilder/data/cmsRecoGeom-2021.root")), | ||
outfileName_(iConfig.getUntrackedParameter<string>("outfileName", "validateDTGeometry.root")), | ||
tolerance_(iConfig.getUntrackedParameter<int>("tolerance", 6)) { | ||
fwGeometry_.loadMap(infileName_.c_str()); | ||
outFile_ = new TFile(outfileName_.c_str(), "RECREATE"); | ||
edm::FileInPath fp(infileName_.c_str()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is |
||
fwGeometry_.loadMap(fp.fullPath().c_str()); | ||
outFile_ = TFile::Open(outfileName_.c_str(), "RECREATE"); | ||
} | ||
|
||
void DTGeometryValidate::analyze(const edm::Event& event, const edm::EventSetup& eventSetup) { | ||
|
@@ -95,7 +97,6 @@ void DTGeometryValidate::analyze(const edm::Event& event, const edm::EventSetup& | |
if (dtGeometry_.isValid()) { | ||
LogVerbatim("DTGeometry") << "Validating DT chamber geometry"; | ||
validateDTChamberGeometry(); | ||
|
||
LogVerbatim("DTGeometry") << "Validating DT layer geometry"; | ||
validateDTLayerGeometry(); | ||
} else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
// | ||
// Original Author: Ianna Osborne | ||
// Created: Wed, 16 Jan 2019 10:19:37 GMT | ||
// Modified by Sergio Lo Meo (sergio.lo.meo@cern.ch) Mon, 31 August 2020 | ||
// | ||
// | ||
#include "CondFormats/GeometryObjects/interface/RecoIdealGeometry.h" | ||
|
@@ -27,7 +28,6 @@ | |
#include "DataFormats/GeometrySurface/interface/Plane.h" | ||
#include "DataFormats/GeometrySurface/interface/Bounds.h" | ||
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h" | ||
|
||
#include "FWCore/Framework/interface/ESTransientHandle.h" | ||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/Framework/interface/ESProducer.h" | ||
|
@@ -36,7 +36,8 @@ | |
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/ESGetToken.h" | ||
#include "FWCore/Utilities/interface/ReusableObjectHolder.h" | ||
#include "Geometry/MuonNumbering/interface/DD4hep_MuonNumbering.h" | ||
#include "Geometry/MuonNumbering/interface/MuonGeometryNumbering.h" | ||
#include "Geometry/MuonNumbering/interface/MuonGeometryConstants.h" | ||
#include "Geometry/Records/interface/MuonNumberingRecord.h" | ||
#include "Geometry/Records/interface/MuonGeometryRecord.h" | ||
#include "Geometry/Records/interface/DDSpecParRegistryRcd.h" | ||
|
@@ -78,7 +79,7 @@ class DTGeometryESProducer : public ESProducer { | |
edm::ESGetToken<Alignments, GlobalPositionRcd> m_globalPositionToken; | ||
edm::ESGetToken<Alignments, DTAlignmentRcd> m_alignmentsToken; | ||
edm::ESGetToken<AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd> m_alignmentErrorsToken; | ||
edm::ESGetToken<MuonNumbering, MuonNumberingRecord> m_mdcToken; | ||
edm::ESGetToken<MuonGeometryConstants, IdealGeometryRecord> m_mdcToken; | ||
edm::ESGetToken<DDDetector, IdealGeometryRecord> m_cpvToken; | ||
edm::ESGetToken<DDSpecParRegistry, DDSpecParRegistryRcd> m_registryToken; | ||
const ESInputTag m_tag; | ||
|
@@ -109,7 +110,7 @@ DTGeometryESProducer::DTGeometryESProducer(const ParameterSet& iConfig) | |
} | ||
|
||
if (m_fromDDD) { | ||
m_mdcToken = cc.consumesFrom<MuonNumbering, MuonNumberingRecord>(edm::ESInputTag{}); | ||
m_mdcToken = cc.consumesFrom<MuonGeometryConstants, IdealGeometryRecord>(edm::ESInputTag{}); | ||
m_cpvToken = cc.consumesFrom<DDDetector, IdealGeometryRecord>(m_tag); | ||
m_registryToken = cc.consumesFrom<DDSpecParRegistry, DDSpecParRegistryRcd>(m_tag); | ||
} | ||
|
@@ -133,19 +134,15 @@ std::shared_ptr<DTGeometry> DTGeometryESProducer::produce(const MuonGeometryReco | |
host->ifRecordChanges<DTRecoGeometryRcd>(record, [this, &host](auto const& rec) { setupDBGeometry(rec, host); }); | ||
} | ||
} | ||
// | ||
// Called whenever the alignments or alignment errors change | ||
// | ||
|
||
if (m_applyAlignment) { | ||
// m_applyAlignment is scheduled for removal. | ||
// Ideal geometry obtained by using 'fake alignment' (with m_applyAlignment = true) | ||
edm::ESHandle<Alignments> globalPosition; | ||
record.getRecord<GlobalPositionRcd>().get(m_alignmentsLabel, globalPosition); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sidetracking a bit, but I want to note that these calls need to be changed to use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
edm::ESHandle<Alignments> alignments; | ||
record.getRecord<DTAlignmentRcd>().get(m_alignmentsLabel, alignments); | ||
edm::ESHandle<AlignmentErrorsExtended> alignmentErrors; | ||
record.getRecord<DTAlignmentErrorExtendedRcd>().get(m_alignmentsLabel, alignmentErrors); | ||
// Only apply alignment if values exist | ||
|
||
if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) { | ||
edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce" | ||
<< "Alignment(Error)s and global position (label '" << m_alignmentsLabel | ||
|
@@ -160,7 +157,7 @@ std::shared_ptr<DTGeometry> DTGeometryESProducer::produce(const MuonGeometryReco | |
} | ||
} | ||
|
||
return host; // automatically converts to std::shared_ptr<DTGeometry> | ||
return host; | ||
} | ||
|
||
void DTGeometryESProducer::setupGeometry(const MuonNumberingRecord& record, shared_ptr<HostType>& host) { | ||
|
@@ -184,10 +181,8 @@ void DTGeometryESProducer::setupGeometry(const MuonNumberingRecord& record, shar | |
|
||
void DTGeometryESProducer::setupDBGeometry(const DTRecoGeometryRcd& record, std::shared_ptr<HostType>& host) { | ||
// host->clear(); | ||
|
||
// edm::ESHandle<RecoIdealGeometry> rig; | ||
// record.get(rig); | ||
|
||
// DTGeometryBuilderFromCondDB builder; | ||
// builder.build(host, *rig); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use FileInPath to get the file e.g. for python module you need to do something like
cmssw/CalibCalorimetry/HcalPlugins/python/Hcal_FakeConditions_cff.py
Line 13 in 02d4198
and from cc code you can do something like
cmssw/DetectorDescription/Core/test/DDIsValid.cppunit.cc
Line 172 in 0f58e36
OR
cmssw/RecoLocalMuon/GEMRecHit/plugins/GEMRecHitProducer.cc
Line 37 in ed1b002
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smuzaffar : I modified the constructor of the DTGeometryValidate.cc in this way:
..
edm::FileInPath fp("Geometry/DTGeometryBuilder/data/cmsRecoGeom-2021.root"); fwGeometry_.loadMap(fp.fullPath().c_str());
instead of
...
iConfig.getUntrackedParameter("infileName", "Geometry/DTGeometryBuilder/data/cmsRecoGeom-2021.root"))
....
fwGeometry_.loadMap(infileName_.c_str());
The compilation is ok, but when I run: "cmsRun Geometry/DTGeometryBuilder/test/pyton/validateDTGeometry_cfg.py" I see:
----- Begin Fatal Exception 27-Aug-2020 15:33:18 CEST-----------------------
An exception of category 'FileInPathError' occurred while
[0] Constructing the EventProcessor
[1] Constructing module: class=DTGeometryValidate label='valid'
Exception Message:
edm::FileInPath unable to find file Geometry/DTGeometryBuilder/data/cmsRecoGeom-2021.root anywhere in the search path.
The search path is defined by: CMSSW_SEARCH_PATH
${CMSSW_SEARCH_PATH} is: /build/slomeo/CMSSW_11_2_X_2020-08-23-2300/poison:/build/slomeo/CMSSW_11_2_X_2020-08-23-2300/src:/build/slomeo/CMSSW_11_2_X_2020-08-23-2300/external/slc7_amd64_gcc820/data:/cvmfs/cms-ib.cern.ch/week1/slc7_amd64_gcc820/cms/cmssw-patch/CMSSW_11_2_X_2020-08-23-2300/poison:/cvmfs/cms-ib.cern.ch/week1/slc7_amd64_gcc820/cms/cmssw-patch/CMSSW_11_2_X_2020-08-23-2300/src:/cvmfs/cms-ib.cern.ch/week1/slc7_amd64_gcc820/cms/cmssw-patch/CMSSW_11_2_X_2020-08-23-2300/external/slc7_amd64_gcc820/data
Current directory is: /build/slomeo/CMSSW_11_2_X_2020-08-23-2300/src
----- End Fatal Exception -------------------------------------------------
Where is my mistake?