CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
DTGeometryESProducer Class Reference
Inheritance diagram for DTGeometryESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

using Detector = dd4hep::Detector
 
using ReturnType = shared_ptr< DTGeometry >
 

Public Member Functions

 DTGeometryESProducer (const ParameterSet &)
 
ReturnType produce (const MuonGeometryRecord &record)
 
 ~DTGeometryESProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Types

using HostType = ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd >
 

Private Member Functions

void setupDBGeometry (DTRecoGeometryRcd const &, shared_ptr< HostType > &)
 
void setupGeometry (MuonNumberingRecord const &, shared_ptr< HostType > &)
 

Private Attributes

edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcdm_alignmentErrorsToken
 
const string m_alignmentsLabel
 
edm::ESGetToken< Alignments, DTAlignmentRcdm_alignmentsToken
 
bool m_applyAlignment
 
const string m_attribute
 
edm::ESGetToken< DDDetector, IdealGeometryRecordm_cpvToken
 
bool m_fromDDD
 
edm::ESGetToken< Alignments, GlobalPositionRcdm_globalPositionToken
 
ReusableObjectHolder< HostTypem_holder
 
edm::ESGetToken< MuonNumbering, MuonNumberingRecordm_mdcToken
 
const string m_myLabel
 
edm::ESGetToken< DDSpecParRegistry, DDSpecParRegistryRcdm_registryToken
 
const ESInputTag m_tag
 
const string m_value
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Description: DT Geometry ES producer

Implementation: Based on a copy of original DTGeometryESProducer

Definition at line 60 of file DTGeometryESProducer.cc.

Member Typedef Documentation

◆ Detector

using DTGeometryESProducer::Detector = dd4hep::Detector

Definition at line 66 of file DTGeometryESProducer.cc.

◆ HostType

Definition at line 71 of file DTGeometryESProducer.cc.

◆ ReturnType

Definition at line 65 of file DTGeometryESProducer.cc.

Constructor & Destructor Documentation

◆ DTGeometryESProducer()

DTGeometryESProducer::DTGeometryESProducer ( const ParameterSet iConfig)

Definition at line 93 of file DTGeometryESProducer.cc.

94  : m_tag(iConfig.getParameter<ESInputTag>("DDDetector")),
95  m_alignmentsLabel(iConfig.getParameter<string>("alignmentsLabel")),
96  m_myLabel(iConfig.getParameter<string>("appendToDataLabel")),
97  m_attribute(iConfig.getParameter<string>("attribute")),
98  m_value(iConfig.getParameter<string>("value")),
99  m_fromDDD(iConfig.getParameter<bool>("fromDDD")) {
100  m_applyAlignment = iConfig.getParameter<bool>("applyAlignment");
101 
102  auto cc = setWhatProduced(this);
103 
104  if (m_applyAlignment) {
109  }
110 
111  if (m_fromDDD) {
115  }
116 
117  edm::LogInfo("Geometry") << "@SUB=DTGeometryESProducer"
118  << "Label '" << m_myLabel << "' " << (m_applyAlignment ? "looking for" : "IGNORING")
119  << " alignment labels '" << m_alignmentsLabel << "'.";
120 }

References volumeBasedMagneticField_dd4hep_160812_cfi::DDDetector, edm::ParameterSet::getParameter(), m_alignmentErrorsToken, m_alignmentsLabel, m_alignmentsToken, m_applyAlignment, m_cpvToken, m_fromDDD, m_globalPositionToken, m_mdcToken, m_myLabel, m_registryToken, m_tag, and edm::ESProducer::setWhatProduced().

◆ ~DTGeometryESProducer()

DTGeometryESProducer::~DTGeometryESProducer ( )
override

Definition at line 122 of file DTGeometryESProducer.cc.

122 {}

Member Function Documentation

◆ produce()

std::shared_ptr< DTGeometry > DTGeometryESProducer::produce ( const MuonGeometryRecord record)

Definition at line 124 of file DTGeometryESProducer.cc.

124  {
125  auto host = m_holder.makeOrGet([]() { return new HostType; });
126 
127  {
128  BenchmarkGrd counter("DTGeometryESProducer");
129 
130  if (m_fromDDD) {
131  host->ifRecordChanges<MuonNumberingRecord>(record, [this, &host](auto const& rec) { setupGeometry(rec, host); });
132  } else {
133  host->ifRecordChanges<DTRecoGeometryRcd>(record, [this, &host](auto const& rec) { setupDBGeometry(rec, host); });
134  }
135  }
136  //
137  // Called whenever the alignments or alignment errors change
138  //
139  if (m_applyAlignment) {
140  // m_applyAlignment is scheduled for removal.
141  // Ideal geometry obtained by using 'fake alignment' (with m_applyAlignment = true)
142  edm::ESHandle<Alignments> globalPosition;
143  record.getRecord<GlobalPositionRcd>().get(m_alignmentsLabel, globalPosition);
144  edm::ESHandle<Alignments> alignments;
145  record.getRecord<DTAlignmentRcd>().get(m_alignmentsLabel, alignments);
147  record.getRecord<DTAlignmentErrorExtendedRcd>().get(m_alignmentsLabel, alignmentErrors);
148  // Only apply alignment if values exist
149  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
150  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
151  << "Alignment(Error)s and global position (label '" << m_alignmentsLabel
152  << "') empty: Geometry producer (label "
153  << "'" << m_myLabel << "') assumes fake and does not apply.";
154  } else {
155  GeometryAligner aligner;
156  aligner.applyAlignments<DTGeometry>(&(*host),
157  &(*alignments),
158  &(*alignmentErrors),
159  align::DetectorGlobalPosition(*globalPosition, DetId(DetId::Muon)));
160  }
161  }
162 
163  return host; // automatically converts to std::shared_ptr<DTGeometry>
164 }

References GeometryAligner::applyAlignments(), counter, align::DetectorGlobalPosition(), AlignmentErrorsExtended::empty(), Alignments::empty(), get, query::host, m_alignmentsLabel, m_applyAlignment, m_fromDDD, m_holder, m_myLabel, edm::ReusableObjectHolder< T, Deleter >::makeOrGet(), DetId::Muon, GlobalPosition_Frontier_DevDB_cff::record, setupDBGeometry(), and setupGeometry().

◆ setupDBGeometry()

void DTGeometryESProducer::setupDBGeometry ( DTRecoGeometryRcd const &  ,
shared_ptr< HostType > &   
)
private

Definition at line 185 of file DTGeometryESProducer.cc.

185  {
186  // host->clear();
187 
188  // edm::ESHandle<RecoIdealGeometry> rig;
189  // record.get(rig);
190 
191  // DTGeometryBuilderFromCondDB builder;
192  // builder.build(host, *rig);
193 }

Referenced by produce().

◆ setupGeometry()

void DTGeometryESProducer::setupGeometry ( MuonNumberingRecord const &  record,
shared_ptr< HostType > &  host 
)
private

Definition at line 166 of file DTGeometryESProducer.cc.

166  {
167  host->clear();
168 
169  const auto& mdc = record.get(m_mdcToken);
170 
171  edm::ESTransientHandle<DDDetector> cpv = record.getTransientHandle(m_cpvToken);
172 
173  ESTransientHandle<DDSpecParRegistry> registry = record.getTransientHandle(m_registryToken);
174 
175  DDSpecParRefs myReg;
176  {
177  BenchmarkGrd b1("DTGeometryESProducer Filter Registry");
178  registry->filter(myReg, m_attribute, m_value);
179  }
180 
181  DTGeometryBuilder builder;
182  builder.build(*host, cpv.product(), mdc, myReg);
183 }

References b1, cms::DTGeometryBuilder::build(), cms::DDSpecParRegistry::filter(), query::host, m_attribute, m_cpvToken, m_mdcToken, m_registryToken, m_value, edm::ESTransientHandle< T >::product(), and GlobalPosition_Frontier_DevDB_cff::record.

Referenced by produce().

Member Data Documentation

◆ m_alignmentErrorsToken

edm::ESGetToken<AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd> DTGeometryESProducer::m_alignmentErrorsToken
private

Definition at line 80 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

◆ m_alignmentsLabel

const string DTGeometryESProducer::m_alignmentsLabel
private

Definition at line 85 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

◆ m_alignmentsToken

edm::ESGetToken<Alignments, DTAlignmentRcd> DTGeometryESProducer::m_alignmentsToken
private

Definition at line 79 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

◆ m_applyAlignment

bool DTGeometryESProducer::m_applyAlignment
private

Definition at line 89 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

◆ m_attribute

const string DTGeometryESProducer::m_attribute
private

Definition at line 87 of file DTGeometryESProducer.cc.

Referenced by setupGeometry().

◆ m_cpvToken

edm::ESGetToken<DDDetector, IdealGeometryRecord> DTGeometryESProducer::m_cpvToken
private

Definition at line 82 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

◆ m_fromDDD

bool DTGeometryESProducer::m_fromDDD
private

Definition at line 90 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

◆ m_globalPositionToken

edm::ESGetToken<Alignments, GlobalPositionRcd> DTGeometryESProducer::m_globalPositionToken
private

Definition at line 78 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

◆ m_holder

ReusableObjectHolder<HostType> DTGeometryESProducer::m_holder
private

Definition at line 76 of file DTGeometryESProducer.cc.

Referenced by produce().

◆ m_mdcToken

edm::ESGetToken<MuonNumbering, MuonNumberingRecord> DTGeometryESProducer::m_mdcToken
private

Definition at line 81 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

◆ m_myLabel

const string DTGeometryESProducer::m_myLabel
private

Definition at line 86 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

◆ m_registryToken

edm::ESGetToken<DDSpecParRegistry, DDSpecParRegistryRcd> DTGeometryESProducer::m_registryToken
private

Definition at line 83 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

◆ m_tag

const ESInputTag DTGeometryESProducer::m_tag
private

Definition at line 84 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

◆ m_value

const string DTGeometryESProducer::m_value
private

Definition at line 88 of file DTGeometryESProducer.cc.

Referenced by setupGeometry().

DTGeometryESProducer::setupDBGeometry
void setupDBGeometry(DTRecoGeometryRcd const &, shared_ptr< HostType > &)
Definition: DTGeometryESProducer.cc:185
DTGeometry
Definition: DTGeometry.h:28
DDSpecParRegistryRcd
Definition: DDSpecParRegistryRcd.h:8
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ESTransientHandle::product
T const * product() const
Definition: ESTransientHandle.h:51
DTGeometryESProducer::setupGeometry
void setupGeometry(MuonNumberingRecord const &, shared_ptr< HostType > &)
Definition: DTGeometryESProducer.cc:166
DTGeometryESProducer::m_cpvToken
edm::ESGetToken< DDDetector, IdealGeometryRecord > m_cpvToken
Definition: DTGeometryESProducer.cc:82
DTGeometryESProducer::m_registryToken
edm::ESGetToken< DDSpecParRegistry, DDSpecParRegistryRcd > m_registryToken
Definition: DTGeometryESProducer.cc:83
DTGeometryESProducer::m_alignmentsLabel
const string m_alignmentsLabel
Definition: DTGeometryESProducer.cc:85
edm::LogInfo
Definition: MessageLogger.h:254
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
cms::DDSpecParRegistry
Definition: DDSpecParRegistry.h:32
DTGeometryESProducer::m_alignmentErrorsToken
edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > m_alignmentErrorsToken
Definition: DTGeometryESProducer.cc:80
GlobalPositionRcd
Definition: GlobalPositionRcd.h:6
cc
query.host
host
Definition: query.py:115
edm::ReusableObjectHolder::makeOrGet
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn't an object already available, creates a new one using iFunc.
Definition: ReusableObjectHolder.h:126
DTGeometryESProducer::HostType
ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd > HostType
Definition: DTGeometryESProducer.cc:71
DetId
Definition: DetId.h:17
b1
static constexpr float b1
Definition: L1EGammaCrystalsEmulatorProducer.cc:82
DTAlignmentRcd
Definition: DTAlignmentRcd.h:6
edm::ESHandle< Alignments >
AlignmentErrorsExtended::empty
bool empty() const
Test of empty vector without having to look into internals:
Definition: AlignmentErrorsExtended.h:15
DTAlignmentErrorExtendedRcd
Definition: DTAlignmentErrorExtendedRcd.h:6
DTGeometryESProducer::m_holder
ReusableObjectHolder< HostType > m_holder
Definition: DTGeometryESProducer.cc:76
cms::DDSpecParRefs
std::vector< const DDSpecPar * > DDSpecParRefs
Definition: DDSpecParRegistry.h:30
cms::DTGeometryBuilder
Definition: DTGeometryBuilder.h:25
DTRecoGeometryRcd
Definition: DTRecoGeometryRcd.h:5
align::DetectorGlobalPosition
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Definition: DetectorGlobalPosition.cc:10
volumeBasedMagneticField_dd4hep_160812_cfi.DDDetector
DDDetector
Definition: volumeBasedMagneticField_dd4hep_160812_cfi.py:27
DTGeometryESProducer::m_globalPositionToken
edm::ESGetToken< Alignments, GlobalPositionRcd > m_globalPositionToken
Definition: DTGeometryESProducer.cc:78
cms::MuonNumbering
Definition: DD4hep_MuonNumbering.h:37
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:15
DTGeometryESProducer::m_fromDDD
bool m_fromDDD
Definition: DTGeometryESProducer.cc:90
get
#define get
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
DTGeometryESProducer::m_attribute
const string m_attribute
Definition: DTGeometryESProducer.cc:87
DTGeometryESProducer::m_tag
const ESInputTag m_tag
Definition: DTGeometryESProducer.cc:84
DTGeometryESProducer::m_alignmentsToken
edm::ESGetToken< Alignments, DTAlignmentRcd > m_alignmentsToken
Definition: DTGeometryESProducer.cc:79
cms::DDSpecParRegistry::filter
void filter(DDSpecParRefs &, const std::string &, const std::string &="") const
Definition: DDSpecparRegistry.cc:98
BenchmarkGrd
Definition: BenchmarkGrd.h:9
DTGeometryESProducer::m_value
const string m_value
Definition: DTGeometryESProducer.cc:88
cms::DTGeometryBuilder::build
void build(DTGeometry &, const DDDetector *, const MuonNumbering &, const DDSpecParRefs &)
Definition: DTGeometryBuilder.cc:167
DTGeometryESProducer::m_myLabel
const string m_myLabel
Definition: DTGeometryESProducer.cc:86
Alignments::empty
bool empty() const
Test of empty vector without having to look into internals:
Definition: Alignments.h:15
DetId::Muon
Definition: DetId.h:26
MuonNumberingRecord
Definition: MuonNumberingRecord.h:30
Alignments
Definition: Alignments.h:10
GeometryAligner::applyAlignments
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: GeometryAligner.h:52
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
DTGeometryESProducer::m_mdcToken
edm::ESGetToken< MuonNumbering, MuonNumberingRecord > m_mdcToken
Definition: DTGeometryESProducer.cc:81
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33
DTGeometryESProducer::m_applyAlignment
bool m_applyAlignment
Definition: DTGeometryESProducer.cc:89