CMS 3D CMS Logo

TrackerDigiGeometryESModule.cc
Go to the documentation of this file.
27 
28 #include <memory>
29 #include <string>
30 
32 public:
35  std::unique_ptr<TrackerGeometry> produce(const TrackerDigiGeometryRecord&);
36 
37  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
38 
39 private:
43 
47 
52 
53  const bool applyAlignment_; // Switch to apply alignment corrections
54 };
55 
56 //__________________________________________________________________
58  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
59  myLabel_(p.getParameter<std::string>("appendToDataLabel")),
60  applyAlignment_(p.getParameter<bool>("applyAlignment")) {
61  {
62  auto cc = setWhatProduced(this);
63  const edm::ESInputTag kEmptyTag;
64  geometricDetToken_ = cc.consumesFrom<GeometricDet, IdealGeometryRecord>(kEmptyTag);
65  trackerTopoToken_ = cc.consumesFrom<TrackerTopology, TrackerTopologyRcd>(kEmptyTag);
67 
68  if (applyAlignment_) {
69  const edm::ESInputTag kAlignTag{"", alignmentsLabel_};
70  globalAlignmentToken_ = cc.consumesFrom<Alignments, GlobalPositionRcd>(kAlignTag);
71  trackerAlignmentToken_ = cc.consumesFrom<Alignments, TrackerAlignmentRcd>(kAlignTag);
74  }
75  }
76 
77  edm::LogInfo("Geometry") << "@SUB=TrackerDigiGeometryESModule"
78  << "Label '" << myLabel_ << "' " << (applyAlignment_ ? "looking for" : "IGNORING")
79  << " alignment labels '" << alignmentsLabel_ << "'.";
80 }
81 
82 //__________________________________________________________________
84 
87  descDB.add<std::string>("appendToDataLabel", "");
88  descDB.add<bool>("fromDDD", false);
89  descDB.add<bool>("applyAlignment", true);
90  descDB.add<std::string>("alignmentsLabel", "");
91  descriptions.add("trackerGeometryDB", descDB);
92 
94  desc.add<std::string>("appendToDataLabel", "");
95  desc.add<bool>("fromDDD", true);
96  desc.add<bool>("applyAlignment", true);
97  desc.add<std::string>("alignmentsLabel", "");
98  descriptions.add("trackerGeometry", desc);
99 }
100 
101 //__________________________________________________________________
102 std::unique_ptr<TrackerGeometry> TrackerDigiGeometryESModule::produce(const TrackerDigiGeometryRecord& iRecord) {
103  //
104  // Called whenever the alignments, alignment errors or global positions change
105  //
106  auto const& gD = iRecord.get(geometricDetToken_);
107 
108  auto const& tTopo = iRecord.get(trackerTopoToken_);
109 
110  auto const& ptp = iRecord.get(trackerParamsToken_);
111 
113  std::unique_ptr<TrackerGeometry> tracker(builder.build(&gD, ptp, &tTopo));
114 
115  if (applyAlignment_) {
116  // Since fake is fully working when checking for 'empty', we should get rid of applyAlignment_!
117  auto const& globalPosition = iRecord.get(globalAlignmentToken_);
118  auto const& alignments = iRecord.get(trackerAlignmentToken_);
119  auto const& alignmentErrors = iRecord.get(alignmentErrorsToken_);
120  // apply if not empty:
121  if (alignments.empty() && alignmentErrors.empty() && globalPosition.empty()) {
122  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
123  << "Alignment(Error)s and global position (label '" << alignmentsLabel_
124  << "') empty: Geometry producer (label "
125  << "'" << myLabel_ << "') assumes fake and does not apply.";
126  } else {
127  GeometryAligner ali;
129  &(alignments),
130  &(alignmentErrors),
132  }
133 
134  auto const& surfaceDeformations = iRecord.get(deformationsToken_);
135  // apply if not empty:
136  if (surfaceDeformations.empty()) {
137  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
138  << "AlignmentSurfaceDeformations (label '" << alignmentsLabel_
139  << "') empty: Geometry producer (label "
140  << "'" << myLabel_ << "') assumes fake and does not apply.";
141  } else {
142  GeometryAligner ali;
143  ali.attachSurfaceDeformations<TrackerGeometry>(tracker.get(), &(surfaceDeformations));
144  }
145  }
146 
147  return tracker;
148 }
149 
ConfigurationDescriptions.h
AlignmentErrorsExtended.h
TrackerDigiGeometryESModule::trackerParamsToken_
edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > trackerParamsToken_
Definition: TrackerDigiGeometryESModule.cc:46
GlobalPositionRcd.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TrackerGeometry.h
TrackerDigiGeometryESModule::alignmentsLabel_
const std::string alignmentsLabel_
Called when geometry description changes.
Definition: TrackerDigiGeometryESModule.cc:41
PTrackerParameters
Definition: PTrackerParameters.h:6
ESHandle.h
TrackerDigiGeometryESModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackerDigiGeometryESModule.cc:85
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
Alignments.h
DetectorGlobalPosition.h
TrackerGeomBuilderFromGeometricDet::build
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
Definition: TrackerGeomBuilderFromGeometricDet.cc:43
TrackerAlignmentRcd
Definition: TrackerAlignmentRcd.h:6
PTrackerParameters.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
TrackerDigiGeometryESModule::alignmentErrorsToken_
edm::ESGetToken< AlignmentErrorsExtended, TrackerAlignmentErrorExtendedRcd > alignmentErrorsToken_
Definition: TrackerDigiGeometryESModule.cc:50
TrackerDigiGeometryESModule
Definition: TrackerDigiGeometryESModule.cc:31
GeometryAligner::applyAlignments
void applyAlignments(const C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: GeometryAligner.h:52
TrackerSurfaceDeformationRcd.h
GlobalPositionRcd
Definition: GlobalPositionRcd.h:6
PTrackerParametersRcd
Definition: PTrackerParametersRcd.h:9
TrackerAlignmentErrorExtendedRcd.h
DetId
Definition: DetId.h:17
TrackerTopology.h
TrackerTopologyRcd.h
TrackerSurfaceDeformationRcd
Definition: TrackerSurfaceDeformationRcd.h:6
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TrackerDigiGeometryESModule::geometricDetToken_
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geometricDetToken_
Definition: TrackerDigiGeometryESModule.cc:44
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
GeometricDet
Definition: GeometricDet.h:31
ParameterSetDescription.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerDigiGeometryESModule::TrackerDigiGeometryESModule
TrackerDigiGeometryESModule(const edm::ParameterSet &p)
Definition: TrackerDigiGeometryESModule.cc:57
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
DetId::Tracker
Definition: DetId.h:25
align::DetectorGlobalPosition
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Definition: DetectorGlobalPosition.cc:10
TrackerDigiGeometryESModule::~TrackerDigiGeometryESModule
~TrackerDigiGeometryESModule() override
Definition: TrackerDigiGeometryESModule.cc:83
TrackerDigiGeometryESModule::globalAlignmentToken_
edm::ESGetToken< Alignments, GlobalPositionRcd > globalAlignmentToken_
Definition: TrackerDigiGeometryESModule.cc:48
TrackerDigiGeometryESModule::trackerTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
Definition: TrackerDigiGeometryESModule.cc:45
PTrackerParametersRcd.h
TrackerDigiGeometryESModule::myLabel_
const std::string myLabel_
Definition: TrackerDigiGeometryESModule.cc:42
AlignmentSurfaceDeformations
Definition: AlignmentSurfaceDeformations.h:20
IdealGeometryRecord.h
TrackerAlignmentRcd.h
TrackerDigiGeometryESModule::trackerAlignmentToken_
edm::ESGetToken< Alignments, TrackerAlignmentRcd > trackerAlignmentToken_
Definition: TrackerDigiGeometryESModule.cc:49
GeometricDet.h
cc
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
edm::ESGetToken< GeometricDet, IdealGeometryRecord >
GeometryAligner::attachSurfaceDeformations
void attachSurfaceDeformations(const C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
Definition: GeometryAligner.h:120
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
GeometryAligner.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
AlignmentSurfaceDeformations.h
EventSetup.h
edm::ESProducer
Definition: ESProducer.h:104
TrackerGeomBuilderFromGeometricDet.h
TrackerGeomBuilderFromGeometricDet
Definition: TrackerGeomBuilderFromGeometricDet.h:17
TrackerDigiGeometryESModule::applyAlignment_
const bool applyAlignment_
Definition: TrackerDigiGeometryESModule.cc:53
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
ParameterSet.h
Alignments
Definition: Alignments.h:10
TrackerAlignmentErrorExtendedRcd
Definition: TrackerAlignmentErrorExtendedRcd.h:6
TrackerDigiGeometryESModule::produce
std::unique_ptr< TrackerGeometry > produce(const TrackerDigiGeometryRecord &)
Definition: TrackerDigiGeometryESModule.cc:102
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
TrackerDigiGeometryESModule::deformationsToken_
edm::ESGetToken< AlignmentSurfaceDeformations, TrackerSurfaceDeformationRcd > deformationsToken_
Definition: TrackerDigiGeometryESModule.cc:51
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33
TrackerGeometry
Definition: TrackerGeometry.h:14