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 
43  if(fromDDD_) {
45  } else {
47  }
48 
49  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
50  << "Label '" << myLabel_ << "' "
51  << (applyAlignment_ ? "looking for" : "IGNORING")
52  << " alignment labels '" << alignmentsLabel_ << "'.";
53 }
54 
56 
57 boost::shared_ptr<DTGeometry>
59 
60  //
61  // Called whenever the alignments or alignment errors change
62  //
63  if ( applyAlignment_ ) {
64  // applyAlignment_ is scheduled for removal.
65  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
66  edm::ESHandle<Alignments> globalPosition;
67  record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
68  edm::ESHandle<Alignments> alignments;
69  record.getRecord<DTAlignmentRcd>().get(alignmentsLabel_, alignments);
70  edm::ESHandle<AlignmentErrors> alignmentErrors;
71  record.getRecord<DTAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
72  // Only apply alignment if values exist
73  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
74  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
75  << "Alignment(Error)s and global position (label '"
76  << alignmentsLabel_ << "') empty: Geometry producer (label "
77  << "'" << myLabel_ << "') assumes fake and does not apply.";
78  } else {
79  GeometryAligner aligner;
80  aligner.applyAlignments<DTGeometry>( &(*_dtGeometry),
81  &(*alignments), &(*alignmentErrors),
83  }
84  }
85 
86  return _dtGeometry;
87 
88 }
89 
91  //
92  // Called whenever the muon numbering (or ideal geometry) changes
93  //
94 
95  _dtGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
97  record.get( mdc );
98 
100  record.getRecord<IdealGeometryRecord>().get(cpv);
101 
102  DTGeometryBuilderFromDDD builder;
103  builder.build(_dtGeometry, &(*cpv), *mdc);
104 
105 }
106 
108  //
109  // Called whenever the muon numbering (or ideal geometry) changes
110  //
111 
112  _dtGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
114  record.get(rig);
115 
117  builder.build(_dtGeometry, *rig);
118 
119 }
120 
121 
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:13
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:60
void dbGeometryCallback_(const DTRecoGeometryRcd &record)
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.