CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector
< ESProxyIndex > > 
updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
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,
DTAlignmentErrorExtendedRcd
m_alignmentErrorsToken
 
const string m_alignmentsLabel
 
edm::ESGetToken< Alignments,
DTAlignmentRcd
m_alignmentsToken
 
bool m_applyAlignment
 
const string m_attribute
 
edm::ESGetToken< DDDetector,
IdealGeometryRecord
m_cpvToken
 
bool m_fromDDD
 
edm::ESGetToken< Alignments,
GlobalPositionRcd
m_globalPositionToken
 
ReusableObjectHolder< HostTypem_holder
 
edm::ESGetToken
< MuonGeometryConstants,
IdealGeometryRecord
m_mdcToken
 
const string m_myLabel
 
edm::ESGetToken
< DDSpecParRegistry,
DDSpecParRegistryRcd
m_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 es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *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={})
 
void usesResources (std::vector< std::string > const &)
 
- 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 61 of file DTGeometryESProducer.cc.

Member Typedef Documentation

using DTGeometryESProducer::Detector = dd4hep::Detector

Definition at line 67 of file DTGeometryESProducer.cc.

Definition at line 72 of file DTGeometryESProducer.cc.

Definition at line 66 of file DTGeometryESProducer.cc.

Constructor & Destructor Documentation

DTGeometryESProducer::DTGeometryESProducer ( const ParameterSet iConfig)

Definition at line 94 of file DTGeometryESProducer.cc.

References 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().

95  : m_tag(iConfig.getParameter<ESInputTag>("DDDetector")),
96  m_alignmentsLabel(iConfig.getParameter<string>("alignmentsLabel")),
97  m_myLabel(iConfig.getParameter<string>("appendToDataLabel")),
98  m_attribute(iConfig.getParameter<string>("attribute")),
99  m_value(iConfig.getParameter<string>("value")),
100  m_fromDDD(iConfig.getParameter<bool>("fromDDD")) {
101  m_applyAlignment = iConfig.getParameter<bool>("applyAlignment");
102 
103  auto cc = setWhatProduced(this);
104 
105  if (m_applyAlignment) {
110  }
111 
112  if (m_fromDDD) {
114  m_cpvToken = cc.consumesFrom<DDDetector, IdealGeometryRecord>(m_tag);
116  }
117 
118  edm::LogInfo("Geometry") << "@SUB=DTGeometryESProducer"
119  << "Label '" << m_myLabel << "' " << (m_applyAlignment ? "looking for" : "IGNORING")
120  << " alignment labels '" << m_alignmentsLabel << "'.";
121 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > m_mdcToken
edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > m_alignmentErrorsToken
dd4hep::SpecParRegistry DDSpecParRegistry
Definition: DDCompactView.h:28
edm::ESGetToken< Alignments, GlobalPositionRcd > m_globalPositionToken
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< DDSpecParRegistry, DDSpecParRegistryRcd > m_registryToken
edm::ESGetToken< DDDetector, IdealGeometryRecord > m_cpvToken
edm::ESGetToken< Alignments, DTAlignmentRcd > m_alignmentsToken
DTGeometryESProducer::~DTGeometryESProducer ( )
override

Definition at line 123 of file DTGeometryESProducer.cc.

123 {}

Member Function Documentation

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

Definition at line 125 of file DTGeometryESProducer.cc.

References GeometryAligner::applyAlignments(), counter, align::DetectorGlobalPosition(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), query::host, m_alignmentErrorsToken, m_alignmentsToken, m_applyAlignment, m_fromDDD, m_globalPositionToken, m_holder, edm::ReusableObjectHolder< T, Deleter >::makeOrGet(), DetId::Muon, GlobalPosition_Frontier_DevDB_cff::record, setupDBGeometry(), and setupGeometry().

125  {
126  auto host = m_holder.makeOrGet([]() { return new HostType; });
127 
128  {
129  BenchmarkGrd counter("DTGeometryESProducer");
130 
131  if (m_fromDDD) {
132  host->ifRecordChanges<MuonNumberingRecord>(record, [this, &host](auto const& rec) { setupGeometry(rec, host); });
133  } else {
134  host->ifRecordChanges<DTRecoGeometryRcd>(record, [this, &host](auto const& rec) { setupDBGeometry(rec, host); });
135  }
136  }
137 
138  if (m_applyAlignment) {
139  const auto& globalPosition = record.get(m_globalPositionToken);
140  const auto& alignments = record.get(m_alignmentsToken);
141  const auto& alignmentErrors = record.get(m_alignmentErrorsToken);
142 
143  if (alignments.empty() && alignmentErrors.empty() && globalPosition.empty()) {
144  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
145  << "Alignment and global position errors";
146 
147  } else {
148  GeometryAligner aligner;
149  aligner.applyAlignments<DTGeometry>(
150  &(*host), &alignments, &alignmentErrors, align::DetectorGlobalPosition(globalPosition, DetId(DetId::Muon)));
151  }
152  }
153 
154  return host;
155 }
Class to update a given geometry with a set of alignments.
edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > m_alignmentErrorsToken
ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd > HostType
void applyAlignments(const C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< Alignments, GlobalPositionRcd > m_globalPositionToken
ReusableObjectHolder< HostType > m_holder
std::shared_ptr< T > makeOrGet(FM &&iMakeFunc)
Takes an object from the queue if one is available, or creates one using iMakeFunc.
Log< level::Info, false > LogInfo
string host
Definition: query.py:115
Definition: DetId.h:17
void setupDBGeometry(DTRecoGeometryRcd const &, shared_ptr< HostType > &)
static std::atomic< unsigned int > counter
void setupGeometry(MuonNumberingRecord const &, shared_ptr< HostType > &)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
edm::ESGetToken< Alignments, DTAlignmentRcd > m_alignmentsToken
void DTGeometryESProducer::setupDBGeometry ( DTRecoGeometryRcd const &  ,
shared_ptr< HostType > &   
)
private

Definition at line 176 of file DTGeometryESProducer.cc.

Referenced by produce().

176  {
177  // host->clear();
178  // edm::ESHandle<RecoIdealGeometry> rig;
179  // record.get(rig);
180  // DTGeometryBuilderFromCondDB builder;
181  // builder.build(host, *rig);
182 }
void DTGeometryESProducer::setupGeometry ( MuonNumberingRecord const &  record,
shared_ptr< HostType > &  host 
)
private

Definition at line 157 of file DTGeometryESProducer.cc.

References b1, cms::DTGeometryBuilder::build(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getTransientHandle(), m_attribute, m_cpvToken, m_mdcToken, m_registryToken, m_value, and edm::ESTransientHandle< T >::product().

Referenced by produce().

157  {
158  host->clear();
159 
160  const auto& mdc = record.get(m_mdcToken);
161 
162  edm::ESTransientHandle<DDDetector> cpv = record.getTransientHandle(m_cpvToken);
163 
164  ESTransientHandle<DDSpecParRegistry> registry = record.getTransientHandle(m_registryToken);
165 
166  DDSpecParRefs myReg;
167  {
168  BenchmarkGrd b1("DTGeometryESProducer Filter Registry");
169  registry->filter(myReg, m_attribute, m_value);
170  }
171 
172  DTGeometryBuilder builder;
173  builder.build(*host, cpv.product(), mdc, myReg);
174 }
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > m_mdcToken
dd4hep::SpecParRefs DDSpecParRefs
Definition: DDCompactView.h:29
void build(DTGeometry &, const DDDetector *, const MuonGeometryConstants &, const dd4hep::SpecParRefs &)
string host
Definition: query.py:115
T const * product() const
edm::ESGetToken< DDSpecParRegistry, DDSpecParRegistryRcd > m_registryToken
edm::ESGetToken< DDDetector, IdealGeometryRecord > m_cpvToken
static constexpr float b1

Member Data Documentation

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

Definition at line 81 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

const string DTGeometryESProducer::m_alignmentsLabel
private

Definition at line 86 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

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

Definition at line 80 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

bool DTGeometryESProducer::m_applyAlignment
private

Definition at line 90 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

const string DTGeometryESProducer::m_attribute
private

Definition at line 88 of file DTGeometryESProducer.cc.

Referenced by setupGeometry().

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

Definition at line 83 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

bool DTGeometryESProducer::m_fromDDD
private

Definition at line 91 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

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

Definition at line 79 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

ReusableObjectHolder<HostType> DTGeometryESProducer::m_holder
private

Definition at line 77 of file DTGeometryESProducer.cc.

Referenced by produce().

edm::ESGetToken<MuonGeometryConstants, IdealGeometryRecord> DTGeometryESProducer::m_mdcToken
private

Definition at line 82 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

const string DTGeometryESProducer::m_myLabel
private

Definition at line 87 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

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

Definition at line 84 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

const ESInputTag DTGeometryESProducer::m_tag
private

Definition at line 85 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

const string DTGeometryESProducer::m_value
private

Definition at line 89 of file DTGeometryESProducer.cc.

Referenced by setupGeometry().