# Project CMSSW displayed by LXR

File indexing completed on 2024-04-06 12:11:20

```0001 #ifndef FASTSIM_FORWARDSIMPLIFIEDGEOMETRY_H
0002 #define FASTSIM_FORWARDSIMPLIFIEDGEOMETRY_H
0003
0004 #include "FastSimulation/SimplifiedGeometryPropagator/interface/SimplifiedGeometry.h"
0005 #include "DataFormats/Math/interface/LorentzVector.h"
0006 #include <TH1F.h>
0007 #include "FWCore/Utilities/interface/Exception.h"
0008
0009 ///////////////////////////////////////////////
0010 // Author: L. Vanelderen, S. Kurz
0011 // Date: 29 May 2017
0012 //////////////////////////////////////////////////////////
0013
0014 namespace fastsim {
0015
0016   //! Implementation of a forward detector layer (disk).
0017   /*!
0018         A disk with a position in Z and a thickness (in radiation length).
0019         The layer is regarded to have an infinite radius, however the thickness can vary (as a function of the radius) and also be 0.
0020     */
0021   class ForwardSimplifiedGeometry : public SimplifiedGeometry {
0022   public:
0023     //! Constructor.
0024     /*!
0025             Create a forward layer with a given position (along z-axis).
0026             \param radius The z-position of the layer (in cm).
0027         */
0028     ForwardSimplifiedGeometry(double z) : SimplifiedGeometry(z) {}
0029
0030     //! Move constructor.
0031     ForwardSimplifiedGeometry(ForwardSimplifiedGeometry &&) = default;
0032
0033     //! Default destructor.
0034     ~ForwardSimplifiedGeometry() override{};
0035
0036     //! Return z-position of the forward layer.
0037     /*!
0038             \return The z-position of the layer (in cm).
0039         */
0040     const double getZ() const { return geomProperty_; }
0041
0042     //! Return thickness of the forward layer at a given position.
0043     /*!
0044             Returns the thickness of the forward layer (in radiation length) at a specified position since the thickness can vary as a function of the radius.
0045             \param position A position which has to be on the forward layer.
0046             \return The thickness of the layer (in radiation length).
0047             \sa getThickness(const math::XYZTLorentzVector & position, const math::XYZTLorentzVector & momentum)
0048         */
0049     const double getThickness(const math::XYZTLorentzVector &position) const override {
0050       return thicknessHist_->GetBinContent(thicknessHist_->GetXaxis()->FindBin(position.Pt()));
0051     }
0052
0053     //! Return thickness of the forward layer at a given position, also considering the incident angle.
0054     /*!
0055             Returns the thickness of the forward layer (in radiation length) at a specified position and a given incident angle since the thickness can vary as a function of the radius.
0056             \param position A position which has to be on the forward layer.
0057             \param momentum The momentum of the incident particle.
0058             \return The thickness of the layer (in radiation length).
0059             \sa getThickness(const math::XYZTLorentzVector & position)
0060         */
0061     const double getThickness(const math::XYZTLorentzVector &position,
0062                               const math::XYZTLorentzVector &momentum) const override {
0063       return getThickness(position) / fabs(momentum.Pz()) * momentum.P();
0064     }
0065
0066     //! Return magnetic field (field only has Z component!) on the forward layer.
0067     /*!
0068             Returns the magnetic field along the forward layer at a specified position (radial symmetric).
0069             \param position A position which has to be on the forward layer.
0070             \return The magnetic field on the layer.
0071         */
0072     const double getMagneticFieldZ(const math::XYZTLorentzVector &position) const override {
0073       return magneticFieldHist_->GetBinContent(magneticFieldHist_->GetXaxis()->FindBin(position.Pt()));
0074     }
0075
0076     //! Returns true since class for forward layer.
0077     /*!
0078             Function to easily destinguish barrel from forward layers (which both inherit from ForwardSimplifiedGeometry).
0079             \return true
0080         */
0081     bool isForward() const override { return true; }
0082   };
0083
0084 }  // namespace fastsim
0085
0086 #endif```