CMS 3D CMS Logo

MTDDigiGeometryESModule.cc
Go to the documentation of this file.
5 
13 
14 // Alignments
24 
31 
32 #include <memory>
33 #include <string>
34 
36 public:
38  std::unique_ptr<MTDGeometry> produce(const MTDDigiGeometryRecord&);
39 
40  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
41 
42 private:
46 
50 
51  //alignment
56 
57  const bool applyAlignment_; // Switch to apply alignment corrections
58  const bool fromDDD_;
59 };
60 
61 //__________________________________________________________________
63  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
64  myLabel_(p.getParameter<std::string>("appendToDataLabel")),
65  applyAlignment_(p.getParameter<bool>("applyAlignment")),
66  fromDDD_(p.getParameter<bool>("fromDDD"))
67 
68 {
69  auto cc = setWhatProduced(this);
70  const edm::ESInputTag kEmpty;
72  mtdTopoToken_ = cc.consumesFrom<MTDTopology, MTDTopologyRcd>(kEmpty);
73  pmtdParamsToken_ = cc.consumesFrom<PMTDParameters, PMTDParametersRcd>(kEmpty);
74 
75  {
76  const edm::ESInputTag kAlignTag{"", alignmentsLabel_};
77  globalAlignToken_ = cc.consumesFrom<Alignments, GlobalPositionRcd>(kAlignTag);
78  mtdAlignToken_ = cc.consumesFrom<Alignments, MTDAlignmentRcd>(kAlignTag);
81  }
82 
83  edm::LogInfo("Geometry") << "@SUB=MTDDigiGeometryESModule"
84  << "Label '" << myLabel_ << "' " << (applyAlignment_ ? "looking for" : "IGNORING")
85  << " alignment labels '" << alignmentsLabel_ << "'.";
86 }
87 
88 //__________________________________________________________________
91  descDB.add<std::string>("appendToDataLabel", "");
92  descDB.add<bool>("fromDDD", false);
93  descDB.add<bool>("applyAlignment", true);
94  descDB.add<std::string>("alignmentsLabel", "");
95  descriptions.add("mtdGeometryDB", descDB);
96 
98  desc.add<std::string>("appendToDataLabel", "");
99  desc.add<bool>("fromDDD", true);
100  desc.add<bool>("applyAlignment", true);
101  desc.add<std::string>("alignmentsLabel", "");
102  descriptions.add("mtdGeometry", desc);
103 }
104 
105 //__________________________________________________________________
106 std::unique_ptr<MTDGeometry> MTDDigiGeometryESModule::produce(const MTDDigiGeometryRecord& iRecord) {
107  //
108  // Called whenever the alignments, alignment errors or global positions change
109  //
110  GeometricTimingDet const& gD = iRecord.get(geomTimingDetToken_);
111 
112  MTDTopology const& tTopo = iRecord.get(mtdTopoToken_);
113 
114  PMTDParameters const& ptp = iRecord.get(pmtdParamsToken_);
115 
117  std::unique_ptr<MTDGeometry> mtd(builder.build(&(gD), ptp, &tTopo));
118 
119  if (applyAlignment_) {
120  // Since fake is fully working when checking for 'empty', we should get rid of applyAlignment_!
121  Alignments const& globalPosition = iRecord.get(globalAlignToken_);
122  Alignments const& alignments = iRecord.get(mtdAlignToken_);
123  AlignmentErrorsExtended const& alignmentErrors = iRecord.get(alignErrorsToken_);
124  // apply if not empty:
125  if (alignments.empty() && alignmentErrors.empty() && globalPosition.empty()) {
126  edm::LogInfo("Config") << "@SUB=MTDDigiGeometryRecord::produce"
127  << "Alignment(Error)s and global position (label '" << alignmentsLabel_
128  << "') empty: Geometry producer (label "
129  << "'" << myLabel_ << "') assumes fake and does not apply.";
130  } else {
131  GeometryAligner ali;
132  ali.applyAlignments<MTDGeometry>(mtd.get(),
133  &(alignments),
134  &(alignmentErrors),
136  }
137 
138  AlignmentSurfaceDeformations const& surfaceDeformations = iRecord.get(deformationsToken_);
139  // apply if not empty:
140  if (surfaceDeformations.empty()) {
141  edm::LogInfo("Config") << "@SUB=MTDDigiGeometryRecord::produce"
142  << "AlignmentSurfaceDeformations (label '" << alignmentsLabel_
143  << "') empty: Geometry producer (label "
144  << "'" << myLabel_ << "') assumes fake and does not apply.";
145  } else {
146  GeometryAligner ali;
147  ali.attachSurfaceDeformations<MTDGeometry>(mtd.get(), &(surfaceDeformations));
148  }
149  }
150 
151  return mtd;
152 }
153 
ConfigurationDescriptions.h
MTDDigiGeometryRecord
Definition: MTDDigiGeometryRecord.h:15
PMTDParameters
Definition: PMTDParameters.h:6
AlignmentErrorsExtended.h
MTDDigiGeometryESModule::mtdTopoToken_
edm::ESGetToken< MTDTopology, MTDTopologyRcd > mtdTopoToken_
Definition: MTDDigiGeometryESModule.cc:48
MTDDigiGeometryESModule::produce
std::unique_ptr< MTDGeometry > produce(const MTDDigiGeometryRecord &)
Definition: MTDDigiGeometryESModule.cc:106
GlobalPositionRcd.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MTDSurfaceDeformationRcd
Definition: MTDSurfaceDeformationRcd.h:6
MTDGeomBuilderFromGeometricTimingDet.h
ESHandle.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MTDDigiGeometryESModule
Definition: MTDDigiGeometryESModule.cc:35
MTDSurfaceDeformationRcd.h
MTDAlignmentErrorExtendedRcd
Definition: MTDAlignmentErrorExtendedRcd.h:6
MTDGeometry.h
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
MTDDigiGeometryRecord.h
DetectorGlobalPosition.h
MTDDigiGeometryESModule::pmtdParamsToken_
edm::ESGetToken< PMTDParameters, PMTDParametersRcd > pmtdParamsToken_
Definition: MTDDigiGeometryESModule.cc:49
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
GeometryAligner::applyAlignments
void applyAlignments(const C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: GeometryAligner.h:52
GlobalPositionRcd
Definition: GlobalPositionRcd.h:6
MTDDigiGeometryESModule::alignErrorsToken_
edm::ESGetToken< AlignmentErrorsExtended, MTDAlignmentErrorExtendedRcd > alignErrorsToken_
Definition: MTDDigiGeometryESModule.cc:54
MTDDigiGeometryESModule::mtdAlignToken_
edm::ESGetToken< Alignments, MTDAlignmentRcd > mtdAlignToken_
Definition: MTDDigiGeometryESModule.cc:53
MTDDigiGeometryESModule::MTDDigiGeometryESModule
MTDDigiGeometryESModule(const edm::ParameterSet &p)
Definition: MTDDigiGeometryESModule.cc:62
MTDDigiGeometryESModule::deformationsToken_
edm::ESGetToken< AlignmentSurfaceDeformations, MTDSurfaceDeformationRcd > deformationsToken_
Definition: MTDDigiGeometryESModule.cc:55
DetId
Definition: DetId.h:17
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MTDAlignmentRcd
Definition: MTDAlignmentRcd.h:6
AlignmentErrorsExtended::empty
bool empty() const
Test of empty vector without having to look into internals:
Definition: AlignmentErrorsExtended.h:15
AlignmentSurfaceDeformations::empty
bool empty() const
Test of empty vector without having to look into internals:
Definition: AlignmentSurfaceDeformations.h:38
MTDDigiGeometryESModule::globalAlignToken_
edm::ESGetToken< Alignments, GlobalPositionRcd > globalAlignToken_
Definition: MTDDigiGeometryESModule.cc:52
MTDGeomBuilderFromGeometricTimingDet
Definition: MTDGeomBuilderFromGeometricTimingDet.h:16
ParameterSetDescription.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:103
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MTDDigiGeometryESModule::alignmentsLabel_
const std::string alignmentsLabel_
Called when geometry description changes.
Definition: MTDDigiGeometryESModule.cc:44
PMTDParametersRcd.h
MTDTopology
Definition: MTDTopology.h:16
edm::ParameterSet
Definition: ParameterSet.h:47
align::DetectorGlobalPosition
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Definition: DetectorGlobalPosition.cc:10
MTDTopologyRcd
Definition: MTDTopologyRcd.h:10
PMTDParametersRcd
Definition: PMTDParametersRcd.h:9
MTDGeomBuilderFromGeometricTimingDet::build
MTDGeometry * build(const GeometricTimingDet *gd, const PMTDParameters &ptp, const MTDTopology *tTopo)
Definition: MTDGeomBuilderFromGeometricTimingDet.cc:36
MTDDigiGeometryESModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MTDDigiGeometryESModule.cc:89
GeometricTimingDet
Definition: GeometricTimingDet.h:29
MTDDigiGeometryESModule::applyAlignment_
const bool applyAlignment_
Definition: MTDDigiGeometryESModule.cc:57
MTDDigiGeometryESModule::myLabel_
const std::string myLabel_
Definition: MTDDigiGeometryESModule.cc:45
AlignmentSurfaceDeformations
Definition: AlignmentSurfaceDeformations.h:20
IdealGeometryRecord.h
cc
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
edm::ESGetToken< GeometricTimingDet, IdealGeometryRecord >
MTDGeometry
Definition: MTDGeometry.h:14
GeometryAligner::attachSurfaceDeformations
void attachSurfaceDeformations(const C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
Definition: GeometryAligner.h:120
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
MTDDigiGeometryESModule::geomTimingDetToken_
edm::ESGetToken< GeometricTimingDet, IdealGeometryRecord > geomTimingDetToken_
Definition: MTDDigiGeometryESModule.cc:47
MTDAlignmentErrorExtendedRcd.h
std
Definition: JetResolutionObject.h:76
GeometricTimingDet.h
MTDTopologyRcd.h
GeometryAligner.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
AlignmentSurfaceDeformations.h
PMTDParameters.h
EventSetup.h
edm::ESProducer
Definition: ESProducer.h:104
Alignments::empty
bool empty() const
Test of empty vector without having to look into internals:
Definition: Alignments.h:15
MTDAlignmentRcd.h
ParameterSet.h
mtd_digitizer
Definition: MTDDigitizer.h:35
DetId::Forward
Definition: DetId.h:30
Alignments
Definition: Alignments.h:10
MTDDigiGeometryESModule::fromDDD_
const bool fromDDD_
Definition: MTDDigiGeometryESModule.cc:58
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
MTDTopology.h
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33