CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
DTGeometryESModule Class Reference

#include <DTGeometryESModule.h>

Inheritance diagram for DTGeometryESModule:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 DTGeometryESModule (const edm::ParameterSet &p)
 Constructor. More...
 
std::shared_ptr< DTGeometryproduce (const MuonGeometryRecord &record)
 Produce DTGeometry. More...
 
 ~DTGeometryESModule () override
 Destructor. More...
 
- 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 = edm::ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd >
 

Private Member Functions

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

Private Attributes

edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcdalignmentErrorsToken_
 
const std::string alignmentsLabel_
 
edm::ESGetToken< Alignments, DTAlignmentRcdalignmentsToken_
 
bool applyAlignment_
 
edm::ESGetToken< DDCompactView, IdealGeometryRecordcpvToken_
 
bool fromDDD_
 
edm::ESGetToken< Alignments, GlobalPositionRcdglobalPositionToken_
 
edm::ReusableObjectHolder< HostTypeholder_
 
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecordmdcToken_
 
const std::string myLabel_
 
edm::ESGetToken< RecoIdealGeometry, DTRecoGeometryRcdrigToken_
 

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

ESProducer for DTGeometry in MuonGeometryRecord

Author
N. Amapane - CERN

Definition at line 40 of file DTGeometryESModule.h.

Member Typedef Documentation

◆ HostType

Definition at line 52 of file DTGeometryESModule.h.

Constructor & Destructor Documentation

◆ DTGeometryESModule()

DTGeometryESModule::DTGeometryESModule ( const edm::ParameterSet p)

Constructor.

Definition at line 23 of file DTGeometryESModule.cc.

24  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
25  myLabel_(p.getParameter<std::string>("appendToDataLabel")),
26  fromDDD_(p.getParameter<bool>("fromDDD")) {
27  applyAlignment_ = p.getParameter<bool>("applyAlignment");
28 
29  auto cc = setWhatProduced(this);
30  if (applyAlignment_) {
35  }
36  if (fromDDD_) {
39  } else {
41  }
42 
43  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
44  << "Label '" << myLabel_ << "' " << (applyAlignment_ ? "looking for" : "IGNORING")
45  << " alignment labels '" << alignmentsLabel_ << "'.";
46 }

References alignmentErrorsToken_, alignmentsLabel_, alignmentsToken_, applyAlignment_, cpvToken_, fromDDD_, globalPositionToken_, mdcToken_, myLabel_, AlCaHLTBitMon_ParallelJobs::p, rigToken_, and edm::ESProducer::setWhatProduced().

◆ ~DTGeometryESModule()

DTGeometryESModule::~DTGeometryESModule ( )
override

Destructor.

Definition at line 48 of file DTGeometryESModule.cc.

48 {}

Member Function Documentation

◆ produce()

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

Produce DTGeometry.

Definition at line 50 of file DTGeometryESModule.cc.

50  {
51  auto host = holder_.makeOrGet([]() { return new HostType; });
52 
53  if (fromDDD_) {
54  host->ifRecordChanges<MuonNumberingRecord>(record, [this, &host](auto const& rec) { setupGeometry(rec, host); });
55  } else {
56  host->ifRecordChanges<DTRecoGeometryRcd>(record, [this, &host](auto const& rec) { setupDBGeometry(rec, host); });
57  }
58  //
59  // Called whenever the alignments or alignment errors change
60  //
61  if (applyAlignment_) {
62  // applyAlignment_ is scheduled for removal.
63  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
64  const auto& globalPosition = record.get(globalPositionToken_);
65  const auto& alignments = record.get(alignmentsToken_);
66  const auto& alignmentErrors = record.get(alignmentErrorsToken_);
67  // Only apply alignment if values exist
68  if (alignments.empty() && alignmentErrors.empty() && globalPosition.empty()) {
69  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
70  << "Alignment(Error)s and global position (label '" << alignmentsLabel_
71  << "') empty: Geometry producer (label "
72  << "'" << myLabel_ << "') assumes fake and does not apply.";
73  } else {
74  GeometryAligner aligner;
75  aligner.applyAlignments<DTGeometry>(
76  &(*host), &alignments, &alignmentErrors, align::DetectorGlobalPosition(globalPosition, DetId(DetId::Muon)));
77  }
78  }
79 
80  return host; // automatically converts to std::shared_ptr<DTGeometry>
81 }

References alignmentErrorsToken_, alignmentsLabel_, alignmentsToken_, applyAlignment_, GeometryAligner::applyAlignments(), align::DetectorGlobalPosition(), fromDDD_, globalPositionToken_, holder_, query::host, edm::ReusableObjectHolder< T, Deleter >::makeOrGet(), DetId::Muon, myLabel_, GlobalPosition_Frontier_DevDB_cff::record, setupDBGeometry(), and setupGeometry().

◆ setupDBGeometry()

void DTGeometryESModule::setupDBGeometry ( DTRecoGeometryRcd const &  record,
std::shared_ptr< HostType > &  host 
)
private

Definition at line 97 of file DTGeometryESModule.cc.

97  {
98  //
99  // Called whenever the muon numbering (or ideal geometry) changes
100  //
101 
102  host->clear();
103 
104  const auto& rig = record.get(rigToken_);
105 
107  builder.build(host, rig);
108 }

References DTGeometryBuilderFromCondDB::build(), query::host, GlobalPosition_Frontier_DevDB_cff::record, and rigToken_.

Referenced by produce().

◆ setupGeometry()

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

Definition at line 83 of file DTGeometryESModule.cc.

83  {
84  //
85  // Called whenever the muon numbering (or ideal geometry) changes
86  //
87 
88  host->clear();
89 
90  const auto& mdc = record.get(mdcToken_);
91  edm::ESTransientHandle<DDCompactView> cpv = record.getTransientHandle(cpvToken_);
92 
94  builder.build(*host, cpv.product(), mdc);
95 }

References DTGeometryBuilderFromDDD::build(), cpvToken_, query::host, mdcToken_, edm::ESTransientHandle< T >::product(), and GlobalPosition_Frontier_DevDB_cff::record.

Referenced by produce().

Member Data Documentation

◆ alignmentErrorsToken_

edm::ESGetToken<AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd> DTGeometryESModule::alignmentErrorsToken_
private

Definition at line 61 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

◆ alignmentsLabel_

const std::string DTGeometryESModule::alignmentsLabel_
private

Definition at line 67 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

◆ alignmentsToken_

edm::ESGetToken<Alignments, DTAlignmentRcd> DTGeometryESModule::alignmentsToken_
private

Definition at line 60 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

◆ applyAlignment_

bool DTGeometryESModule::applyAlignment_
private

Definition at line 66 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

◆ cpvToken_

edm::ESGetToken<DDCompactView, IdealGeometryRecord> DTGeometryESModule::cpvToken_
private

Definition at line 63 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupGeometry().

◆ fromDDD_

bool DTGeometryESModule::fromDDD_
private

Definition at line 69 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

◆ globalPositionToken_

edm::ESGetToken<Alignments, GlobalPositionRcd> DTGeometryESModule::globalPositionToken_
private

Definition at line 59 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

◆ holder_

edm::ReusableObjectHolder<HostType> DTGeometryESModule::holder_
private

Definition at line 57 of file DTGeometryESModule.h.

Referenced by produce().

◆ mdcToken_

edm::ESGetToken<MuonGeometryConstants, IdealGeometryRecord> DTGeometryESModule::mdcToken_
private

Definition at line 62 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupGeometry().

◆ myLabel_

const std::string DTGeometryESModule::myLabel_
private

Definition at line 68 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

◆ rigToken_

edm::ESGetToken<RecoIdealGeometry, DTRecoGeometryRcd> DTGeometryESModule::rigToken_
private

Definition at line 64 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupDBGeometry().

DTGeometry
Definition: DTGeometry.h:28
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ESTransientHandle::product
T const * product() const
Definition: ESTransientHandle.h:51
DTGeometryBuilderFromDDD
Definition: DTGeometryBuilderFromDDD.h:31
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
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
DTGeometryESModule::rigToken_
edm::ESGetToken< RecoIdealGeometry, DTRecoGeometryRcd > rigToken_
Definition: DTGeometryESModule.h:64
DTGeometryESModule::fromDDD_
bool fromDDD_
Definition: DTGeometryESModule.h:69
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
DetId
Definition: DetId.h:17
DTGeometryESModule::applyAlignment_
bool applyAlignment_
Definition: DTGeometryESModule.h:66
DTGeometryESModule::myLabel_
const std::string myLabel_
Definition: DTGeometryESModule.h:68
DTAlignmentRcd
Definition: DTAlignmentRcd.h:6
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
DTGeometryESModule::holder_
edm::ReusableObjectHolder< HostType > holder_
Definition: DTGeometryESModule.h:57
DTGeometryBuilderFromDDD::build
void build(DTGeometry &theGeometry, const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
Definition: DTGeometryBuilderFromDDD.cc:37
DTGeometryESModule::setupDBGeometry
void setupDBGeometry(DTRecoGeometryRcd const &, std::shared_ptr< HostType > &)
Definition: DTGeometryESModule.cc:97
DTAlignmentErrorExtendedRcd
Definition: DTAlignmentErrorExtendedRcd.h:6
DTGeometryBuilderFromCondDB
Definition: DTGeometryBuilderFromCondDB.h:40
DTGeometryESModule::globalPositionToken_
edm::ESGetToken< Alignments, GlobalPositionRcd > globalPositionToken_
Definition: DTGeometryESModule.h:59
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTRecoGeometryRcd
Definition: DTRecoGeometryRcd.h:5
align::DetectorGlobalPosition
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Definition: DetectorGlobalPosition.cc:10
DTGeometryESModule::alignmentsToken_
edm::ESGetToken< Alignments, DTAlignmentRcd > alignmentsToken_
Definition: DTGeometryESModule.h:60
DTGeometryESModule::alignmentsLabel_
const std::string alignmentsLabel_
Definition: DTGeometryESModule.h:67
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
DTGeometryBuilderFromCondDB::build
void build(const std::shared_ptr< DTGeometry > &theGeometry, const RecoIdealGeometry &rig)
Definition: DTGeometryBuilderFromCondDB.cc:41
DTGeometryESModule::HostType
edm::ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd > HostType
Definition: DTGeometryESModule.h:52
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
DTGeometryESModule::alignmentErrorsToken_
edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > alignmentErrorsToken_
Definition: DTGeometryESModule.h:61
DTGeometryESModule::mdcToken_
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > mdcToken_
Definition: DTGeometryESModule.h:62
DTGeometryESModule::setupGeometry
void setupGeometry(MuonNumberingRecord const &, std::shared_ptr< HostType > &)
Definition: DTGeometryESModule.cc:83
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
RecoIdealGeometry
Definition: RecoIdealGeometry.h:28
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33
DTGeometryESModule::cpvToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvToken_
Definition: DTGeometryESModule.h:63