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.
11 
12 // Alignments
22 
29 
30 #include <memory>
31 
32 //__________________________________________________________________
34  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
35  myLabel_(p.getParameter<std::string>("appendToDataLabel"))
36 {
37  applyAlignment_ = p.getParameter<bool>("applyAlignment");
38  fromDDD_ = p.getParameter<bool>("fromDDD");
39 
40  setWhatProduced(this);
41 
42  edm::LogInfo("Geometry") << "@SUB=TrackerDigiGeometryESModule"
43  << "Label '" << myLabel_ << "' "
44  << (applyAlignment_ ? "looking for" : "IGNORING")
45  << " alignment labels '" << alignmentsLabel_ << "'.";
46 }
47 
48 //__________________________________________________________________
50 
51 void
53 {
55  descDB.add<std::string>( "appendToDataLabel", "" );
56  descDB.add<bool>( "fromDDD", false );
57  descDB.add<bool>( "applyAlignment", true );
58  descDB.add<std::string>( "alignmentsLabel", "" );
59  descriptions.add( "trackerGeometryDB", descDB );
60 
62  desc.add<std::string>( "appendToDataLabel", "" );
63  desc.add<bool>( "fromDDD", true );
64  desc.add<bool>( "applyAlignment", true );
65  desc.add<std::string>( "alignmentsLabel", "" );
66  descriptions.add( "trackerGeometry", desc );
67 }
68 
69 //__________________________________________________________________
70 std::shared_ptr<TrackerGeometry>
72 {
73  //
74  // Called whenever the alignments, alignment errors or global positions change
75  //
77  iRecord.getRecord<IdealGeometryRecord>().get( gD );
78 
80  iRecord.getRecord<TrackerTopologyRcd>().get(tTopoHand);
81  const TrackerTopology *tTopo=tTopoHand.product();
82 
84  iRecord.getRecord<PTrackerParametersRcd>().get( ptp );
85 
87  _tracker = std::shared_ptr<TrackerGeometry>(builder.build(&(*gD), *ptp, tTopo));
88 
89  if (applyAlignment_) {
90  // Since fake is fully working when checking for 'empty', we should get rid of applyAlignment_!
91  edm::ESHandle<Alignments> globalPosition;
92  iRecord.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
93  edm::ESHandle<Alignments> alignments;
94  iRecord.getRecord<TrackerAlignmentRcd>().get(alignmentsLabel_, alignments);
96  iRecord.getRecord<TrackerAlignmentErrorExtendedRcd>().get(alignmentsLabel_, alignmentErrors);
97  // apply if not empty:
98  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
99  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
100  << "Alignment(Error)s and global position (label '"
101  << alignmentsLabel_ << "') empty: Geometry producer (label "
102  << "'" << myLabel_ << "') assumes fake and does not apply.";
103  } else {
104  GeometryAligner ali;
105  ali.applyAlignments<TrackerGeometry>(&(*_tracker), &(*alignments), &(*alignmentErrors),
106  align::DetectorGlobalPosition(*globalPosition,
108  }
109 
111  iRecord.getRecord<TrackerSurfaceDeformationRcd>().get(alignmentsLabel_, surfaceDeformations);
112  // apply if not empty:
113  if (surfaceDeformations->empty()) {
114  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
115  << "AlignmentSurfaceDeformations (label '"
116  << alignmentsLabel_ << "') empty: Geometry producer (label "
117  << "'" << myLabel_ << "') assumes fake and does not apply.";
118  } else {
119  GeometryAligner ali;
120  ali.attachSurfaceDeformations<TrackerGeometry>(&(*_tracker), &(*surfaceDeformations));
121  }
122  }
123 
124  return _tracker;
125 }
126 
T getParameter(std::string const &) const
Class to update a given geometry with a set of alignments.
std::shared_ptr< TrackerGeometry > produce(const TrackerDigiGeometryRecord &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: DetId.h:18
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
std::shared_ptr< TrackerGeometry > _tracker
Called when geometry description changes.
T const * product() const
Definition: ESHandle.h:86
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TrackerDigiGeometryESModule(const edm::ParameterSet &p)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
volatile std::atomic< bool > shutdown_flag false