 |
Belle II Software
release-05-02-19
|
13 #include <framework/logging/Logger.h>
14 #include <tracking/trackFindingVXD/sectorMapTools/RawDataCollectedMinMax.h>
15 #include <tracking/trackFindingVXD/sectorMapTools/MinMax.h>
16 #include <tracking/trackFindingVXD/sectorMapTools/SubGraphID.h>
17 #include <tracking/dataobjects/FullSecID.h>
21 #include <unordered_map>
32 template<
class FilterType>
class SubGraph {
50 {
return (
m_id == b.m_id); }
53 using Iterator =
typename std::unordered_map<FilterType, MinMax>::iterator;
58 for (
auto& iD : fIDs) {
71 B2WARNING(
"FilterID " << fID <<
" not known to this subgraph " <<
m_id.
print() <<
" - nothing added!");
74 return pos->second.checkAndReplaceIfMinMax(value);
79 unsigned getFound()
const {
return m_found; }
85 std::string
print()
const
87 std::string out =
"id: " +
m_id.
print() +
" was found " + std::to_string(
m_found) +
" times. Filters with values collected:\n";
89 out += entry.first +
" " + entry.second.print() +
" _||_ ";
109 void addValue(FilterType fID,
double value)
111 if (
m_rawDataCollected ==
nullptr) { B2FATAL(
"SubGraph::addValue: attempt to add data before prepareDataCollection(...) was executed! Aborting illegal procedure."); }
114 B2WARNING(
"addValue: FilterID " << fID <<
" not known to this subgraph " <<
m_id.
print() <<
" - nothing added!");
117 pos->second.add(value);
125 std::pair<double, double> results = entry.second.getMinMax();
132 out += entry.first +
" " + entry.second.print() +
" ";
134 B2DEBUG(1,
"SubGraph::getFinalQuantileValues: minMaxFound:\n" << out);
141 unsigned nUpdated = 0;
142 for (
unsigned id : ids) {
155 std::vector<FullSecID> foundIDs;
157 for (
auto& sector :
m_id) {
158 if (sensor != FullSecID(sector).getVxdID())
continue;
159 foundIDs.push_back(FullSecID(sector));
unsigned m_found
counts number of times this subgraph was found.
void prepareDataCollection(std::pair< double, double > quantiles)
takes care of being able to use the data collector. please use for quantiles [min,...
small class for storing min and max.
bool hasElement(unsigned b) const
checks if given raw secID is part of this, ignores subLayerID.
SubGraphID m_id
contains the IDs in the correct order (from outer to inner) as a unique identifier for this graph.
bool checkSharesTrunk(const SubGraph< FilterType > &b) const
if both graphs have got the same IDs except the last one, they share a trunk.
bool updateID(unsigned newID)
if newID is element of this (ignoring subLayerID), oldID will be replaced by newID....
void updateID(SubGraphID &newID)
set newID for this subgraph.
bool checkAndReplaceIfMinMax(FilterType fID, double value)
add filter, if not added yet, checks value and replaces old ones if new one is better.
map< unsigned, const TOPSampleTimes * >::const_iterator Iterator
Iteratior for m_map.
bool checkSharesTrunk(const SubGraphID &b) const
if both graphs have got the same IDs except the last one, they share a trunk.
SubGraph(SubGraphID &id, std::vector< FilterType > &fIDs)
constructor, mandatory iDChain musst at least contain one iD.
Abstract base class for different kinds of events.
std::unordered_map< FilterType, RawDataCollectedMinMax > * m_rawDataCollected
takes care of collecting the raw data.
contains all relevant stuff needed for dealing with a subGraph.
std::vector< FullSecID > getSectorsOfSensor(VxdID &sensor)
returns vector containing all sectors for given sensor (if any) and empty vector if no sector of that...
unsigned idCheckAndUpdate(const std::vector< unsigned > &ids)
for given vector of ids check if any of them is part of subGraphID. If yes, update their SubLayerID....
takes care of collecting raw data and staying below RAM-threshold.
const SubGraphID & getID() const
returns iD of this graph
std::string print() const
"print" debugging information to a string
void addValue(FilterType fID, double value)
adds value to rawDataCollector
bool operator==(const SubGraph< FilterType > &b) const
overloaded '=='-operator
const std::unordered_map< FilterType, MinMax > & getFinalQuantileValues()
this deletes the old min and max values stored and replaces them with the quantiles to be found.
std::string print() const
returns string of entries.
stores the ID of a subgraph, which is basically a chain of FullSecID coded as unsigned ints.
std::unordered_map< FilterType, MinMax > m_minMaxValues
contains all min- and max-values found so far for all filters relevant for this Graph....