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 ()(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< MuonDDDConstants, MuonNumberingRecordmdcToken_
 
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 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 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 38 of file DTGeometryESModule.h.

Member Typedef Documentation

Definition at line 50 of file DTGeometryESModule.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 23 of file DTGeometryESModule.cc.

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

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 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvToken_
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
const std::string myLabel_
const std::string alignmentsLabel_
edm::ESGetToken< Alignments, GlobalPositionRcd > globalPositionToken_
edm::ESGetToken< MuonDDDConstants, MuonNumberingRecord > mdcToken_
edm::ESGetToken< Alignments, DTAlignmentRcd > alignmentsToken_
edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > alignmentErrorsToken_
edm::ESGetToken< RecoIdealGeometry, DTRecoGeometryRcd > rigToken_
DTGeometryESModule::~DTGeometryESModule ( )
override

Destructor.

Definition at line 48 of file DTGeometryESModule.cc.

48 {}

Member Function Documentation

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

Produce DTGeometry.

Definition at line 50 of file DTGeometryESModule.cc.

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

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 }
host
Definition: query.py:115
Class to update a given geometry with a set of alignments.
JetCorrectorParameters::Record record
Definition: classes.h:7
edm::ReusableObjectHolder< HostType > holder_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const std::string myLabel_
const std::string alignmentsLabel_
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
edm::ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd > HostType
void setupDBGeometry(DTRecoGeometryRcd const &, std::shared_ptr< HostType > &)
edm::ESGetToken< Alignments, GlobalPositionRcd > globalPositionToken_
Definition: DetId.h:17
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
void setupGeometry(MuonNumberingRecord const &, std::shared_ptr< HostType > &)
edm::ESGetToken< Alignments, DTAlignmentRcd > alignmentsToken_
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
edm::ESGetToken< AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd > alignmentErrorsToken_
void DTGeometryESModule::setupDBGeometry ( DTRecoGeometryRcd const &  ,
std::shared_ptr< HostType > &   
)
private

Definition at line 97 of file DTGeometryESModule.cc.

References DTGeometryBuilderFromCondDB::build(), DEFINE_FWK_EVENTSETUP_MODULE, edm::eventsetup::EventSetupRecordImplementation< T >::get(), and rigToken_.

Referenced by produce().

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 }
host
Definition: query.py:115
JetCorrectorParameters::Record record
Definition: classes.h:7
void build(const std::shared_ptr< DTGeometry > &theGeometry, const RecoIdealGeometry &rig)
edm::ESGetToken< RecoIdealGeometry, DTRecoGeometryRcd > rigToken_
void DTGeometryESModule::setupGeometry ( MuonNumberingRecord const &  ,
std::shared_ptr< HostType > &   
)
private

Definition at line 83 of file DTGeometryESModule.cc.

References DTGeometryBuilderFromDDD::build(), cpvToken_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getTransientHandle(), mdcToken_, and edm::ESTransientHandle< T >::product().

Referenced by produce().

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 }
host
Definition: query.py:115
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvToken_
JetCorrectorParameters::Record record
Definition: classes.h:7
void build(DTGeometry &theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
edm::ESGetToken< MuonDDDConstants, MuonNumberingRecord > mdcToken_
T const * product() const

Member Data Documentation

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

Definition at line 59 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

const std::string DTGeometryESModule::alignmentsLabel_
private

Definition at line 65 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 58 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

bool DTGeometryESModule::applyAlignment_
private

Definition at line 64 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 61 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupGeometry().

bool DTGeometryESModule::fromDDD_
private

Definition at line 67 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 57 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 55 of file DTGeometryESModule.h.

Referenced by produce().

edm::ESGetToken<MuonDDDConstants, MuonNumberingRecord> DTGeometryESModule::mdcToken_
private

Definition at line 60 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupGeometry().

const std::string DTGeometryESModule::myLabel_
private

Definition at line 66 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 62 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupDBGeometry().