Belle II Software  release-08-01-10
ActiveSector.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/dataobjects/FullSecID.h>
11 
12 // C++-std:
13 #include <vector>
14 #include <string>
15 
16 namespace Belle2 {
28  template<class StaticSectorType, class HitType>
29  class ActiveSector {
30  protected:
34  const StaticSectorType* m_staticSector;
35 
37  std::vector<HitType*> m_hits;
38 
40  const std::int32_t m_identifier;
41 
42  public:
47 
51  explicit ActiveSector(const StaticSectorType* staticSector):
52  m_staticSector(staticSector), m_identifier(staticSector->getFullSecID())
53  {}
54 
55 
59  bool operator==(const ActiveSector& b) const
60  {
61  return (getFullSecID() == b.getFullSecID());
62  }
63 
64 
66  bool operator<(const ActiveSector& b) const
67  {
68  return (getFullSecID() < b.getFullSecID());
69  }
70 
71 
73  bool operator>(const ActiveSector& b) const
74  {
75  return (getFullSecID() > b.getFullSecID());
76  }
77 
80 
82  std::int32_t getID() const { return m_identifier; }
83 
85  std::string getName() const
86  {
87  if (m_identifier >= 0)
88  return m_staticSector->getFullSecID().getFullSecString();
89  else
90  return "";
91  }
92 
94  inline const std::vector<HitType*>& getHits() const { return m_hits; }
95 
96 
98  inline const std::vector<FullSecID>& getInner2spSecIDs() const { return m_staticSector->getInner2spSecIDs(); }
99 
100 
102  inline const std::vector<FullSecID>& getInner3spSecIDs() const { return m_staticSector->getInner3spSecIDs(); }
103 
104 
106  inline const std::vector<FullSecID>& getInner4spSecIDs() const { return m_staticSector->getInner4spSecIDs(); }
107 
108 
110  inline const StaticSectorType* getAttachedStaticSector() const { return m_staticSector; }
111 
112 
114  inline FullSecID getFullSecID() const { return m_staticSector->getFullSecID(); }
115 
116 
118 
120  inline void addHit(HitType* newHit) { m_hits.push_back(newHit); }
121 
122 
124  inline void addHits(const std::vector<HitType*>& newHits)
125  {
126  for (HitType* aHit : newHits) { addHit(aHit); }
127  }
128  };
130 } //Belle2 namespace
The ActiveSector Class.
Definition: ActiveSector.h:29
void addHits(const std::vector< HitType * > &newHits)
adds new several new hits to vector of hits
Definition: ActiveSector.h:124
FullSecID getFullSecID() const
returns VxdID of sensor carrying current sector
Definition: ActiveSector.h:114
const std::int32_t m_identifier
unique identifier
Definition: ActiveSector.h:40
const StaticSectorType * getAttachedStaticSector() const
returns pointer to associated static Sector in StoreArray
Definition: ActiveSector.h:110
bool operator>(const ActiveSector &b) const
overloaded '>'-operator for sorting algorithms
Definition: ActiveSector.h:73
const std::vector< FullSecID > & getInner3spSecIDs() const
returns all IDs for inner sectors of three-sector-combinations stored in the static SectorMap
Definition: ActiveSector.h:102
bool operator==(const ActiveSector &b) const
************************* OPERATORS *************************
Definition: ActiveSector.h:59
std::string getName() const
returns longer debugging name of this sector
Definition: ActiveSector.h:85
ActiveSector()
************************* CONSTRUCTORS *************************
Definition: ActiveSector.h:46
const std::vector< HitType * > & getHits() const
returns all indices of attached Hits
Definition: ActiveSector.h:94
ActiveSector(const StaticSectorType *staticSector)
Constructor.
Definition: ActiveSector.h:51
bool operator<(const ActiveSector &b) const
overloaded '<'-operator for sorting algorithms
Definition: ActiveSector.h:66
std::int32_t getID() const
************************* PUBLIC MEMBER FUNCTIONS *************************
Definition: ActiveSector.h:82
const StaticSectorType * m_staticSector
************************* DATA MEMBERS *************************
Definition: ActiveSector.h:34
const std::vector< FullSecID > & getInner4spSecIDs() const
returns all IDs for inner sectors of four-sector-combinations stored in the static SectorMap
Definition: ActiveSector.h:106
std::vector< HitType * > m_hits
stores indices of all associated Hits
Definition: ActiveSector.h:37
const std::vector< FullSecID > & getInner2spSecIDs() const
returns all IDs for inner sectors of two-sector-combinations stored in the static SectorMap
Definition: ActiveSector.h:98
void addHit(HitType *newHit)
setters:
Definition: ActiveSector.h:120
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:33
Abstract base class for different kinds of events.