13 #include <framework/logging/Logger.h>
26 template <
class Po
intType>
32 using TwoHitFunction =
typename std::function<double(
const PointType&,
const PointType&)>;
36 using ThreeHitFunction =
typename std::function<double(
const PointType&,
const PointType&,
const PointType&)>;
40 using FourHitFunction =
typename std::function<double(
const PointType&,
const PointType&,
const PointType&,
const PointType&)>;
46 std::vector<std::pair<std::string, TwoHitFunction> >
m_2Hitfilters;
50 std::vector<std::pair<std::string, ThreeHitFunction> >
m_3Hitfilters;
65 B2WARNING(
"FilterMill-checkLocked: Function " << name <<
66 " was executed although the Mill was not locked yet. This might be unintended...");
76 const PointType*
outer;
77 const PointType*
inner;
82 const PointType*
outer;
105 void add2HitFilter(std::pair<const std::string, TwoHitFunction> newFilter)
108 B2ERROR(
"FilterMill-add2HitFilter: someone tried to add filter " << newFilter.first <<
109 " after lockdown! This is unintended behavior - doing nothing instead...");
112 B2DEBUG(5,
"FilterMill::add2HitFilter: filter " << newFilter.first <<
" added");
118 void add3HitFilter(std::pair<std::string, ThreeHitFunction> newFilter)
121 B2ERROR(
"FilterMill-add3HitFilter: someone tried to add filter " << newFilter.first <<
122 " after lockdown! This is unintended behavior - doing nothing instead...");
125 B2DEBUG(5,
"FilterMill::add3HitFilter: filter " << newFilter.first <<
" added");
131 void add4HitFilter(std::pair<std::string, FourHitFunction> newFilter)
134 B2ERROR(
"FilterMill-add4HitFilter: someone tried to add filter " << newFilter.first <<
135 " after lockdown! This is unintended behavior - doing nothing instead...");
138 B2DEBUG(5,
"FilterMill::add4HitFilter: filter " << newFilter.first <<
" added");
145 std::vector<std::pair<std::string, double> >& collectedData)
const
148 if (
m_2Hitfilters.empty()) { B2DEBUG(5,
"there are no 2-hit-filters stored, skipping grinding");
return; }
150 std::vector<std::pair<std::string, double>> tempData;
154 double result = filterPack.second(
157 tempData.push_back({filterPack.first, result});
160 std::string filterNames;
162 filterNames += filterPack.first +
" ";
164 B2WARNING(
"FilterMill:grindData2Hit: an exception was thrown by one of the Filters/SelectionVariables, that indicates strange input data, no data collected! Filters "
165 << filterNames <<
" were used and one of them did not work.");
169 collectedData.insert(collectedData.end(), tempData.begin(), tempData.end());
171 B2DEBUG(5,
"FilterMill::grindData2Hit: collectedData has now " << collectedData.size() <<
" entries");
177 std::vector<std::pair<std::string, double> >& collectedData)
const
180 if (
m_3Hitfilters.empty()) { B2DEBUG(5,
"there are no 3-hit-filters stored, skipping grinding");
return; }
182 std::vector<std::pair<std::string, double>> tempData;
186 double result = filterPack.second(
190 tempData.push_back({filterPack.first, result});
193 std::string filterNames;
195 filterNames += filterPack.first +
" ";
197 B2WARNING(
"FilterMill:grindData3Hit: an exception was thrown by one of the Filters/SelectionVariables, that indicates strange input data, no data collected! Filters "
198 << filterNames <<
" were used and one of them did not work.");
201 collectedData.insert(collectedData.end(), tempData.begin(), tempData.end());
203 B2DEBUG(5,
"FilterMill::grindData3Hit: collectedData has now " << collectedData.size() <<
" entries");
209 std::vector<std::pair<std::string, double> >& collectedData)
const
212 if (
m_4Hitfilters.empty()) { B2DEBUG(5,
"there are no 4-hit-filters stored, skipping grinding");
return; }
214 std::vector<std::pair<std::string, double>> tempData;
218 double result = filterPack.second(
220 *(dataSet.outerCenter),
221 *(dataSet.innerCenter),
223 tempData.push_back({filterPack.first, result});
226 B2WARNING(
"FilterMill:grindData4Hit: an exception was thrown by one of the Filters/SelectionVariables, that indicates strange input data, no data collected!");
229 collectedData.insert(collectedData.end(), tempData.begin(), tempData.end());
231 B2DEBUG(5,
"FilterMill::grindData4Hit: collectedData has now " << collectedData.size() <<
" entries");