Skip to content

Commit

Permalink
Merge pull request #35423 from CTPPS/misal_geom_optional
Browse files Browse the repository at this point in the history
PPS: misaligned geometry built only optionally, off by default
  • Loading branch information
cmsbuild committed Sep 29, 2021
2 parents ccafe03 + 26c4541 commit d648f3e
Showing 1 changed file with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class CTPPSGeometryESModule : public edm::ESProducer {
const char* name);

const unsigned int verbosity_;
const bool buildMisalignedGeometry_;
const bool isRun2_;

edm::ESGetToken<DDCompactView, IdealGeometryRecord> ddToken_;
Expand All @@ -95,6 +96,7 @@ class CTPPSGeometryESModule : public edm::ESProducer {

CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig)
: verbosity_(iConfig.getUntrackedParameter<unsigned int>("verbosity")),
buildMisalignedGeometry_(iConfig.getParameter<bool>("buildMisalignedGeometry")),
isRun2_(iConfig.getParameter<bool>("isRun2")),
fromPreprocessedDB_(iConfig.getUntrackedParameter<bool>("fromPreprocessedDB", false)),
fromDD4hep_(iConfig.getUntrackedParameter<bool>("fromDD4hep", false)) {
Expand All @@ -106,9 +108,11 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig)
idealDBGDToken_ = c1.consumesFrom<DetGeomDesc, VeryForwardIdealGeometryRecord>(edm::ESInputTag());
realAlignmentToken_ = c1.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord>(edm::ESInputTag());

auto c2 = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGDFromPreprocessedDB);
misAlignmentToken_ =
c2.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>(edm::ESInputTag());
if (buildMisalignedGeometry_) {
auto c2 = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGDFromPreprocessedDB);
misAlignmentToken_ =
c2.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>(edm::ESInputTag());
}
} else if (!fromDD4hep_) {
auto c = setWhatProduced(this, &CTPPSGeometryESModule::produceIdealGD);
ddToken_ = c.consumes<DDCompactView>(edm::ESInputTag("", iConfig.getParameter<std::string>("compactViewTag")));
Expand All @@ -117,9 +121,11 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig)
idealGDToken_ = c1.consumesFrom<DetGeomDesc, IdealGeometryRecord>(edm::ESInputTag());
realAlignmentToken_ = c1.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord>(edm::ESInputTag());

auto c2 = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD);
misAlignmentToken_ =
c2.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>(edm::ESInputTag());
if (buildMisalignedGeometry_) {
auto c2 = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD);
misAlignmentToken_ =
c2.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>(edm::ESInputTag());
}
} else {
auto c = setWhatProduced(this, &CTPPSGeometryESModule::produceIdealGD);
dd4hepToken_ =
Expand All @@ -129,21 +135,26 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig)
idealGDToken_ = c1.consumesFrom<DetGeomDesc, IdealGeometryRecord>(edm::ESInputTag());
realAlignmentToken_ = c1.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord>(edm::ESInputTag());

auto c2 = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD);
misAlignmentToken_ =
c2.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>(edm::ESInputTag());
if (buildMisalignedGeometry_) {
auto c2 = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD);
misAlignmentToken_ =
c2.consumesFrom<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>(edm::ESInputTag());
}
}

auto c_RTG = setWhatProduced(this, &CTPPSGeometryESModule::produceRealTG);
dgdRealToken_ = c_RTG.consumes<DetGeomDesc>(edm::ESInputTag());

auto c_MTG = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedTG);
dgdMisToken_ = c_MTG.consumes<DetGeomDesc>(edm::ESInputTag());
if (buildMisalignedGeometry_) {
auto c_MTG = setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedTG);
dgdMisToken_ = c_MTG.consumes<DetGeomDesc>(edm::ESInputTag());
}
}

void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.addUntracked<unsigned int>("verbosity", 1);
desc.add<bool>("buildMisalignedGeometry", false)->setComment("switch if misaligned geometry shall be built");
desc.add<bool>("isRun2", false)->setComment("Switch to legacy (2017-18) definition of diamond geometry");
desc.add<std::string>("dbTag", std::string());
desc.add<std::string>("compactViewTag", std::string());
Expand Down

0 comments on commit d648f3e

Please sign in to comment.