CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerDigiGeometryESModule.cc
Go to the documentation of this file.
7 
8 // Alignments
18 
23 
24 
25 #include <memory>
26 
27 //__________________________________________________________________
29  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
30  myLabel_(p.getParameter<std::string>("appendToDataLabel"))
31 {
32 
33  applyAlignment_ = p.getParameter<bool>("applyAlignment");
34  fromDDD_ = p.getParameter<bool>("fromDDD");
35 
36  setWhatProduced(this);
37 
38  edm::LogInfo("Geometry") << "@SUB=TrackerDigiGeometryESModule"
39  << "Label '" << myLabel_ << "' "
40  << (applyAlignment_ ? "looking for" : "IGNORING")
41  << " alignment labels '" << alignmentsLabel_ << "'.";
42 }
43 
44 //__________________________________________________________________
46 
47 //__________________________________________________________________
48 boost::shared_ptr<TrackerGeometry>
50 {
51  //
52  // Called whenever the alignments, alignment errors or global positions change
53  //
55  iRecord.getRecord<IdealGeometryRecord>().get( gD );
56 
58  _tracker = boost::shared_ptr<TrackerGeometry>(builder.build(&(*gD)));
59 
60  if (applyAlignment_) {
61  // Since fake is fully working when checking for 'empty', we should get rid of applyAlignment_!
62  edm::ESHandle<Alignments> globalPosition;
63  iRecord.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
64  edm::ESHandle<Alignments> alignments;
65  iRecord.getRecord<TrackerAlignmentRcd>().get(alignmentsLabel_, alignments);
66  edm::ESHandle<AlignmentErrors> alignmentErrors;
67  iRecord.getRecord<TrackerAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
68  // apply if not empty:
69  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
70  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::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 ali;
76  ali.applyAlignments<TrackerGeometry>(&(*_tracker), &(*alignments), &(*alignmentErrors),
77  align::DetectorGlobalPosition(*globalPosition,
79  }
80 
82  iRecord.getRecord<TrackerSurfaceDeformationRcd>().get(alignmentsLabel_, surfaceDeformations);
83  // apply if not empty:
84  if (surfaceDeformations->empty()) {
85  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
86  << "AlignmentSurfaceDeformations (label '"
87  << alignmentsLabel_ << "') empty: Geometry producer (label "
88  << "'" << myLabel_ << "') assumes fake and does not apply.";
89  } else {
90  GeometryAligner ali;
91  ali.attachSurfaceDeformations<TrackerGeometry>(&(*_tracker), &(*surfaceDeformations));
92  }
93  }
94 
95  return _tracker;
96 }
97 
98 
99 
100 
T getParameter(std::string const &) const
boost::shared_ptr< TrackerGeometry > _tracker
Called when geometry description changes.
Class to update a given geometry with a set of alignments.
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
boost::shared_ptr< TrackerGeometry > produce(const TrackerDigiGeometryRecord &)
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: DetId.h:20
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:48
TrackerGeometry * build(const GeometricDet *gd)
TrackerDigiGeometryESModule(const edm::ParameterSet &p)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)