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

const std::string alignmentsLabel_
 
bool applyAlignment_
 
bool fromDDD_
 
edm::ReusableObjectHolder< HostTypeholder_
 
const std::string myLabel_
 

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 >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- 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 22 of file DTGeometryESModule.h.

Member Typedef Documentation

Definition at line 37 of file DTGeometryESModule.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 34 of file DTGeometryESModule.cc.

References alignmentsLabel_, applyAlignment_, edm::ParameterSet::getParameter(), myLabel_, and edm::ESProducer::setWhatProduced().

35  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
36  myLabel_(p.getParameter<std::string>("appendToDataLabel")),
37  fromDDD_(p.getParameter<bool>("fromDDD"))
38 {
39 
40  applyAlignment_ = p.getParameter<bool>("applyAlignment");
41 
42  setWhatProduced(this);
43 
44  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
45  << "Label '" << myLabel_ << "' "
46  << (applyAlignment_ ? "looking for" : "IGNORING")
47  << " alignment labels '" << alignmentsLabel_ << "'.";
48 }
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
const std::string myLabel_
const std::string alignmentsLabel_
DTGeometryESModule::~DTGeometryESModule ( )
override

Destructor.

Definition at line 50 of file DTGeometryESModule.cc.

50 {}

Member Function Documentation

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

Produce DTGeometry.

Definition at line 53 of file DTGeometryESModule.cc.

References alignmentsLabel_, applyAlignment_, GeometryAligner::applyAlignments(), align::DetectorGlobalPosition(), Alignments::empty(), AlignmentErrorsExtended::empty(), fromDDD_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), holder_, query::host, DetId::Muon, myLabel_, record, setupDBGeometry(), and setupGeometry().

53  {
54 
55  auto host = holder_.makeOrGet([]() {
56  return new HostType;
57  });
58 
59  if(fromDDD_) {
60  host->ifRecordChanges<MuonNumberingRecord>(record,
61  [this, &host](auto const& rec) {
62  setupGeometry(rec, host);
63  });
64  } else {
65  host->ifRecordChanges<DTRecoGeometryRcd>(record,
66  [this, &host](auto const& rec) {
67  setupDBGeometry(rec, host);
68  });
69  }
70  //
71  // Called whenever the alignments or alignment errors change
72  //
73  if ( applyAlignment_ ) {
74  // applyAlignment_ is scheduled for removal.
75  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
76  edm::ESHandle<Alignments> globalPosition;
77  record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
78  edm::ESHandle<Alignments> alignments;
79  record.getRecord<DTAlignmentRcd>().get(alignmentsLabel_, alignments);
81  record.getRecord<DTAlignmentErrorExtendedRcd>().get(alignmentsLabel_, alignmentErrors);
82  // Only apply alignment if values exist
83  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
84  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
85  << "Alignment(Error)s and global position (label '"
86  << alignmentsLabel_ << "') empty: Geometry producer (label "
87  << "'" << myLabel_ << "') assumes fake and does not apply.";
88  } else {
89  GeometryAligner aligner;
90  aligner.applyAlignments<DTGeometry>( &(*host),
91  &(*alignments), &(*alignmentErrors),
93  }
94  }
95 
96  return host; // automatically converts to std::shared_ptr<DTGeometry>
97 
98 }
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
edm::ReusableObjectHolder< HostType > holder_
const std::string myLabel_
const std::string alignmentsLabel_
edm::ESProductHost< DTGeometry, MuonNumberingRecord, DTRecoGeometryRcd > HostType
void setupDBGeometry(DTRecoGeometryRcd const &, std::shared_ptr< HostType > &)
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 > &)
bool empty() const
Test of empty vector without having to look into internals:
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
void DTGeometryESModule::setupDBGeometry ( DTRecoGeometryRcd const &  ,
std::shared_ptr< HostType > &   
)
private

Definition at line 118 of file DTGeometryESModule.cc.

References DTGeometryBuilderFromCondDB::build(), DEFINE_FWK_EVENTSETUP_MODULE, and edm::eventsetup::EventSetupRecord::get().

Referenced by produce().

119  {
120  //
121  // Called whenever the muon numbering (or ideal geometry) changes
122  //
123 
124  host->clear();
125 
127  record.get(rig);
128 
130  builder.build(host, *rig);
131 }
host
Definition: query.py:115
JetCorrectorParameters::Record record
Definition: classes.h:7
void build(const std::shared_ptr< DTGeometry > &theGeometry, const RecoIdealGeometry &rig)
void DTGeometryESModule::setupGeometry ( MuonNumberingRecord const &  ,
std::shared_ptr< HostType > &   
)
private

Definition at line 100 of file DTGeometryESModule.cc.

References DTGeometryBuilderFromDDD::build(), edm::eventsetup::EventSetupRecord::get(), and edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord().

Referenced by produce().

101  {
102  //
103  // Called whenever the muon numbering (or ideal geometry) changes
104  //
105 
106  host->clear();
107 
109  record.get( mdc );
110 
112  record.getRecord<IdealGeometryRecord>().get(cpv);
113 
114  DTGeometryBuilderFromDDD builder;
115  builder.build(host, &(*cpv), *mdc);
116 }
host
Definition: query.py:115
JetCorrectorParameters::Record record
Definition: classes.h:7
void build(std::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)

Member Data Documentation

const std::string DTGeometryESModule::alignmentsLabel_
private

Definition at line 45 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

bool DTGeometryESModule::applyAlignment_
private

Definition at line 44 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

bool DTGeometryESModule::fromDDD_
private

Definition at line 47 of file DTGeometryESModule.h.

Referenced by produce().

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

Definition at line 42 of file DTGeometryESModule.h.

Referenced by produce().

const std::string DTGeometryESModule::myLabel_
private

Definition at line 46 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().