11#include <framework/logging/Logger.h>
24 template <
class Po
intType>
30 using TwoHitFunction =
typename std::function<double(
const PointType&,
const PointType&)>;
34 using ThreeHitFunction =
typename std::function<double(
const PointType&,
const PointType&,
const PointType&)>;
38 using FourHitFunction =
typename std::function<double(
const PointType&,
const PointType&,
const PointType&,
const PointType&)>;
63 B2WARNING(
"FilterMill-checkLocked: Function " << name <<
64 " was executed although the Mill was not locked yet. This might be unintended...");
106 B2ERROR(
"FilterMill-add2HitFilter: someone tried to add filter " << newFilter.first <<
107 " after lockdown! This is unintended behavior - doing nothing instead...");
110 B2DEBUG(20,
"FilterMill::add2HitFilter: filter " << newFilter.first <<
" added");
119 B2ERROR(
"FilterMill-add3HitFilter: someone tried to add filter " << newFilter.first <<
120 " after lockdown! This is unintended behavior - doing nothing instead...");
123 B2DEBUG(20,
"FilterMill::add3HitFilter: filter " << newFilter.first <<
" added");
132 B2ERROR(
"FilterMill-add4HitFilter: someone tried to add filter " << newFilter.first <<
133 " after lockdown! This is unintended behavior - doing nothing instead...");
136 B2DEBUG(20,
"FilterMill::add4HitFilter: filter " << newFilter.first <<
" added");
143 std::vector<std::pair<std::string, double> >& collectedData)
const
146 if (
m_2Hitfilters.empty()) { B2DEBUG(20,
"there are no 2-hit-filters stored, skipping grinding");
return; }
148 std::vector<std::pair<std::string, double>> tempData;
152 double result = filterPack.second(
155 tempData.push_back({filterPack.first, result});
158 std::string filterNames;
160 filterNames += filterPack.first +
" ";
162 B2WARNING(
"FilterMill:grindData2Hit: an exception was thrown by one of the Filters/SelectionVariables, that indicates strange input data, no data collected! Filters "
163 << filterNames <<
" were used and one of them did not work.");
167 collectedData.insert(collectedData.end(), tempData.begin(), tempData.end());
169 B2DEBUG(20,
"FilterMill::grindData2Hit: collectedData has now " << collectedData.size() <<
" entries");
175 std::vector<std::pair<std::string, double> >& collectedData)
const
178 if (
m_3Hitfilters.empty()) { B2DEBUG(20,
"there are no 3-hit-filters stored, skipping grinding");
return; }
180 std::vector<std::pair<std::string, double>> tempData;
184 double result = filterPack.second(
188 tempData.push_back({filterPack.first, result});
191 std::string filterNames;
193 filterNames += filterPack.first +
" ";
195 B2WARNING(
"FilterMill:grindData3Hit: an exception was thrown by one of the Filters/SelectionVariables, that indicates strange input data, no data collected! Filters "
196 << filterNames <<
" were used and one of them did not work.");
199 collectedData.insert(collectedData.end(), tempData.begin(), tempData.end());
201 B2DEBUG(20,
"FilterMill::grindData3Hit: collectedData has now " << collectedData.size() <<
" entries");
207 std::vector<std::pair<std::string, double> >& collectedData)
const
210 if (
m_4Hitfilters.empty()) { B2DEBUG(20,
"there are no 4-hit-filters stored, skipping grinding");
return; }
212 std::vector<std::pair<std::string, double>> tempData;
216 double result = filterPack.second(
221 tempData.push_back({filterPack.first, result});
224 B2WARNING(
"FilterMill:grindData4Hit: an exception was thrown by one of the Filters/SelectionVariables, that indicates strange input data, no data collected!");
227 collectedData.insert(collectedData.end(), tempData.begin(), tempData.end());
229 B2DEBUG(20,
"FilterMill::grindData4Hit: collectedData has now " << collectedData.size() <<
" entries");
Small class which stores the filters/selectionVariables to be used for a secMap and has an interface ...
void grindData3Hit(const HitTriplet &dataSet, std::vector< std::pair< std::string, double > > &collectedData) const
on given dataSet, apply all filters stored in the mill and store the results in collectedData.
void grindData4Hit(const HitQuadruplet &dataSet, std::vector< std::pair< std::string, double > > &collectedData) const
on given dataSet, apply all filters stored in the mill and store the results in collectedData.
typename std::function< double(const PointType &, const PointType &, const PointType &, const PointType &)> FourHitFunction
typedef for more readable function-type - to be used for 4-hit-selectionVariables.
void lockMill()
to block adding new filters, execute this member.
std::vector< std::pair< std::string, TwoHitFunction > > m_2Hitfilters
Contains all 2-hit-Filters and their names to be applied.
void add3HitFilter(std::pair< std::string, ThreeHitFunction > newFilter)
add new Filter for 3 Hits .
bool m_locked
Simple safeguard for not changing any filters after preparing phase.
typename std::function< double(const PointType &, const PointType &)> TwoHitFunction
typedef for more readable function-type - to be used for 2-hit-selectionVariables.
std::vector< std::pair< std::string, ThreeHitFunction > > m_3Hitfilters
Contains all 3-hit-Filters and their names to be applied.
void add2HitFilter(std::pair< const std::string, TwoHitFunction > newFilter)
add new Filter for 2 Hits .
void grindData2Hit(const HitPair &dataSet, std::vector< std::pair< std::string, double > > &collectedData) const
on given dataSet, apply all filters stored in the mill and store the results in collectedData.
void checkLocked(const std::string &name) const
to be executed by functions which shall work with unchangeable set of filters.
void add4HitFilter(std::pair< std::string, FourHitFunction > newFilter)
add new Filter for 4 Hits .
typename std::function< double(const PointType &, const PointType &, const PointType &)> ThreeHitFunction
typedef for more readable function-type - to be used for 3-hit-selectionVariables.
std::vector< std::pair< std::string, FourHitFunction > > m_4Hitfilters
Contains all 4-hit-Filters and their names to be applied.
Abstract base class for different kinds of events.
small struct containing pointers to two hits.
const PointType * outer
outer hit.
const PointType * inner
inner hit.
small struct containing pointers to four hits.
const PointType * innerCenter
innerCenter hit.
const PointType * outer
outer hit.
const PointType * outerCenter
outerCenter hit.
const PointType * inner
inner hit.
small struct containing pointers to three hits.
const PointType * center
center hit.
const PointType * outer
outer hit.
const PointType * inner
inner hit.