Belle II Software development
StaticSector< HitType, Filter2sp, Filter3sp, Filter4sp > Class Template Reference

class to describe a static sector of the sector map. More...

#include <StaticSector.h>

Public Member Functions

 StaticSector ()
 CONSTRUCTORS.
 
 StaticSector (FullSecID secID)
 constructor
 
const Filter2sp * getFilter2sp (FullSecID innerSector) const
 Get the pionter to the 2 Space Point filter assigned to the friendship relation among this sector; will return nullptr if filter is not found.
 
const Filter3sp * getFilter3sp (const FullSecID &centerID, const FullSecID &innerID) const
 Get the pionter to the 3 Space Point filter assigned to the friendship relation among this sector; will return nullptr if filter is not found.
 
const Filter4sp * getFilter4sp (const FullSecID &, const FullSecID &, const FullSecID &) const
 Get the pionter to the 4 Space Point filter assigned to the WARNING: not implemented yet.
 
const std::unordered_map< CompactSecIDs::sectorID_t, Filter2sp > & getAllFilters2sp () const
 Get constant access to the whole set of 2 Space Point filters.
 
const std::unordered_map< CompactSecIDs::secPairID_t, Filter3sp > & getAllFilters3sp () const
 Get constant access to the whole set of 3 Space Point filters.
 
const std::unordered_map< CompactSecIDs::secTripletID_t, Filter4sp > & getAllFilters4sp () const
 Get constant access to the whole set of 4 Space Point filters.
 
void assignCompactSecIDsMap (const CompactSecIDs &compactSecIDsMap)
 Assign the compact sector ID to this sector.
 
void assign2spFilter (FullSecID inner, const Filter2sp filter)
 Assign the 2 space point.
 
void assign3spFilter (FullSecID center, FullSecID inner, const Filter3sp filter)
 Parameters: pass the ID of the inner sectors (sorted from outer(left) to inner(right) and the filters you like to attach.
 
void assign4spFilter (FullSecID outerCenter, FullSecID innerCenter, FullSecID inner, const Filter3sp filter)
 Parameters: pass the ID of the inner sectors (sorted from outer(left) to inner(right) and the filters you like to attach.
 
void setSubLayerID (int sublayer)
 set sublayer ID, needed as it is updated in the trainings phase
 
const std::vector< FullSecID > & getInner2spSecIDs () const
 returns all IDs for inner sectors of two-sector-combinations
 
const std::vector< std::pair< FullSecID, FullSecID > > & getInner3spSecIDs () const
 returns all IDs for inner sectors of three-sector-combinations
 
const std::vector< std::tuple< FullSecID, FullSecID, FullSecID > > & getInner4spSecIDs () const
 returns all IDs for inner sectors of four-sector-combinations
 
FullSecID getFullSecID () const
 returns FullSecID of this sector
 
bool operator== (const StaticSector &b) const
 COMPARISON OPERATORS.
 
bool operator== (const FullSecID &b) const
 == -operator - compares if two StaticSectors are identical
 

Private Member Functions

void modify2SPFilters (const std::vector< std::tuple< int, std::string > > &adjustFunctions)
 PRIVATE MEMBERS.
 
void modify3SPFilters (const std::vector< std::tuple< int, std::string > > &adjustFunctions)
 function that modifies all 3SP-filters connected to this static sector
 
template<class FilterType >
void modifySingleFilter (FilterType &filter, const std::vector< std::tuple< int, std::string > > &adjustFunctions)
 Function that modifies the uper and lower bounds of the Ranges contained in the filter.
 

Private Attributes

FullSecID m_secID
 stores its own secID
 
const CompactSecIDsm_compactSecIDsMap
 map from FullSecID to CompactSecID
 
std::vector< FullSecIDm_inner2spSecIDs
 stores innerSecIDs for the attached 2-hit filters
 
std::vector< std::pair< FullSecID, FullSecID > > m_inner3spSecIDs
 stores innerSecIDs for the attached 3-hit filters
 
std::vector< std::tuple< FullSecID, FullSecID, FullSecID > > m_inner4spSecIDs
 stores innerSecIDs for the attached 4-hit filters
 
std::unordered_map< CompactSecIDs::sectorID_t, Filter2sp > m_2spFilters
 stores the attached 2-hit filters
 
std::unordered_map< CompactSecIDs::secPairID_t, Filter3sp > m_3spFilters
 stores the attached 3-hit filters
 
std::unordered_map< CompactSecIDs::secTripletID_t, Filter4sp > m_4spFilters
 stores the attached 4-hit filters
 

Friends

template<class T >
class VXDTFFilters
 

Detailed Description

template<class HitType, class Filter2sp, class Filter3sp, class Filter4sp>
class Belle2::StaticSector< HitType, Filter2sp, Filter3sp, Filter4sp >

class to describe a static sector of the sector map.

The static sector holds all the filters attached to it.

Definition at line 29 of file StaticSector.h.

Constructor & Destructor Documentation

◆ StaticSector() [1/2]

StaticSector ( )
inline

CONSTRUCTORS.

standard constructor

Definition at line 41 of file StaticSector.h.

41 :
42 m_secID(FullSecID()), m_compactSecIDsMap(nullptr)
43 {}
const CompactSecIDs * m_compactSecIDsMap
map from FullSecID to CompactSecID
Definition: StaticSector.h:287
FullSecID m_secID
stores its own secID
Definition: StaticSector.h:284

◆ StaticSector() [2/2]

StaticSector ( FullSecID  secID)
inlineexplicit

constructor

Definition at line 46 of file StaticSector.h.

46 :
47 m_secID(secID), m_compactSecIDsMap(nullptr)
48 {}

Member Function Documentation

◆ assign2spFilter()

void assign2spFilter ( FullSecID  inner,
const Filter2sp  filter 
)
inline

Assign the 2 space point.

Parameters
innerFullSecID of the inner SpacePoint
filterto this static sector which is friend of the sector whose FullSecID is the parameter inner.

Definition at line 121 of file StaticSector.h.

122 {
124 m_inner2spSecIDs.push_back(inner);
125 }
sectorID_t getCompactID(const FullSecID &fullID) const
Returns the compact id of the FullSecID It does not throw exceptions (at least it should not).
std::vector< FullSecID > m_inner2spSecIDs
stores innerSecIDs for the attached 2-hit filters
Definition: StaticSector.h:290
std::unordered_map< CompactSecIDs::sectorID_t, Filter2sp > m_2spFilters
stores the attached 2-hit filters
Definition: StaticSector.h:297
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:38

◆ assign3spFilter()

void assign3spFilter ( FullSecID  center,
FullSecID  inner,
const Filter3sp  filter 
)
inline

Parameters: pass the ID of the inner sectors (sorted from outer(left) to inner(right) and the filters you like to attach.

Definition at line 128 of file StaticSector.h.

130 {
132 m_inner3spSecIDs.push_back({center, inner});
133 }
std::vector< std::pair< FullSecID, FullSecID > > m_inner3spSecIDs
stores innerSecIDs for the attached 3-hit filters
Definition: StaticSector.h:292
std::unordered_map< CompactSecIDs::secPairID_t, Filter3sp > m_3spFilters
stores the attached 3-hit filters
Definition: StaticSector.h:299

◆ assign4spFilter()

void assign4spFilter ( FullSecID  outerCenter,
FullSecID  innerCenter,
FullSecID  inner,
const Filter3sp  filter 
)
inline

Parameters: pass the ID of the inner sectors (sorted from outer(left) to inner(right) and the filters you like to attach.

Definition at line 136 of file StaticSector.h.

138 {
139 m_4spFilters[ m_compactSecIDsMap->getCompactID(outerCenter, innerCenter, inner) ] =
140 filter;
141 m_inner4spSecIDs.push_back({outerCenter, innerCenter, inner});
142 }
std::unordered_map< CompactSecIDs::secTripletID_t, Filter4sp > m_4spFilters
stores the attached 4-hit filters
Definition: StaticSector.h:301
std::vector< std::tuple< FullSecID, FullSecID, FullSecID > > m_inner4spSecIDs
stores innerSecIDs for the attached 4-hit filters
Definition: StaticSector.h:294

◆ assignCompactSecIDsMap()

void assignCompactSecIDsMap ( const CompactSecIDs compactSecIDsMap)
inline

Assign the compact sector ID to this sector.

Definition at line 111 of file StaticSector.h.

112 {
113 m_compactSecIDsMap = & compactSecIDsMap;
114 }

◆ getAllFilters2sp()

const std::unordered_map< CompactSecIDs::sectorID_t, Filter2sp > & getAllFilters2sp ( ) const
inline

Get constant access to the whole set of 2 Space Point filters.

Definition at line 94 of file StaticSector.h.

95 {return m_2spFilters;}

◆ getAllFilters3sp()

const std::unordered_map< CompactSecIDs::secPairID_t, Filter3sp > & getAllFilters3sp ( ) const
inline

Get constant access to the whole set of 3 Space Point filters.

Definition at line 100 of file StaticSector.h.

101 {return m_3spFilters;}

◆ getAllFilters4sp()

const std::unordered_map< CompactSecIDs::secTripletID_t, Filter4sp > & getAllFilters4sp ( ) const
inline

Get constant access to the whole set of 4 Space Point filters.

Definition at line 106 of file StaticSector.h.

107 {return m_4spFilters;}

◆ getFilter2sp()

const Filter2sp * getFilter2sp ( FullSecID  innerSector) const
inline

Get the pionter to the 2 Space Point filter assigned to the friendship relation among this sector; will return nullptr if filter is not found.

Parameters
innerSectorone

Definition at line 56 of file StaticSector.h.

57 {
58 auto filter = m_2spFilters.find(m_compactSecIDsMap->getCompactID(innerSector));
59 if (filter == m_2spFilters.end()) {
60 return nullptr;
61 }
62 return &(filter->second);
63 }

◆ getFilter3sp()

const Filter3sp * getFilter3sp ( const FullSecID centerID,
const FullSecID innerID 
) const
inline

Get the pionter to the 3 Space Point filter assigned to the friendship relation among this sector; will return nullptr if filter is not found.

Parameters
centerID: FullSecID for the sector between the inner and this sector
innerID: FullSecID for the inner sector

Definition at line 69 of file StaticSector.h.

70 {
71 auto filter = m_3spFilters.find(m_compactSecIDsMap->getCompactID(centerID, innerID));
72 if (filter == m_3spFilters.end()) {
73 return nullptr;
74 }
75 return &(filter->second);
76 }

◆ getFilter4sp()

const Filter4sp * getFilter4sp ( const FullSecID ,
const FullSecID ,
const FullSecID  
) const
inline

Get the pionter to the 4 Space Point filter assigned to the WARNING: not implemented yet.

Will return a nullptr pointer in any case!

Definition at line 82 of file StaticSector.h.

84 {
85 B2WARNING("StaticSector:getFilter4sp 4 hit, all 4 hits are yet ignored in here! TODO: implement!");
86 return nullptr;
87 }

◆ getFullSecID()

FullSecID getFullSecID ( ) const
inline

returns FullSecID of this sector

Definition at line 173 of file StaticSector.h.

173{ return m_secID; }

◆ getInner2spSecIDs()

const std::vector< FullSecID > & getInner2spSecIDs ( ) const
inline

returns all IDs for inner sectors of two-sector-combinations

Definition at line 154 of file StaticSector.h.

155 {
156 return m_inner2spSecIDs;
157 }

◆ getInner3spSecIDs()

const std::vector< std::pair< FullSecID, FullSecID > > & getInner3spSecIDs ( ) const
inline

returns all IDs for inner sectors of three-sector-combinations

Definition at line 161 of file StaticSector.h.

162 {
163 return m_inner3spSecIDs;
164 }

◆ getInner4spSecIDs()

const std::vector< std::tuple< FullSecID, FullSecID, FullSecID > > & getInner4spSecIDs ( ) const
inline

returns all IDs for inner sectors of four-sector-combinations

Definition at line 167 of file StaticSector.h.

168 {
169 return m_inner4spSecIDs;
170 }

◆ modify2SPFilters()

void modify2SPFilters ( const std::vector< std::tuple< int, std::string > > &  adjustFunctions)
inlineprivate

PRIVATE MEMBERS.

function that modifies all 2SP-filters connected to this static sector

Parameters
adjustFunctions: a vector of tuple<ind, string>. The int entry is the index of variable to be changed (see Filter::getNameAndReference where the indizes are defined) The string entry is a regex to be used in a TF1 (root function).

Definition at line 200 of file StaticSector.h.

201 {
202 // loop over all 2SP-filters
203 for (auto& filter : m_2spFilters) modifySingleFilter<Filter2sp>(filter.second, adjustFunctions);
204 }

◆ modify3SPFilters()

void modify3SPFilters ( const std::vector< std::tuple< int, std::string > > &  adjustFunctions)
inlineprivate

function that modifies all 3SP-filters connected to this static sector

Parameters
adjustFunctions: a vector of tuple<int, string>, The int entry is the index of the variable to be changed (see Filter::getNameAndReference where the indizes are defined) The string entry is a regex to be used in a TF1 (root function).

Definition at line 211 of file StaticSector.h.

212 {
213 // loop over all 3SP-filters
214 for (auto& filter : m_3spFilters) modifySingleFilter<Filter3sp>(filter.second, adjustFunctions);
215 }

◆ modifySingleFilter()

void modifySingleFilter ( FilterType &  filter,
const std::vector< std::tuple< int, std::string > > &  adjustFunctions 
)
inlineprivate

Function that modifies the uper and lower bounds of the Ranges contained in the filter.

The actual bounds which will be modified are accessed by their index they have (see Filter::getNameAndReference where the indizes are defined).

Parameters
filtera specialization of Filter
adjustFunctions: a vector of tuple<int, string>. The int (first entry) is the index of variable to change (see Filter::getNameAndReference where the indizes are defined) The string entry is a regex to be used in a TF1 (root function). For the regex it is assumed that "x" is the cutvalue itself and "[0]" is the FullSecID of the static sector (e.g. "sin(x) + [0]")

Definition at line 227 of file StaticSector.h.

228 {
229 // get the "map" to the cut values, the char in the pair codes the type, and the pointer points to the value
230 std::vector< std::pair<char, void*> > accessor = {};
231 filter.getNameAndReference(&accessor);
232
233 // this will produce lots of output
234 B2DEBUG(20, std::endl << "BEFORE: " << filter.getNameAndReference() << std::endl);
235
236 // loop over all adjustfunctions
237 for (const std::tuple<int, std::string >& entry : adjustFunctions) {
238 // first is the index
239 int index = std::get<0>(entry);
240
241 if (index < 0 || index >= (int)accessor.size()) {
242 B2FATAL("Provided index is out of range! index = " << index << " number of entries = " << accessor.size());
243 }
244
245 // now do some casting magic
246 double x = 0;
247 // the secID will be treated as 0th parameter of the TF1 ([0]) if specified.
248 double y = m_secID;
249
250 char typeID = accessor[index].first;
251 void* valuePtr = accessor[index].second;
252 if (typeID == TBranchLeafType(double())) x = *((double*)valuePtr);
253 else if (typeID == TBranchLeafType(int())) x = (double)(*((int*)valuePtr));
254 else if (typeID == TBranchLeafType(float())) x = (double)(*((float*)valuePtr));
255 else if (typeID == TBranchLeafType(bool())) x = (double)(*((bool*)valuePtr));
256 else {
257 B2FATAL("Unrecognized type : " << typeID);
258 } // end else if
259
260 // create function
261 TF1 f("function", std::get<1>(entry).c_str());
262 if (!f.IsValid() || f.GetNpar() > 1) {
263 B2FATAL("No valid function provided! The provided string has to be able to be converted by TF1. Also max. 1 parameter is allowed!"
264 << " The provided string is: \"" << std::get<1>(entry).c_str() << "\"");
265 }
266
267 double result = f.EvalPar(&x, &y);
268
269 // now cast back to original type and set the value
270 if (typeID == TBranchLeafType(double())) *((double*)valuePtr) = result;
271 else if (typeID == TBranchLeafType(int())) *((int*)valuePtr) = result;
272 else if (typeID == TBranchLeafType(float())) *((float*)valuePtr) = result;
273 else if (typeID == TBranchLeafType(bool())) *((bool*)valuePtr) = result;
274 else {
275 B2FATAL("Unrecognized type : " << typeID);
276 } // end else if
277
278 }// end loop over the functions
279
280 B2DEBUG(20, "AFTER: " << filter.getNameAndReference() << std::endl);
281 }
char TBranchLeafType(const char *)
Overloading TBranchLeafType to be able to get identifier 'C' for type char*.

◆ operator==() [1/2]

bool operator== ( const FullSecID b) const
inline

== -operator - compares if two StaticSectors are identical

Definition at line 186 of file StaticSector.h.

187 {
188 return (getFullSecID() == b);
189 }
FullSecID getFullSecID() const
returns FullSecID of this sector
Definition: StaticSector.h:173

◆ operator==() [2/2]

bool operator== ( const StaticSector< HitType, Filter2sp, Filter3sp, Filter4sp > &  b) const
inline

COMPARISON OPERATORS.

== -operator - compares if two StaticSectors are identical

Definition at line 180 of file StaticSector.h.

181 {
182 return (getFullSecID() == b.getFullSecID());
183 }

◆ setSubLayerID()

void setSubLayerID ( int  sublayer)
inline

set sublayer ID, needed as it is updated in the trainings phase

Definition at line 147 of file StaticSector.h.

148 {
149 m_secID = FullSecID(m_secID.getVxdID(), (bool)sublayer, m_secID.getSecID());
150 }
VxdID getVxdID() const
returns VxdID of sensor.
Definition: FullSecID.h:138
short int getSecID() const
returns SecID of current FullSecID (only unique for each sensor).
Definition: FullSecID.h:146

Friends And Related Function Documentation

◆ VXDTFFilters

friend class VXDTFFilters
friend

Definition at line 34 of file StaticSector.h.

Member Data Documentation

◆ m_2spFilters

std::unordered_map<CompactSecIDs::sectorID_t, Filter2sp > m_2spFilters
private

stores the attached 2-hit filters

Definition at line 297 of file StaticSector.h.

◆ m_3spFilters

std::unordered_map<CompactSecIDs::secPairID_t, Filter3sp > m_3spFilters
private

stores the attached 3-hit filters

Definition at line 299 of file StaticSector.h.

◆ m_4spFilters

std::unordered_map<CompactSecIDs::secTripletID_t, Filter4sp > m_4spFilters
private

stores the attached 4-hit filters

Definition at line 301 of file StaticSector.h.

◆ m_compactSecIDsMap

const CompactSecIDs* m_compactSecIDsMap
private

map from FullSecID to CompactSecID

Definition at line 287 of file StaticSector.h.

◆ m_inner2spSecIDs

std::vector< FullSecID > m_inner2spSecIDs
private

stores innerSecIDs for the attached 2-hit filters

Definition at line 290 of file StaticSector.h.

◆ m_inner3spSecIDs

std::vector< std::pair< FullSecID, FullSecID> > m_inner3spSecIDs
private

stores innerSecIDs for the attached 3-hit filters

Definition at line 292 of file StaticSector.h.

◆ m_inner4spSecIDs

std::vector< std::tuple< FullSecID, FullSecID, FullSecID > > m_inner4spSecIDs
private

stores innerSecIDs for the attached 4-hit filters

Definition at line 294 of file StaticSector.h.

◆ m_secID

FullSecID m_secID
private

stores its own secID

Definition at line 284 of file StaticSector.h.


The documentation for this class was generated from the following file: