test
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.
9 
10 // Alignments
20 
27 
28 #include <memory>
29 
30 //__________________________________________________________________
32  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
33  myLabel_(p.getParameter<std::string>("appendToDataLabel"))
34 {
35  applyAlignment_ = p.getParameter<bool>("applyAlignment");
36  fromDDD_ = p.getParameter<bool>("fromDDD");
37 
38  setWhatProduced(this);
39 
40  edm::LogInfo("Geometry") << "@SUB=TrackerDigiGeometryESModule"
41  << "Label '" << myLabel_ << "' "
42  << (applyAlignment_ ? "looking for" : "IGNORING")
43  << " alignment labels '" << alignmentsLabel_ << "'.";
44 }
45 
46 //__________________________________________________________________
48 
49 void
51 {
53  descDB.add<std::string>( "appendToDataLabel", "" );
54  descDB.add<bool>( "fromDDD", false );
55  descDB.add<bool>( "applyAlignment", true );
56  descDB.add<std::string>( "alignmentsLabel", "" );
57  descriptions.add( "trackerGeometryDB", descDB );
58 
60  desc.add<std::string>( "appendToDataLabel", "" );
61  desc.add<bool>( "fromDDD", true );
62  desc.add<bool>( "applyAlignment", true );
63  desc.add<std::string>( "alignmentsLabel", "" );
64  descriptions.add( "trackerGeometry", desc );
65 }
66 
67 //__________________________________________________________________
68 boost::shared_ptr<TrackerGeometry>
70 {
71  //
72  // Called whenever the alignments, alignment errors or global positions change
73  //
75  iRecord.getRecord<IdealGeometryRecord>().get( gD );
76 
78  iRecord.getRecord<PTrackerParametersRcd>().get( ptp );
79 
81  _tracker = boost::shared_ptr<TrackerGeometry>(builder.build(&(*gD), *ptp ));
82 
83  if (applyAlignment_) {
84  // Since fake is fully working when checking for 'empty', we should get rid of applyAlignment_!
85  edm::ESHandle<Alignments> globalPosition;
86  iRecord.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
87  edm::ESHandle<Alignments> alignments;
88  iRecord.getRecord<TrackerAlignmentRcd>().get(alignmentsLabel_, alignments);
90  iRecord.getRecord<TrackerAlignmentErrorExtendedRcd>().get(alignmentsLabel_, alignmentErrors);
91  // apply if not empty:
92  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
93  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
94  << "Alignment(Error)s and global position (label '"
95  << alignmentsLabel_ << "') empty: Geometry producer (label "
96  << "'" << myLabel_ << "') assumes fake and does not apply.";
97  } else {
98  GeometryAligner ali;
99  ali.applyAlignments<TrackerGeometry>(&(*_tracker), &(*alignments), &(*alignmentErrors),
100  align::DetectorGlobalPosition(*globalPosition,
102  }
103 
105  iRecord.getRecord<TrackerSurfaceDeformationRcd>().get(alignmentsLabel_, surfaceDeformations);
106  // apply if not empty:
107  if (surfaceDeformations->empty()) {
108  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
109  << "AlignmentSurfaceDeformations (label '"
110  << alignmentsLabel_ << "') empty: Geometry producer (label "
111  << "'" << myLabel_ << "') assumes fake and does not apply.";
112  } else {
113  GeometryAligner ali;
114  ali.attachSurfaceDeformations<TrackerGeometry>(&(*_tracker), &(*surfaceDeformations));
115  }
116  }
117 
118  return _tracker;
119 }
120 
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.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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)
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)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TrackerDigiGeometryESModule(const edm::ParameterSet &p)
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
volatile std::atomic< bool > shutdown_flag false