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 // InternalSeed.hpp Acts project
0011 ///////////////////////////////////////////////////////////////////
0012 
0013 #pragma once
0014 
0015 #include "Acts/Seeding/LegacySeed.hpp"
0016 #include "Acts/Seeding/SPForSeed.hpp"
0017 
0018 namespace Acts::Legacy {
0019 template <typename SpacePoint>
0020 class InternalSeed {
0021   /////////////////////////////////////////////////////////////////////////////////
0022   // Public methods:
0023   /////////////////////////////////////////////////////////////////////////////////
0024 
0025  public:
0026   InternalSeed();
0027   InternalSeed(SPForSeed<SpacePoint>*& /*s0*/, SPForSeed<SpacePoint>*& /*s1*/,
0028                SPForSeed<SpacePoint>*& /*s2*/, float /*z*/);
0029   InternalSeed(const InternalSeed<SpacePoint>& /*sp*/);
0030   virtual ~InternalSeed();
0031   InternalSeed<SpacePoint>& operator=(const InternalSeed<SpacePoint>& /*sp*/);
0032 
0033   SPForSeed<SpacePoint>* spacepoint0() { return m_s0; }
0034   SPForSeed<SpacePoint>* spacepoint1() { return m_s1; }
0035   SPForSeed<SpacePoint>* spacepoint2() { return m_s2; }
0036   const float& z() const { return m_z; }
0037   const float& quality() const { return m_q; }
0038 
0039   void set(SPForSeed<SpacePoint>*& /*s0*/, SPForSeed<SpacePoint>*& /*s1*/,
0040            SPForSeed<SpacePoint>*& /*s2*/, float /*z*/);
0041 
0042   bool setQuality(float /*q*/);
0043 
0044   bool set3(Acts::Legacy::Seed<SpacePoint>& /*s*/);
0045 
0046  protected:
0047   SPForSeed<SpacePoint>* m_s0 = nullptr;
0048   SPForSeed<SpacePoint>* m_s1 = nullptr;
0049   SPForSeed<SpacePoint>* m_s2 = nullptr;
0050   float m_z = 0;
0051   float m_q = 0;
0052 };
0053 
0054 /// @cond
0055 
0056 /////////////////////////////////////////////////////////////////////////////////
0057 // Inline methods
0058 /////////////////////////////////////////////////////////////////////////////////
0059 
0060 template <typename SpacePoint>
0061 inline InternalSeed<SpacePoint>::InternalSeed() {
0062   m_s0 = nullptr;
0063   m_s1 = nullptr;
0064   m_s2 = nullptr;
0065   m_z = 0.;
0066   m_q = 0.;
0067 }
0068 
0069 template <typename SpacePoint>
0070 inline InternalSeed<SpacePoint>& InternalSeed<SpacePoint>::operator=(
0071     const InternalSeed& sp) {
0072   if (&sp != this) {
0073     m_z = sp.m_z;
0074     m_q = sp.m_q;
0075     m_s0 = sp.m_s0;
0076     m_s1 = sp.m_s1;
0077     m_s2 = sp.m_s2;
0078   }
0079   return (*this);
0080 }
0081 
0082 template <typename SpacePoint>
0083 inline InternalSeed<SpacePoint>::InternalSeed(SPForSeed<SpacePoint>*& s0,
0084                                               SPForSeed<SpacePoint>*& s1,
0085                                               SPForSeed<SpacePoint>*& s2,
0086                                               float z) {
0087   set(s0, s1, s2, z);
0088   m_q = 0.;
0089 }
0090 
0091 /////////////////////////////////////////////////////////////////////////////////
0092 // Copy constructor
0093 /////////////////////////////////////////////////////////////////////////////////
0094 
0095 template <typename SpacePoint>
0096 inline InternalSeed<SpacePoint>::InternalSeed(const InternalSeed& sp)
0097     : m_s0(sp.m_s0), m_s1(sp.m_s1), m_s2(sp.m_s2) {
0098   *this = sp;
0099 }
0100 
0101 /////////////////////////////////////////////////////////////////////////////////
0102 // Destructor
0103 /////////////////////////////////////////////////////////////////////////////////
0104 
0105 template <typename SpacePoint>
0106 inline InternalSeed<SpacePoint>::~InternalSeed() = default;
0107 
0108 /////////////////////////////////////////////////////////////////////////////////
0109 // Set
0110 /////////////////////////////////////////////////////////////////////////////////
0111 
0112 template <typename SpacePoint>
0113 inline void InternalSeed<SpacePoint>::set(SPForSeed<SpacePoint>*& s0,
0114                                           SPForSeed<SpacePoint>*& s1,
0115                                           SPForSeed<SpacePoint>*& s2, float z) {
0116   m_z = z;
0117   m_s0 = s0;
0118   m_s1 = s1;
0119   m_s2 = s2;
0120 }
0121 
0122 /////////////////////////////////////////////////////////////////////////////////
0123 // Set three space points seed
0124 /////////////////////////////////////////////////////////////////////////////////
0125 
0126 template <typename SpacePoint>
0127 inline bool InternalSeed<SpacePoint>::set3(Acts::Legacy::Seed<SpacePoint>& s) {
0128   bool pixb = !m_s0->spacepoint->clusterList().second;
0129   bool pixt = !m_s2->spacepoint->clusterList().second;
0130 
0131   if (pixb != pixt) {
0132     if (m_q > m_s0->quality() && m_q > m_s1->quality() &&
0133         m_q > m_s2->quality()) {
0134       return false;
0135     }
0136   }
0137 
0138   m_s0->setQuality(m_q);
0139   m_s1->setQuality(m_q);
0140   m_s2->setQuality(m_q);
0141 
0142   s.erase();
0143   s.add(m_s0->spacepoint);
0144   s.add(m_s1->spacepoint);
0145   s.add(m_s2->spacepoint);
0146   s.setZVertex(static_cast<double>(m_z));
0147   return true;
0148 }
0149 
0150 /////////////////////////////////////////////////////////////////////////////////
0151 // Set quality in pro seed
0152 /////////////////////////////////////////////////////////////////////////////////
0153 
0154 template <typename SpacePoint>
0155 inline bool InternalSeed<SpacePoint>::setQuality(float q) {
0156   m_q = q;
0157   bool pixb = !m_s0->spacepoint->clusterList().second;
0158   bool pixt = !m_s2->spacepoint->clusterList().second;
0159   if (pixb == pixt) {
0160     m_s0->setQuality(q);
0161     m_s1->setQuality(q);
0162     m_s2->setQuality(q);
0163     return true;
0164   }
0165   if (q < m_s0->quality() || q < m_s1->quality() || q < m_s2->quality()) {
0166     return true;
0167   }
0168   return false;
0169 }
0170 
0171 /// @endcond
0172 
0173 }  // namespace Acts::Legacy