diff --git a/Core/include/Core/Material.h b/Core/include/Core/Material.h new file mode 100644 index 0000000000000000000000000000000000000000..7d88fd4c73d4d99db4e7290e14d28b947cfabc3b --- /dev/null +++ b/Core/include/Core/Material.h @@ -0,0 +1,48 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2020 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#pragma once + +#include + +#include + +using LHCb::Detector::NotImplemented; + +namespace LHCb::Detector { + + /** + * Handle class around ROOT TGeoMedium describing a Material + * + * Extends the Material class defined in DD4hep, so that an + * interface backward compatible with DetDesc can be offered + */ + struct Material : dd4hep::Material { + + using dd4hep::Material::Material; + + /// Material name accessors + const std::string& name() const; + + /// Material radiation length [cm] + double radiationLength() const { return radLength(); }; + + /// Mean excitiation energy + double I() const { throw NotImplemented(); } + + /// Parameters for density effect correction + double C() const { throw NotImplemented(); } + double a() const { throw NotImplemented(); } + double m() const { throw NotImplemented(); } + double X1() const { throw NotImplemented(); } + double X0() const { throw NotImplemented(); } + }; + +} // namespace LHCb::Detector diff --git a/Detector/VP/include/Detector/VP/DeVP.h b/Detector/VP/include/Detector/VP/DeVP.h index a50f56f8e151bedcf1bbd8af982833f4cfdd5fd6..05bf264d94eb60740ea61ccfb58f856b0851b8fe 100644 --- a/Detector/VP/include/Detector/VP/DeVP.h +++ b/Detector/VP/include/Detector/VP/DeVP.h @@ -67,6 +67,12 @@ namespace LHCb::Detector { /// Sine squared of rotation angle for each sensor. std::array m_s2; /// Return the pixel size. + // beamspot + ROOT::Math::XYZPoint m_beamSpot{0., 0., 0.}; + + // whether the velo is closed + bool m_isVeloClosed{false}; + void applyToAllChildren( const std::function& func ) const override { for ( auto& side : sides ) { func( LHCb::Detector::DeIOV{&side} ); }; }; @@ -150,13 +156,9 @@ namespace LHCb::Detector { const DeVPSide left() const { return DeVPSide( &( this->access()->sides[0] ) ); } /// Compute the center of the moving velo and call it 'beamSpot' - auto beamSpot() const { - // It is understandable - const auto leftpos = this->toGlobal( left().motionSystemTransform().value()( ROOT::Math::XYZPoint{0, 0, 0} ) ); - const auto rightpos = this->toGlobal( right().motionSystemTransform().value()( ROOT::Math::XYZPoint{0, 0, 0} ) ); - // It is understandable that we cannot add points, but it makes taking averages cumbersome - return ROOT::Math::XYZPoint{0.5 * ( ROOT::Math::XYZVector{leftpos} + ROOT::Math::XYZVector{rightpos} )}; - } + auto beamSpot() const { return this->access()->m_beamSpot; } + /// says whether the velo is closed + auto veloClosed() const { return this->access()->m_isVeloClosed; } }; using DeVP = DeVPElement; } // End namespace LHCb::Detector diff --git a/Detector/VP/src/DeVP.cpp b/Detector/VP/src/DeVP.cpp index 1c011fa99b0206914240ea7c10e3c4ef35d8716b..555ff6aa35d9d4e953dd3a5c622eddcb6b2ee860 100644 --- a/Detector/VP/src/DeVP.cpp +++ b/Detector/VP/src/DeVP.cpp @@ -52,7 +52,14 @@ LHCb::Detector::detail::DeVPObject::DeVPObject( const dd4hep::DetElement& m_s2[to_unsigned( sensor.sensorNumber )] = vg.y() * vg.y(); // sin^2 } } - }; + } + // Compute the center of the moving velo and call it 'beamSpot' + const auto leftpos = this->toGlobal( sides[0].motionSystemTransform().value()( ROOT::Math::XYZPoint{0, 0, 0} ) ); + const auto rightpos = this->toGlobal( sides[1].motionSystemTransform().value()( ROOT::Math::XYZPoint{0, 0, 0} ) ); + m_beamSpot = ROOT::Math::XYZPoint{0.5 * ( ROOT::Math::XYZVector{leftpos} + ROOT::Math::XYZVector{rightpos} )}; + // Computes whether velo is closed + m_isVeloClosed = ( std::abs( leftpos.x() - m_beamSpot.x() ) < 5 * dd4hep::mm && + std::abs( rightpos.x() - m_beamSpot.x() ) < 5 * dd4hep::mm ); } LHCb::Detector::detail::DeVPSideObject::DeVPSideObject( const dd4hep::DetElement& de,