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 ()
 
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 = 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

- 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
 
- 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

ESProducer for DTGeometry in MuonGeometryRecord

Author
N. Amapane - CERN

Definition at line 38 of file DTGeometryESModule.h.

Member Typedef Documentation

Definition at line 53 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 {
28 
29  applyAlignment_ = p.getParameter<bool>("applyAlignment");
30 
31  auto cc = setWhatProduced(this);
32  if(applyAlignment_) {
36  }
37  if(fromDDD_) {
40  }
41  else {
43  }
44 
45  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
46  << "Label '" << myLabel_ << "' "
47  << (applyAlignment_ ? "looking for" : "IGNORING")
48  << " alignment labels '" << alignmentsLabel_ << "'.";
49 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
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 51 of file DTGeometryESModule.cc.

51 {}

Member Function Documentation

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

Produce DTGeometry.

Definition at line 54 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 >::makeOrGet(), DetId::Muon, myLabel_, record, setupDBGeometry(), and setupGeometry().

54  {
55 
56  auto host = holder_.makeOrGet([]() {
57  return new HostType;
58  });
59 
60  if(fromDDD_) {
61  host->ifRecordChanges<MuonNumberingRecord>(record,
62  [this, &host](auto const& rec) {
63  setupGeometry(rec, host);
64  });
65  } else {
66  host->ifRecordChanges<DTRecoGeometryRcd>(record,
67  [this, &host](auto const& rec) {
68  setupDBGeometry(rec, host);
69  });
70  }
71  //
72  // Called whenever the alignments or alignment errors change
73  //
74  if ( applyAlignment_ ) {
75  // applyAlignment_ is scheduled for removal.
76  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
77  const auto& globalPosition = record.get(globalPositionToken_);
78  const auto& alignments = record.get(alignmentsToken_);
79  const auto& alignmentErrors = record.get(alignmentErrorsToken_);
80  // Only apply alignment if values exist
81  if (alignments.empty() && alignmentErrors.empty() && globalPosition.empty()) {
82  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
83  << "Alignment(Error)s and global position (label '"
84  << alignmentsLabel_ << "') empty: Geometry producer (label "
85  << "'" << myLabel_ << "') assumes fake and does not apply.";
86  } else {
87  GeometryAligner aligner;
88  aligner.applyAlignments<DTGeometry>( &(*host),
89  &alignments, &alignmentErrors,
91  }
92  }
93 
94  return host; // automatically converts to std::shared_ptr<DTGeometry>
95 
96 }
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_
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const std::string myLabel_
const std::string alignmentsLabel_
edm::ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd > HostType
void setupDBGeometry(DTRecoGeometryRcd const &, std::shared_ptr< HostType > &)
edm::ESGetToken< Alignments, GlobalPositionRcd > globalPositionToken_
Definition: DetId.h:18
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 113 of file DTGeometryESModule.cc.

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

Referenced by produce().

114  {
115  //
116  // Called whenever the muon numbering (or ideal geometry) changes
117  //
118 
119  host->clear();
120 
121  const auto& rig = record.get(rigToken_);
122 
124  builder.build(host, rig);
125 }
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 98 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().

99  {
100  //
101  // Called whenever the muon numbering (or ideal geometry) changes
102  //
103 
104  host->clear();
105 
106  const auto& mdc = record.get(mdcToken_);
107  edm::ESTransientHandle<DDCompactView> cpv = record.getTransientHandle(cpvToken_);
108 
109  DTGeometryBuilderFromDDD builder;
110  builder.build(*host, cpv.product(), mdc);
111 }
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 62 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

const std::string DTGeometryESModule::alignmentsLabel_
private

Definition at line 68 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 61 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

bool DTGeometryESModule::applyAlignment_
private

Definition at line 67 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 64 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupGeometry().

bool DTGeometryESModule::fromDDD_
private

Definition at line 70 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 60 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 58 of file DTGeometryESModule.h.

Referenced by produce().

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

Definition at line 63 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupGeometry().

const std::string DTGeometryESModule::myLabel_
private

Definition at line 69 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

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

Definition at line 65 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and setupDBGeometry().