Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:52

0001 #include "Geometry/CommonTopologies/interface/GeomDet.h"
0002 #include "Geometry/CommonTopologies/interface/ModifiedSurfaceGenerator.h"
0003 #include "DataFormats/GeometryCommonDetAlgo/interface/AlignmentPositionError.h"
0004 
0005 GeomDet::~GeomDet() { delete theAlignmentPositionError; }
0006 
0007 void GeomDet::move(const GlobalVector& displacement) {
0008   //
0009   // Should recreate the surface like the set* methods ?
0010   //
0011   thePlane->move(displacement);
0012 }
0013 
0014 void GeomDet::rotate(const Surface::RotationType& rotation) {
0015   //
0016   // Should recreate the surface like the set* methods ?
0017   //
0018   thePlane->rotate(rotation);
0019 }
0020 
0021 void GeomDet::setPosition(const Surface::PositionType& position, const Surface::RotationType& rotation) {
0022   thePlane = ModifiedSurfaceGenerator<Plane>(thePlane).atNewPosition(position, rotation);
0023 }
0024 
0025 bool GeomDet::setAlignmentPositionError(const AlignmentPositionError& ape) {
0026   if (!theAlignmentPositionError) {
0027     if (ape.valid())
0028       theAlignmentPositionError = new AlignmentPositionError(ape);
0029   } else
0030     *theAlignmentPositionError = ape;
0031   return ape.valid();
0032 }
0033 
0034 #include "Geometry/CommonTopologies/interface/GeomDet.h"
0035 #include "Geometry/CommonTopologies/interface/GeomDetType.h"
0036 #include "FWCore/Utilities/interface/Exception.h"
0037 
0038 GeomDet::SubDetector GeomDet::subDetector() const { return type().subDetector(); }
0039 
0040 void GeomDet::setSurfaceDeformation(const SurfaceDeformation* /*deformation*/) {
0041   throw cms::Exception("Geometry") << "setting SurfaceDeformation not implemented for DetId "
0042                                    << geographicalId().rawId() << " det=" << geographicalId().det()
0043                                    << " subdetId=" << geographicalId().subdetId();
0044 }
0045 
0046 #include "Geometry/CommonTopologies/interface/Topology.h"
0047 
0048 namespace {
0049   struct DummyTopology final : public Topology {
0050     LocalPoint localPosition(const MeasurementPoint&) const override { return LocalPoint(); }
0051     LocalError localError(const MeasurementPoint&, const MeasurementError&) const override { return LocalError(); }
0052     MeasurementPoint measurementPosition(const LocalPoint&) const override { return MeasurementPoint(); }
0053     MeasurementError measurementError(const LocalPoint&, const LocalError&) const override {
0054       return MeasurementError();
0055     }
0056     int channel(const LocalPoint& p) const override { return -1; }
0057   };
0058   const DummyTopology dummyTopology{};
0059 
0060   struct DummyGeomDetType final : public GeomDetType {
0061     DummyGeomDetType() : GeomDetType("", GeomDetEnumerators::invalidDet) {}
0062     const Topology& topology() const override { return dummyTopology; }
0063   };
0064   const DummyGeomDetType dummyGeomDetType{};
0065 }  // namespace
0066 
0067 const Topology& GeomDet::topology() const { return dummyTopology; }
0068 
0069 const GeomDetType& GeomDet::type() const { return dummyGeomDetType; }