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 Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 

Public Member Functions

 DTGeometryESProducer (const ParameterSet &)
 
ReturnType produce (const MuonGeometryRecord &record)
 
 ~DTGeometryESProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
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, GeometryFileRcdm_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 Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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={})
 
- 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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

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

using DTGeometryESProducer::Detector = dd4hep::Detector

Definition at line 66 of file DTGeometryESProducer.cc.

Definition at line 74 of file DTGeometryESProducer.cc.

Definition at line 65 of file DTGeometryESProducer.cc.

Constructor & Destructor Documentation

DTGeometryESProducer::DTGeometryESProducer ( const ParameterSet iConfig)

Definition at line 96 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().

97  : m_tag(iConfig.getParameter<ESInputTag>("DDDetector")),
98  m_alignmentsLabel(iConfig.getParameter<string>("alignmentsLabel")),
99  m_myLabel(iConfig.getParameter<string>("appendToDataLabel")),
100  m_attribute(iConfig.getParameter<string>("attribute")),
101  m_value(iConfig.getParameter<string>("value")),
102  m_fromDDD(iConfig.getParameter<bool>("fromDDD"))
103 {
104  m_applyAlignment = iConfig.getParameter<bool>("applyAlignment");
105 
106  auto cc = setWhatProduced(this);
107 
108  if(m_applyAlignment) {
112  }
113 
114  if(m_fromDDD) {
116  m_cpvToken = cc.consumesFrom<DDDetector, GeometryFileRcd>(m_tag);
118  }
119 
120  edm::LogInfo("Geometry") << "@SUB=DTGeometryESProducer"
121  << "Label '" << m_myLabel << "' "
122  << (m_applyAlignment ? "looking for" : "IGNORING")
123  << " alignment labels '" << m_alignmentsLabel << "'.";
124 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
edm::ESGetToken< DDDetector, GeometryFileRcd > m_cpvToken
edm::ESGetToken< MuonNumbering, MuonNumberingRecord > m_mdcToken
edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > m_alignmentErrorsToken
edm::ESGetToken< Alignments, GlobalPositionRcd > m_globalPositionToken
edm::ESGetToken< DDSpecParRegistry, DDSpecParRegistryRcd > m_registryToken
edm::ESGetToken< Alignments, DTAlignmentRcd > m_alignmentsToken
DTGeometryESProducer::~DTGeometryESProducer ( )
override

Definition at line 126 of file DTGeometryESProducer.cc.

126 {}

Member Function Documentation

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

Definition at line 129 of file DTGeometryESProducer.cc.

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

129  {
130 
131  auto host = m_holder.makeOrGet([]() {
132  return new HostType;
133  });
134 
135  {
136  BenchmarkGrd counter("DTGeometryESProducer");
137 
138  if(m_fromDDD) {
139  host->ifRecordChanges<MuonNumberingRecord>(record,
140  [this, &host](auto const& rec) {
141  setupGeometry(rec, host);
142  });
143  } else {
144  host->ifRecordChanges<DTRecoGeometryRcd>(record,
145  [this, &host](auto const& rec) {
146  setupDBGeometry(rec, host);
147  });
148  }
149  }
150  //
151  // Called whenever the alignments or alignment errors change
152  //
153  if(m_applyAlignment) {
154  // m_applyAlignment is scheduled for removal.
155  // Ideal geometry obtained by using 'fake alignment' (with m_applyAlignment = true)
156  edm::ESHandle<Alignments> globalPosition;
157  record.getRecord<GlobalPositionRcd>().get(m_alignmentsLabel, globalPosition);
158  edm::ESHandle<Alignments> alignments;
159  record.getRecord<DTAlignmentRcd>().get(m_alignmentsLabel, alignments);
161  record.getRecord<DTAlignmentErrorExtendedRcd>().get(m_alignmentsLabel, alignmentErrors);
162  // Only apply alignment if values exist
163  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
164  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
165  << "Alignment(Error)s and global position (label '"
166  << m_alignmentsLabel << "') empty: Geometry producer (label "
167  << "'" << m_myLabel << "') assumes fake and does not apply.";
168  } else {
169  GeometryAligner aligner;
170  aligner.applyAlignments<DTGeometry>( &(*host),
171  &(*alignments), &(*alignmentErrors),
172  align::DetectorGlobalPosition(*globalPosition, DetId(DetId::Muon)));
173  }
174  }
175 
176  return host; // automatically converts to std::shared_ptr<DTGeometry>
177 }
host
Definition: query.py:115
bool empty() const
Test of empty vector without having to look into internals:
Definition: Alignments.h:15
Class to update a given geometry with a set of alignments.
JetCorrectorParameters::Record record
Definition: classes.h:7
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd > HostType
ReusableObjectHolder< HostType > m_holder
Definition: DetId.h:18
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
bool empty() const
Test of empty vector without having to look into internals:
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)
void DTGeometryESProducer::setupDBGeometry ( DTRecoGeometryRcd const &  ,
shared_ptr< HostType > &   
)
private

Definition at line 201 of file DTGeometryESProducer.cc.

References DEFINE_FWK_EVENTSETUP_MODULE.

Referenced by produce().

202  {
203  // host->clear();
204 
205  // edm::ESHandle<RecoIdealGeometry> rig;
206  // record.get(rig);
207 
208  // DTGeometryBuilderFromCondDB builder;
209  // builder.build(host, *rig);
210 }
void DTGeometryESProducer::setupGeometry ( MuonNumberingRecord const &  ,
shared_ptr< HostType > &   
)
private

Definition at line 180 of file DTGeometryESProducer.cc.

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

Referenced by produce().

181  {
182  host->clear();
183 
184  const auto& mdc = record.get(m_mdcToken);
185 
186  edm::ESTransientHandle<DDDetector> cpv = record.getTransientHandle(m_cpvToken);
187 
189 
190  DDSpecParRefs myReg;
191  {
192  BenchmarkGrd b1("DTGeometryESProducer Filter Registry");
193  registry->filter(myReg, m_attribute, m_value);
194  }
195 
196  DTGeometryBuilder builder;
197  builder.build(*host, cpv.product(), mdc, myReg);
198 }
host
Definition: query.py:115
edm::ESGetToken< DDDetector, GeometryFileRcd > m_cpvToken
edm::ESGetToken< MuonNumbering, MuonNumberingRecord > m_mdcToken
void filter(DDSpecParRefs &, std::string_view, std::string_view) const
JetCorrectorParameters::Record record
Definition: classes.h:7
void build(DTGeometry &, const DDDetector *, const MuonNumbering &, const DDSpecParRefs &)
T const * product() const
std::vector< const DDSpecPar * > DDSpecParRefs
edm::ESGetToken< DDSpecParRegistry, DDSpecParRegistryRcd > m_registryToken
static Interceptor::Registry registry("Interceptor")

Member Data Documentation

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

Definition at line 83 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

const string DTGeometryESProducer::m_alignmentsLabel
private

Definition at line 88 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

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

Definition at line 82 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

bool DTGeometryESProducer::m_applyAlignment
private

Definition at line 92 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

const string DTGeometryESProducer::m_attribute
private

Definition at line 90 of file DTGeometryESProducer.cc.

Referenced by setupGeometry().

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

Definition at line 85 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

bool DTGeometryESProducer::m_fromDDD
private

Definition at line 93 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

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

Definition at line 81 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

ReusableObjectHolder<HostType> DTGeometryESProducer::m_holder
private

Definition at line 79 of file DTGeometryESProducer.cc.

Referenced by produce().

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

Definition at line 84 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

const string DTGeometryESProducer::m_myLabel
private

Definition at line 89 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and produce().

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

Definition at line 86 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer(), and setupGeometry().

const ESInputTag DTGeometryESProducer::m_tag
private

Definition at line 87 of file DTGeometryESProducer.cc.

Referenced by DTGeometryESProducer().

const string DTGeometryESProducer::m_value
private

Definition at line 91 of file DTGeometryESProducer.cc.

Referenced by setupGeometry().