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 
6 #include "DTGeometryESModule.h"
9 
14 
15 // Alignments
22 
26 
27 #include <memory>
28 #include <iostream>
29 
30 using namespace edm;
31 using namespace std;
32 
34  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
35  myLabel_(p.getParameter<std::string>("appendToDataLabel")),
36  fromDDD_(p.getParameter<bool>("fromDDD"))
37 {
38 
39  applyAlignment_ = p.getParameter<bool>("applyAlignment");
40 
41  if(fromDDD_) {
43  } else {
45  }
46 
47  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
48  << "Label '" << myLabel_ << "' "
49  << (applyAlignment_ ? "looking for" : "IGNORING")
50  << " alignment labels '" << alignmentsLabel_ << "'.";
51 }
52 
54 
55 boost::shared_ptr<DTGeometry>
57 
58  //
59  // Called whenever the alignments or alignment errors change
60  //
61  if ( applyAlignment_ ) {
62  // applyAlignment_ is scheduled for removal.
63  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
64  edm::ESHandle<Alignments> globalPosition;
65  record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
66  edm::ESHandle<Alignments> alignments;
67  record.getRecord<DTAlignmentRcd>().get(alignmentsLabel_, alignments);
68  edm::ESHandle<AlignmentErrors> alignmentErrors;
69  record.getRecord<DTAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
70  // Only apply alignment if values exist
71  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
72  edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
73  << "Alignment(Error)s and global position (label '"
74  << alignmentsLabel_ << "') empty: Geometry producer (label "
75  << "'" << myLabel_ << "') assumes fake and does not apply.";
76  } else {
77  GeometryAligner aligner;
78  aligner.applyAlignments<DTGeometry>( &(*_dtGeometry),
79  &(*alignments), &(*alignmentErrors),
81  }
82  }
83 
84  return _dtGeometry;
85 
86 }
87 
89  //
90  // Called whenever the muon numbering (or ideal geometry) changes
91  //
92 
93  _dtGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
95  record.get( mdc );
96 
98  record.getRecord<IdealGeometryRecord>().get(cpv);
99 
100  DTGeometryBuilderFromDDD builder;
101  builder.build(_dtGeometry, &(*cpv), *mdc);
102 
103 }
104 
106  //
107  // Called whenever the muon numbering (or ideal geometry) changes
108  //
109 
110  _dtGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
112  record.get(rig);
113 
115  builder.build(_dtGeometry, *rig);
116 
117 }
118 
119 
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:7
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:18
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.