Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:25

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 ///////////////////////////////////////////////////////////////////
0010 // SPForSeed.hpp Acts project
0011 ///////////////////////////////////////////////////////////////////
0012 
0013 #pragma once
0014 
0015 #include <cmath>
0016 
0017 // COLLECTION OF MAGIC NUMBERS IN HERE:
0018 //
0019 //
0020 // m_q        = 100000.;
0021 //
0022 // float cov = wid*wid*.08333;
0023 //
0024 // Pixel Case
0025 //    if(de->isBarrel()) {m_covz = 9.*cov; m_covr = .06;}
0026 //    else               {m_covr = 9.*cov; m_covz = .06;}
0027 //
0028 // SCT Case
0029 //    if(de->isBarrel()) {m_covz = 8.*f22; m_covr = .1;}
0030 //    else               {m_covr = 8.*f22; m_covz = .1;}
0031 
0032 namespace Acts::Legacy {
0033 
0034 template <typename SpacePoint>
0035 class SPForSeed {
0036   /////////////////////////////////////////////////////////////////////////////////
0037   // Public methods:
0038   /////////////////////////////////////////////////////////////////////////////////
0039 
0040  public:
0041   SPForSeed();
0042   SPForSeed(SpacePoint* const& /*sp*/, const float* /*r*/);
0043   SPForSeed(SpacePoint* const& /*sp*/, const float* /*r*/, const float* /*sc*/);
0044   SPForSeed(const SPForSeed& /*sp*/);
0045   virtual ~SPForSeed();
0046   SPForSeed& operator=(const SPForSeed& /*sp*/);
0047 
0048   void set(SpacePoint* const& /*sp*/, const float* /*r*/);
0049   void set(SpacePoint* const& /*sp*/, const float* /*r*/, const float* /*sc*/);
0050   void setQuality(float /*q*/);
0051   void setParam(const float& /*p*/);
0052 
0053   const SpacePoint* spacepoint = nullptr;
0054   const float& x() const { return m_x; }
0055   const float& y() const { return m_y; }
0056   const float& z() const { return m_z; }
0057   const float& radius() const { return m_r; }
0058   float phi() const { return atan2(m_y, m_x); }
0059   const float& covr() const { return m_covr; }
0060   const float& covz() const { return m_covz; }
0061   const float& param() const { return m_param; }
0062   const float& quality() const { return m_q; }
0063 
0064   const int& surface() const { return m_surface; }
0065 
0066  protected:
0067   float m_x = 0;     // x-coordinate in beam system coordinates
0068   float m_y = 0;     // y-coordinate in beam system coordinates
0069   float m_z = 0;     // z-coordinate in beam system coordinetes
0070   float m_r = 0;     // radius       in beam system coordinates
0071   float m_covr = 0;  //
0072   float m_covz = 0;  //
0073   float m_param = 0;
0074   float m_q = 0;
0075 
0076   int m_surface = 0;  // surface identifier
0077 };
0078 
0079 /////////////////////////////////////////////////////////////////////////////////
0080 // Inline methods
0081 /////////////////////////////////////////////////////////////////////////////////
0082 
0083 template <typename SpacePoint>
0084 inline SPForSeed<SpacePoint>::SPForSeed() {
0085   spacepoint = 0;
0086   m_x = 0.;
0087   m_y = 0.;
0088   m_z = 0.;
0089   m_r = 0.;
0090   m_covr = 0.;
0091   m_covz = 0.;
0092   m_param = 0.;
0093   m_q = 0.;
0094 }
0095 
0096 template <typename SpacePoint>
0097 inline SPForSeed<SpacePoint>& SPForSeed<SpacePoint>::operator=(
0098     const SPForSeed<SpacePoint>& sp) {
0099   if (&sp != this) {
0100     spacepoint = sp.spacepoint;
0101     m_x = sp.m_x;
0102     m_y = sp.m_y;
0103     m_z = sp.m_z;
0104     m_r = sp.m_r;
0105     m_covr = sp.m_covr;
0106     m_covz = sp.m_covz;
0107     m_q = sp.m_q;
0108   }
0109   return (*this);
0110 }
0111 
0112 template <typename SpacePoint>
0113 inline SPForSeed<SpacePoint>::SPForSeed(SpacePoint* const& sp, const float* r) {
0114   set(sp, r);
0115   m_param = 0.;
0116 }
0117 
0118 template <typename SpacePoint>
0119 inline SPForSeed<SpacePoint>::SPForSeed(SpacePoint* const& sp, const float* r,
0120                                         const float* sc) {
0121   set(sp, r, sc);
0122   m_param = 0.;
0123 }
0124 
0125 /////////////////////////////////////////////////////////////////////////////////
0126 // Copy constructor
0127 /////////////////////////////////////////////////////////////////////////////////
0128 
0129 template <typename SpacePoint>
0130 inline SPForSeed<SpacePoint>::SPForSeed(const SPForSeed& sp) {
0131   *this = sp;
0132 }
0133 
0134 /////////////////////////////////////////////////////////////////////////////////
0135 // Destructor
0136 /////////////////////////////////////////////////////////////////////////////////
0137 
0138 template <typename SpacePoint>
0139 inline SPForSeed<SpacePoint>::~SPForSeed() = default;
0140 
0141 /////////////////////////////////////////////////////////////////////////////////
0142 // Set
0143 /////////////////////////////////////////////////////////////////////////////////
0144 
0145 template <typename SpacePoint>
0146 inline void SPForSeed<SpacePoint>::set(SpacePoint* const& sp, const float* r) {
0147   spacepoint = sp;
0148   m_x = r[0];
0149   m_y = r[1];
0150   m_z = r[2];
0151   m_r = std::hypot(m_x, m_y);
0152   m_surface = sp->surface;
0153   m_q = 100000.;
0154 
0155   if (!sp->clusterList().second) {
0156     m_covr = sp->covr * 9.;
0157     m_covz = sp->covz * 9.;
0158     if (m_covr < 0.06) {
0159       m_covr = 0.06;
0160     }
0161     if (m_covz < 0.06) {
0162       m_covz = 0.06;
0163     }
0164   } else {
0165     m_covr = sp->covr * 8.;
0166     m_covz = sp->covz * 8.;
0167     if (m_covr < 0.1) {
0168       m_covr = 0.1;
0169     }
0170     if (m_covz < 0.1) {
0171       m_covz = 0.1;
0172     }
0173   }
0174 }
0175 
0176 /////////////////////////////////////////////////////////////////////////////////
0177 // Set with error correction
0178 // sc[0] - barrel pixels error correction
0179 // sc[1] - endcap pixels
0180 // sc[2] - barrel sct
0181 // sc[3] - endcap sct
0182 /////////////////////////////////////////////////////////////////////////////////
0183 
0184 template <typename SpacePoint>
0185 inline void SPForSeed<SpacePoint>::set(SpacePoint* const& sp, const float* r,
0186                                        const float* sc) {
0187   spacepoint = sp;
0188   m_x = r[0];
0189   m_y = r[1];
0190   m_z = r[2];
0191   m_r = std::hypot(m_x, m_y);
0192   m_q = 100000.;
0193   if (!sp->clusterList().second) {
0194     m_covr = sp->covr * 9. * sc[0];
0195     m_covz = sp->covz * 9. * sc[1];
0196     if (m_covr < 0.06) {
0197       m_covr = 0.06;
0198     }
0199     if (m_covz < 0.06) {
0200       m_covz = 0.06;
0201     }
0202   } else {
0203     m_covr = sp->covr * 8. * sc[2];
0204     m_covz = sp->covz * 8. * sc[3];
0205     if (m_covr < 0.1) {
0206       m_covr = 0.1;
0207     }
0208     if (m_covz < 0.1) {
0209       m_covz = 0.1;
0210     }
0211   }
0212 
0213   // old code:
0214   //      const InDet::SiCluster*           c  = static_cast<const
0215   //      InDet::SiCluster*>(sp->clusterList().first);
0216   //      if( de->isPixel() ) {
0217   //
0218   //    const Amg::MatrixX& v =  sp->localCovariance();
0219   //    //ATTENTION: v(1,1) contains error for z in barrel, error for r in
0220   //    endcaps
0221   //    float f22 = float(v(1,1));
0222   //    //ATTENTION: Variable Z contains width of R in the endcaps.
0223   //    float wid = float(c->width().z());
0224   //    float cov = wid*wid*.08333; if(cov < f22) cov = f22;
0225   //    // Set error of low uncertainty dimension (i.e. r for barrel, z for
0226   //    EC)
0227   //    to "small"
0228   //    if(sp->isBarrel()) {m_covz = 9.*cov*sc[0]; m_covr = .06;}
0229   //    else               {m_covr = 9.*cov*sc[1]; m_covz = .06;}
0230   //      }
0231   //      else                {
0232   //
0233   //    const Amg::MatrixX& v = sp->localCovariance();
0234   //    float f22 = float(v(1,1));
0235   //    if(sp->isBarrel()) {m_covz = 8.*f22*sc[2]; m_covr = .1;}
0236   //    else               {m_covr = 8.*f22*sc[3]; m_covz = .1;}
0237   //      }
0238 }
0239 template <typename SpacePoint>
0240 inline void SPForSeed<SpacePoint>::setParam(const float& p) {
0241   m_param = p;
0242 }
0243 template <typename SpacePoint>
0244 inline void SPForSeed<SpacePoint>::setQuality(float q) {
0245   if (q <= m_q) {
0246     m_q = q;
0247   }
0248 }
0249 
0250 }  // namespace Acts::Legacy