-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
CSC migration to DD4HEP #29111
CSC migration to DD4HEP #29111
Changes from 2 commits
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 |
---|---|---|
@@ -1,4 +1,14 @@ | ||
|
||
/* | ||
// \class CSCGeometryESModule | ||
// | ||
// Description: CSC ESModule for DD4hep | ||
// | ||
// | ||
// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) | ||
// Created: Thu, 05 March 2020 | ||
// | ||
// Old DD version author: Tim Cox | ||
*/ | ||
#include "CSCGeometryESModule.h" | ||
#include "Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.h" | ||
#include "Geometry/CSCGeometryBuilder/src/CSCGeometryBuilder.h" | ||
|
@@ -11,10 +21,16 @@ | |
|
||
#include <memory> | ||
|
||
#include "Geometry/MuonNumbering/interface/DD4hep_MuonNumbering.h" | ||
#include "Geometry/MuonNumbering/interface/MuonDDDNumbering.h" | ||
#include "Geometry/MuonNumbering/interface/MuonBaseNumber.h" | ||
|
||
using namespace edm; | ||
|
||
CSCGeometryESModule::CSCGeometryESModule(const edm::ParameterSet& p) | ||
: alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")), | ||
: useDDD_(p.getParameter<bool>("useDDD")), | ||
useDD4hep_{p.getUntrackedParameter<bool>("useDD4hep", false)}, | ||
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. it has to be tracked, I think 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. Hi Yana, I made the same for GEM migration. It is needed to use Untracked Parameter for dd4hep in order to have no crashes during runTheMatrix tests 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. Strictly speaking tracked vs. untracked should not lead to crashes (or, crashes imply that something else is wrong). Where the failures perhaps complaining a missing parameter? In that case the best solution would be to implement 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. It is not a crash, but test failure
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. Thanks, so the complaint is about missing parameter. The best solutions are to either implement 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.
No, all parameters affecting results/physics should be tracked. I meant to add the parameter in all places where 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. 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.
In the first three (under For the next 6 (under The last one looks like it can be ignored (it only modifies an existing module, and the file may well be obsolete).
It should be changed to 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. please keep in mind that we have a process modifier https://cmssdt.cern.ch/lxr/source/Configuration/ProcessModifiers/python/dd4hep_cff.py that can be used to centralize settings change. This could help in tracking in a transparent way the set of needed modifications 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. |
||
alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")), | ||
myLabel_(p.getParameter<std::string>("appendToDataLabel")) { | ||
auto cc = setWhatProduced(this); | ||
|
||
|
@@ -52,6 +68,9 @@ CSCGeometryESModule::CSCGeometryESModule(const edm::ParameterSet& p) | |
if (useDDD_) { | ||
cpvToken_ = cc.consumesFrom<DDCompactView, IdealGeometryRecord>(edm::ESInputTag{}); | ||
mdcToken_ = cc.consumesFrom<MuonDDDConstants, MuonNumberingRecord>(edm::ESInputTag{}); | ||
} else if (useDD4hep_) { | ||
cpvTokendd4hep_ = cc.consumesFrom<cms::DDCompactView, IdealGeometryRecord>(edm::ESInputTag{}); | ||
mdcTokendd4hep_ = cc.consumesFrom<cms::MuonNumbering, MuonNumberingRecord>(edm::ESInputTag{}); | ||
} else { | ||
rigToken_ = cc.consumesFrom<RecoIdealGeometry, CSCRecoGeometryRcd>(edm::ESInputTag{}); | ||
rdpToken_ = cc.consumesFrom<CSCRecoDigiParameters, CSCRecoDigiParametersRcd>(edm::ESInputTag{}); | ||
|
@@ -112,6 +131,14 @@ void CSCGeometryESModule::initCSCGeometry_(const MuonGeometryRecord& record, std | |
CSCGeometryBuilderFromDDD builder; | ||
builder.build(*host, cpv.product(), mdc); | ||
}); | ||
} else if (useDD4hep_) { | ||
host->ifRecordChanges<MuonNumberingRecord>(record, [&host, &record, this](auto const& rec) { | ||
host->clear(); | ||
edm::ESTransientHandle<cms::DDCompactView> cpv = record.getTransientHandle(cpvTokendd4hep_); | ||
const auto& mdc = rec.get(mdcTokendd4hep_); | ||
CSCGeometryBuilderFromDDD builder; | ||
builder.build(*host, cpv.product(), mdc); | ||
}); | ||
} else { | ||
bool recreateGeometry = false; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#ifndef CSCGeometryBuilder_CSCGeometryESModule_h | ||
#define CSCGeometryBuilder_CSCGeometryESModule_h | ||
|
||
/** \class CSCGeometryESModule | ||
* | ||
* ESProducer for CSCGeometry in MuonGeometryRecord | ||
* | ||
* \author Tim Cox | ||
*/ | ||
/* | ||
// \class CSCGeometryESModule | ||
// | ||
// Description: CSC ESModule for DD4hep | ||
// | ||
// | ||
// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) | ||
// Created: Thu, 05 March 2020 | ||
// | ||
// Old DD version author: Tim Cox | ||
*/ | ||
|
||
#include <FWCore/Framework/interface/ESProducer.h> | ||
#include "FWCore/Framework/interface/ESProductHost.h" | ||
|
@@ -16,10 +21,10 @@ | |
#include <Geometry/Records/interface/MuonGeometryRecord.h> | ||
#include <Geometry/CSCGeometry/interface/CSCGeometry.h> | ||
#include "DetectorDescription/Core/interface/DDCompactView.h" | ||
|
||
#include <DetectorDescription/DDCMS/interface/DDCompactView.h> | ||
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. please, use 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. Done |
||
#include "Geometry/Records/interface/IdealGeometryRecord.h" | ||
#include "Geometry/Records/interface/MuonNumberingRecord.h" | ||
|
||
#include <Geometry/MuonNumbering/interface/DD4hep_MuonNumbering.h> | ||
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. please, use 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. Done |
||
#include "Geometry/Records/interface/CSCRecoGeometryRcd.h" | ||
#include "Geometry/Records/interface/CSCRecoDigiParametersRcd.h" | ||
#include "Geometry/MuonNumbering/interface/MuonDDDConstants.h" | ||
|
@@ -54,9 +59,12 @@ class CSCGeometryESModule : public edm::ESProducer { | |
void initCSCGeometry_(const MuonGeometryRecord&, std::shared_ptr<HostType>& host); | ||
|
||
edm::ReusableObjectHolder<HostType> holder_; | ||
|
||
// DDD | ||
edm::ESGetToken<DDCompactView, IdealGeometryRecord> cpvToken_; | ||
edm::ESGetToken<MuonDDDConstants, MuonNumberingRecord> mdcToken_; | ||
//dd4hep | ||
edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> cpvTokendd4hep_; | ||
edm::ESGetToken<cms::MuonNumbering, MuonNumberingRecord> mdcTokendd4hep_; | ||
|
||
edm::ESGetToken<RecoIdealGeometry, CSCRecoGeometryRcd> rigToken_; | ||
edm::ESGetToken<CSCRecoDigiParameters, CSCRecoDigiParametersRcd> rdpToken_; | ||
|
@@ -73,6 +81,7 @@ class CSCGeometryESModule : public edm::ESProducer { | |
bool debugV; | ||
bool applyAlignment_; // Switch to apply alignment corrections | ||
bool useDDD_; // whether to build from DDD or DB | ||
bool useDD4hep_; | ||
const std::string alignmentsLabel_; | ||
const std::string myLabel_; | ||
}; | ||
|
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.
I'd say original author :-)
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.
Done!