Belle II Software  release-05-02-19
ActiveSector.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jakob Lettenbichler *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/dataobjects/FullSecID.h>
13 
14 // C++-std:
15 #include <vector>
16 #include <string>
17 
18 namespace Belle2 {
30  template<class StaticSectorType, class HitType>
31  class ActiveSector {
32  protected:
36  const StaticSectorType* m_staticSector;
37 
39  std::vector<HitType*> m_hits;
40 
42  const std::int32_t m_identifier;
43 
44  public:
49 
53  explicit ActiveSector(const StaticSectorType* staticSector):
54  m_staticSector(staticSector), m_identifier(staticSector->getFullSecID())
55  {}
56 
57 
61  bool operator==(const ActiveSector& b) const
62  {
63  return (getFullSecID() == b.getFullSecID());
64  }
65 
66 
68  bool operator<(const ActiveSector& b) const
69  {
70  return (getFullSecID() < b.getFullSecID());
71  }
72 
73 
75  bool operator>(const ActiveSector& b) const
76  {
77  return (getFullSecID() > b.getFullSecID());
78  }
79 
81 
84  std::int32_t getID() const { return m_identifier; }
85 
87  std::string getName() const
88  {
89  if (m_identifier >= 0)
90  return m_staticSector->getFullSecID().getFullSecString();
91  else
92  return "";
93  }
94 
96  inline const std::vector<HitType*>& getHits() const { return m_hits; }
97 
98 
100  inline const std::vector<FullSecID>& getInner2spSecIDs() const { return m_staticSector->getInner2spSecIDs(); }
101 
102 
104  inline const std::vector<FullSecID>& getInner3spSecIDs() const { return m_staticSector->getInner3spSecIDs(); }
105 
106 
108  inline const std::vector<FullSecID>& getInner4spSecIDs() const { return m_staticSector->getInner4spSecIDs(); }
109 
110 
112  inline const StaticSectorType* getAttachedStaticSector() const { return m_staticSector; }
113 
114 
116  inline FullSecID getFullSecID() const { return m_staticSector->getFullSecID(); }
117 
118 
120 
122  inline void addHit(HitType* newHit) { m_hits.push_back(newHit); }
123 
124 
126  inline void addHits(std::vector<HitType*>& newHits)
127  {
128  for (HitType* aHit : newHits) { addHit(aHit); }
129  }
130  };
132 } //Belle2 namespace
Belle2::ActiveSector::operator>
bool operator>(const ActiveSector &b) const
overloaded '>'-operator for sorting algorithms
Definition: ActiveSector.h:83
Belle2::ActiveSector::getName
std::string getName() const
returns longer debugging name of this sector
Definition: ActiveSector.h:95
Belle2::ActiveSector
The ActiveSector Class.
Definition: ActiveSector.h:39
Belle2::ActiveSector::m_staticSector
const StaticSectorType * m_staticSector
************************* DATA MEMBERS *************************
Definition: ActiveSector.h:44
Belle2::ActiveSector::getHits
const std::vector< HitType * > & getHits() const
returns all indices of attached Hits
Definition: ActiveSector.h:104
Belle2::ActiveSector::m_identifier
const std::int32_t m_identifier
unique identifier
Definition: ActiveSector.h:50
Belle2::ActiveSector::getAttachedStaticSector
const StaticSectorType * getAttachedStaticSector() const
returns pointer to associated static Sector in StoreArray
Definition: ActiveSector.h:120
Belle2::ActiveSector::getFullSecID
FullSecID getFullSecID() const
returns VxdID of sensor carrying current sector
Definition: ActiveSector.h:124
Belle2::ActiveSector::getInner3spSecIDs
const std::vector< FullSecID > & getInner3spSecIDs() const
returns all IDs for inner sectors of three-sector-combinations stored in the static SectorMap
Definition: ActiveSector.h:112
Belle2::ActiveSector::operator==
bool operator==(const ActiveSector &b) const
************************* OPERATORS *************************
Definition: ActiveSector.h:69
Belle2::ActiveSector::operator<
bool operator<(const ActiveSector &b) const
overloaded '<'-operator for sorting algorithms
Definition: ActiveSector.h:76
Belle2::FullSecID
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:43
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ActiveSector::m_hits
std::vector< HitType * > m_hits
stores indices of all associated Hits
Definition: ActiveSector.h:47
Belle2::ActiveSector::addHits
void addHits(std::vector< HitType * > &newHits)
adds new several new hits to vector of hits
Definition: ActiveSector.h:134
Belle2::ActiveSector::getID
std::int32_t getID() const
************************* PUBLIC MEMBER FUNCTIONS *************************
Definition: ActiveSector.h:92
Belle2::ActiveSector::getInner2spSecIDs
const std::vector< FullSecID > & getInner2spSecIDs() const
returns all IDs for inner sectors of two-sector-combinations stored in the static SectorMap
Definition: ActiveSector.h:108
Belle2::ActiveSector::addHit
void addHit(HitType *newHit)
setters:
Definition: ActiveSector.h:130
Belle2::ActiveSector::getInner4spSecIDs
const std::vector< FullSecID > & getInner4spSecIDs() const
returns all IDs for inner sectors of four-sector-combinations stored in the static SectorMap
Definition: ActiveSector.h:116
Belle2::ActiveSector::ActiveSector
ActiveSector()
************************* CONSTRUCTORS *************************
Definition: ActiveSector.h:56