CMS 3D CMS Logo

DTGeometryESModule.cc
Go to the documentation of this file.
1 
6 #include "DTGeometryESModule.h"
9 
14 
15 // Alignments
23 
27 
28 #include <memory>
29 #include <iostream>
30 
31 using namespace edm;
32 using namespace std;
33 
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  if(fromDDD_) {
44  } else {
46  }
47 
48  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
49  << "Label '" << myLabel_ << "' "
50  << (applyAlignment_ ? "looking for" : "IGNORING")
51  << " alignment labels '" << alignmentsLabel_ << "'.";
52 }
53 
55 
56 std::shared_ptr<DTGeometry>
58 
59  //
60  // Called whenever the alignments or alignment errors change
61  //
62  if ( applyAlignment_ ) {
63  // applyAlignment_ is scheduled for removal.
64  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
65  edm::ESHandle<Alignments> globalPosition;
66  record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
67  edm::ESHandle<Alignments> alignments;
68  record.getRecord<DTAlignmentRcd>().get(alignmentsLabel_, alignments);
70  record.getRecord<DTAlignmentErrorExtendedRcd>().get(alignmentsLabel_, alignmentErrors);
71  // Only apply alignment if values exist
72  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
73  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
74  << "Alignment(Error)s and global position (label '"
75  << alignmentsLabel_ << "') empty: Geometry producer (label "
76  << "'" << myLabel_ << "') assumes fake and does not apply.";
77  } else {
78  GeometryAligner aligner;
79  aligner.applyAlignments<DTGeometry>( &(*_dtGeometry),
80  &(*alignments), &(*alignmentErrors),
82  }
83  }
84 
85  return _dtGeometry;
86 
87 }
88 
90  //
91  // Called whenever the muon numbering (or ideal geometry) changes
92  //
93 
94  _dtGeometry = std::make_shared<DTGeometry>();
96  record.get( mdc );
97 
99  record.getRecord<IdealGeometryRecord>().get(cpv);
100 
101  DTGeometryBuilderFromDDD builder;
102  builder.build(_dtGeometry, &(*cpv), *mdc);
103 
104 }
105 
107  //
108  // Called whenever the muon numbering (or ideal geometry) changes
109  //
110 
111  _dtGeometry = std::make_shared<DTGeometry>();
113  record.get(rig);
114 
116  builder.build(_dtGeometry, *rig);
117 
118 }
119 
120 
T getParameter(std::string const &) const
depends_on::OneHolder< T, TDependsOnRecord > dependsOn(void(T::*iT)(const TDependsOnRecord &))
std::shared_ptr< DTGeometry > produce(const MuonGeometryRecord &record)
Produce DTGeometry.
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
void geometryCallback_(const MuonNumberingRecord &record)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
~DTGeometryESModule() override
Destructor.
const std::string myLabel_
void get(HolderT &iHolder) const
const std::string alignmentsLabel_
Definition: DetId.h:18
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
bool empty() const
Test of empty vector without having to look into internals:
void dbGeometryCallback_(const DTRecoGeometryRcd &record)
HLT enums.
void build(std::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
std::shared_ptr< DTGeometry > _dtGeometry
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
DTGeometryESModule(const edm::ParameterSet &p)
Constructor.
void build(const std::shared_ptr< DTGeometry > &theGeometry, const RecoIdealGeometry &rig)