9#include <tracking/dataobjects/FullSecID.h>
10#include <tracking/trackFindingVXD/filterMap/map/CompactSecIDs.h>
11#include <tracking/trackFindingVXD/filterMap/filterFramework/TBranchLeafType.h>
15#include <unordered_map>
27 template <
class HitType,
28 class Filter2sp,
class Filter3sp,
class Filter4sp >
85 B2WARNING(
"StaticSector:getFilter4sp 4 hit, all 4 hits are yet ignored in here! TODO: implement!");
93 const std::unordered_map<CompactSecIDs::sectorID_t, Filter2sp >&
99 const std::unordered_map<CompactSecIDs::secPairID_t, Filter3sp >&
105 const std::unordered_map<CompactSecIDs::secTripletID_t, Filter4sp >&
226 template<
class FilterType>
230 std::vector< std::pair<char, void*> > accessor = {};
231 filter.getNameAndReference(&accessor);
234 B2DEBUG(20, std::endl <<
"BEFORE: " <<
filter.getNameAndReference() << std::endl);
237 for (
const std::tuple<int, std::string >& entry : adjustFunctions) {
239 int index = std::get<0>(entry);
241 if (index < 0 || index >= (
int)accessor.size()) {
242 B2FATAL(
"Provided index is out of range! index = " << index <<
" number of entries = " << accessor.size());
250 char typeID = accessor[index].first;
251 void* valuePtr = accessor[index].second;
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));
257 B2FATAL(
"Unrecognized type : " << typeID);
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() <<
"\"");
267 double result = f.EvalPar(&x, &y);
270 if (typeID ==
TBranchLeafType(
double())) *((
double*)valuePtr) = result;
272 else if (typeID ==
TBranchLeafType(
float())) *((
float*)valuePtr) = result;
273 else if (typeID ==
TBranchLeafType(
bool())) *((
bool*)valuePtr) = result;
275 B2FATAL(
"Unrecognized type : " << typeID);
280 B2DEBUG(20,
"AFTER: " <<
filter.getNameAndReference() << std::endl);
297 std::unordered_map<CompactSecIDs::sectorID_t, Filter2sp >
m_2spFilters;
299 std::unordered_map<CompactSecIDs::secPairID_t, Filter3sp >
m_3spFilters;
301 std::unordered_map<CompactSecIDs::secTripletID_t, Filter4sp >
m_4spFilters;
This class provides a computer convenient numbering scheme for the sectors in the sector map and for ...
sectorID_t getCompactID(const FullSecID &fullID) const
Returns the compact id of the FullSecID It does not throw exceptions (at least it should not).
Class to identify a sector inside of the VXD.
VxdID getVxdID() const
returns VxdID of sensor.
short int getSecID() const
returns SecID of current FullSecID (only unique for each sensor).
class to describe a static sector of the sector map.
const std::vector< std::tuple< FullSecID, FullSecID, FullSecID > > & getInner4spSecIDs() const
returns all IDs for inner sectors of four-sector-combinations
void assign2spFilter(FullSecID inner, const Filter2sp filter)
Assign the 2 space point.
std::vector< std::pair< FullSecID, FullSecID > > m_inner3spSecIDs
stores innerSecIDs for the attached 3-hit filters
const Filter3sp * getFilter3sp(const FullSecID ¢erID, const FullSecID &innerID) const
Get the pointer to the 3 Space Point filter assigned to the friendship relation among this sector; wi...
FullSecID getFullSecID() const
returns FullSecID of this sector
std::vector< FullSecID > m_inner2spSecIDs
stores innerSecIDs for the attached 2-hit filters
const std::unordered_map< CompactSecIDs::secPairID_t, Filter3sp > & getAllFilters3sp() const
Get constant access to the whole set of 3 Space Point filters.
const CompactSecIDs * m_compactSecIDsMap
map from FullSecID to CompactSecID
const std::unordered_map< CompactSecIDs::sectorID_t, Filter2sp > & getAllFilters2sp() const
Get constant access to the whole set of 2 Space Point filters.
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...
FullSecID m_secID
stores its own secID
void assignCompactSecIDsMap(const CompactSecIDs &compactSecIDsMap)
Assign the compact sector ID to this sector.
StaticSector()
CONSTRUCTORS.
const Filter4sp * getFilter4sp(const FullSecID &, const FullSecID &, const FullSecID &) const
Get the pointer to the 4 Space Point filter assigned to the WARNING: not implemented yet.
std::unordered_map< CompactSecIDs::secTripletID_t, Filter4sp > m_4spFilters
stores the attached 4-hit filters
void modify2SPFilters(const std::vector< std::tuple< int, std::string > > &adjustFunctions)
PRIVATE MEMBERS.
std::unordered_map< CompactSecIDs::sectorID_t, Filter2sp > m_2spFilters
stores the attached 2-hit filters
const std::vector< std::pair< FullSecID, FullSecID > > & getInner3spSecIDs() const
returns all IDs for inner sectors of three-sector-combinations
const std::unordered_map< CompactSecIDs::secTripletID_t, Filter4sp > & getAllFilters4sp() const
Get constant access to the whole set of 4 Space Point filters.
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...
void modifySingleFilter(FilterType &filter, const std::vector< std::tuple< int, std::string > > &adjustFunctions)
Function that modifies the upper and lower bounds of the Ranges contained in the filter.
std::vector< std::tuple< FullSecID, FullSecID, FullSecID > > m_inner4spSecIDs
stores innerSecIDs for the attached 4-hit filters
void modify3SPFilters(const std::vector< std::tuple< int, std::string > > &adjustFunctions)
function that modifies all 3SP-filters connected to this static sector
void setSubLayerID(int sublayer)
set sublayer ID, needed as it is updated in the trainings phase
bool operator==(const StaticSector &b) const
COMPARISON OPERATORS.
const std::vector< FullSecID > & getInner2spSecIDs() const
returns all IDs for inner sectors of two-sector-combinations
std::unordered_map< CompactSecIDs::secPairID_t, Filter3sp > m_3spFilters
stores the attached 3-hit filters
const Filter2sp * getFilter2sp(FullSecID innerSector) const
Get the pointer to the 2 Space Point filter assigned to the friendship relation among this sector; wi...
StaticSector(FullSecID secID)
constructor
Class that contains all the static sectors to which the filters are attached.
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
char TBranchLeafType(const char *)
Overloading TBranchLeafType to be able to get identifier 'C' for type char*.
Abstract base class for different kinds of events.