Belle II Software  release-05-02-19
Sector.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - 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 
11 #pragma once
12 
13 // includes - rootStuff:
14 // includes - stl:
15 #include <vector>
16 #include <string>
17 
18 // includes - tf-related stuff
19 // includes - general fw stuff
20 #include <framework/datastore/RelationsObject.h>
21 
22 
23 namespace Belle2 {
31  class ActivatedSector;
32 
33 
35  class SectorFriendship;
36 
37 
45  class Sector : public RelationsObject {
46  public:
47 
48 
50  Sector():
51  m_myActiveSector(NULL),
52  m_sectorID(0),
54  m_useDistance4sort(false)
55  {}
56 
57 
59  explicit Sector(unsigned int secID):
60  m_myActiveSector(NULL),
61  m_sectorID(secID),
63  m_useDistance4sort(false)
64  {}
65 
66 
71  Sector(unsigned int secID, float distance2origin, bool sortByDistance = true):
72  m_myActiveSector(NULL),
73  m_sectorID(secID),
74  m_distance2Origin(distance2origin),
75  m_useDistance4sort(sortByDistance)
76  {}
77 
81  Sector(const Sector&) = default;
82 
83 
85  Sector& operator=(const Sector& aSector)
86  {
87  m_myActiveSector = aSector.getMyActiveSector();
88  m_sectorID = aSector.getSecID();
89  m_distance2Origin = aSector.getDistance();
90  m_useDistance4sort = aSector.useDistance4sort();
91  return *this;
92  }
93 
94 
96  bool operator<(const Sector& b) const
97  {
98  if (m_useDistance4sort == false) { return getSecID() < b.getSecID(); }
99  return getDistance() < b.getDistance();
100  }
101 
102 
104  bool operator==(const Sector& b) const
105  {
106  if (useDistance4sort() == false) { return getSecID() == b.getSecID(); }
107  return getDistance() == b.getDistance();
108  }
109 
110 
112  bool operator>(const Sector& b) const
113  {
114  if (useDistance4sort() == false) { return getSecID() > b.getSecID(); }
115  return getDistance() > b.getDistance();
116  }
117 
118 
120  void segmentMaker();
121 
122 
124  virtual void clear() { m_myActiveSector = NULL; }
125 
126 
129 
130 
132  void setDistance(float distance) { m_distance2Origin = distance; }
133 
134 
136  float getDistance() const { return m_distance2Origin; }
137 
138 
140  unsigned getSecID() const { return m_sectorID; }
141 
142 
144  std::string printSector();
145 
146 
148  bool useDistance4sort() const { return m_useDistance4sort; }
149 
150 
152  void setDistance4sort(bool sortByDistance) { m_useDistance4sort = sortByDistance; }
153 
154 
155  protected:
156 
157 
160 
161 
163  std::vector<SectorFriendship*> m_myFriends;
164 
165 
174  unsigned int m_sectorID;
175 
176 
183  float m_distance2Origin;
184 
185 
187  bool m_useDistance4sort;
188 
189 
190  ClassDef(Sector, 1)
191  };
193 } //Belle2 namespace
Belle2::Sector::useDistance4sort
bool useDistance4sort() const
if true, usingDistance for sector sorting is activated, if false, the sectorID is used
Definition: Sector.h:156
Belle2::ActivatedSector
ActivatedSector is carrying the dynamic part of a Sector.
Definition: ActivatedSector.h:44
Belle2::Sector
Sector is a central part of storing information for VXD trackFinders.
Definition: Sector.h:53
Belle2::Sector::operator=
Sector & operator=(const Sector &aSector)
overloaded assignment operator
Definition: Sector.h:93
Belle2::RelationsInterface::ClassDef
ClassDef(RelationsInterface, 0)
defines interface for accessing relations of objects in StoreArray.
Belle2::Sector::operator<
bool operator<(const Sector &b) const
overloaded '<'-operator for sorting algorithms - sorts by distance2origin or fullSecID depending on s...
Definition: Sector.h:104
Belle2::Sector::setDistance4sort
void setDistance4sort(bool sortByDistance)
if you pass a true here, the sorting will be set to using the distance to origind instead of the sect...
Definition: Sector.h:160
Belle2::Sector::getSecID
unsigned getSecID() const
getter - getSecID returns the ID of the sector (for definition of secID, see m_sectorID).
Definition: Sector.h:148
Belle2::Sector::m_sectorID
unsigned int m_sectorID
secID allows identification of sector.
Definition: Sector.h:182
Belle2::Sector::m_distance2Origin
float m_distance2Origin
carries info about the distance of the sector-center to the origin.
Definition: Sector.h:191
Belle2::Sector::Sector
Sector()
constructor
Definition: Sector.h:58
Belle2::Sector::m_myActiveSector
ActivatedSector * m_myActiveSector
The activated sector is created each event where this sector inhabits a spacePoint.
Definition: Sector.h:167
Belle2::Sector::m_useDistance4sort
bool m_useDistance4sort
if activated, sectors are sorted by distance to origin, if false, they are sorted by layerID.
Definition: Sector.h:195
Belle2::Sector::setDistance
void setDistance(float distance)
setter - set distance of sector to origin defined by sectorMap
Definition: Sector.h:140
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Sector::printSector
std::string printSector()
printing member, delivers string of interesting features of current sector
Definition: Sector.cc:28
Belle2::Sector::getDistance
float getDistance() const
getter - get distance of sector to origin defined by sectorMap
Definition: Sector.h:144
Belle2::Sector::operator==
bool operator==(const Sector &b) const
overloaded '=='-operator for sorting algorithms - sorts by distance2origin or fullSecID depending on ...
Definition: Sector.h:112
Belle2::Sector::getMyActiveSector
ActivatedSector * getMyActiveSector() const
getter - returns a pointer to the currently connected activatedSector
Definition: Sector.h:136
Belle2::Sector::segmentMaker
void segmentMaker()
called each event - takes all spacePoints from the activated Sector and its friend Sectors to produce...
Definition: Sector.cc:20
Belle2::Sector::clear
virtual void clear()
removes link to activated sector.
Definition: Sector.h:132
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::Sector::operator>
bool operator>(const Sector &b) const
overloaded '>'-operator for sorting algorithms - sorts by distance2origin or fullSecID depending on s...
Definition: Sector.h:120
Belle2::Sector::m_myFriends
std::vector< SectorFriendship * > m_myFriends
This vector carries a pointer to each SectorFriendship for faster access during events.
Definition: Sector.h:171