Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-07 08:11:11

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