CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTGeometryESModule.cc
Go to the documentation of this file.
1 
8 #include "DTGeometryESModule.h"
11 
16 
17 // Alignments
24 
28 
29 #include <memory>
30 #include <iostream>
31 
32 using namespace edm;
33 using namespace std;
34 
36  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
37  myLabel_(p.getParameter<std::string>("appendToDataLabel")),
38  fromDDD_(p.getParameter<bool>("fromDDD"))
39 {
40 
41  applyAlignment_ = p.getParameter<bool>("applyAlignment");
42 
44 
45  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
46  << "Label '" << myLabel_ << "' "
47  << (applyAlignment_ ? "looking for" : "IGNORING")
48  << " alignment labels '" << alignmentsLabel_ << "'.";
49 }
50 
52 
53 boost::shared_ptr<DTGeometry>
55 
56  //
57  // Called whenever the alignments or alignment errors change
58  //
59  if ( applyAlignment_ ) {
60  // applyAlignment_ is scheduled for removal.
61  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
62  edm::ESHandle<Alignments> globalPosition;
63  record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
64  edm::ESHandle<Alignments> alignments;
65  record.getRecord<DTAlignmentRcd>().get(alignmentsLabel_, alignments);
66  edm::ESHandle<AlignmentErrors> alignmentErrors;
67  record.getRecord<DTAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
68  // Only apply alignment if values exist
69  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
70  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
71  << "Alignment(Error)s and global position (label '"
72  << alignmentsLabel_ << "') empty: Geometry producer (label "
73  << "'" << myLabel_ << "') assumes fake and does not apply.";
74  } else {
75  GeometryAligner aligner;
76  aligner.applyAlignments<DTGeometry>( &(*_dtGeometry),
77  &(*alignments), &(*alignmentErrors),
79  }
80  }
81 
82  return _dtGeometry;
83 
84 }
85 
87  //
88  // Called whenever the muon numbering (or ideal geometry) changes
89  //
90 
91  _dtGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
92  if ( fromDDD_ ) {
94  record.get( mdc );
95 
97  record.getRecord<IdealGeometryRecord>().get(cpv);
98 
100  builder.build(_dtGeometry, &(*cpv), *mdc);
101  } else {
103  record.getRecord<DTRecoGeometryRcd>().get(rig);
104 
106  builder.build(_dtGeometry, *rig);
107  }
108 
109 }
110 
111 
T getParameter(std::string const &) const
depends_on::OneHolder< T, TDependsOnRecord > dependsOn(void(T::*iT)(const TDependsOnRecord &))
virtual ~DTGeometryESModule()
Destructor.
Class to update a given geometry with a set of alignments.
JetCorrectorParameters::Record record
Definition: classes.h:11
void geometryCallback_(const MuonNumberingRecord &record)
boost::shared_ptr< DTGeometry > _dtGeometry
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void build(boost::shared_ptr< DTGeometry > theGeometry, const RecoIdealGeometry &rig)
const std::string myLabel_
void get(HolderT &iHolder) const
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
const std::string alignmentsLabel_
Definition: DetId.h:20
void build(boost::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:48
boost::shared_ptr< DTGeometry > produce(const MuonGeometryRecord &record)
Produce DTGeometry.
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
DTGeometryESModule(const edm::ParameterSet &p)
Constructor.