Belle II Software development
WireHitBackgroundDetector.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/trackFindingCDC/findlets/minimal/WireHitBackgroundDetector.h>
9
10#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
11
12#include <framework/core/ModuleParamList.templateDetails.h>
13
14using namespace Belle2;
15using namespace TrackFindingCDC;
16using namespace TrackingUtilities;
17
23
25{
26 return "Marks hits as background based on the result of a filter.";
27}
28
30 const std::string& prefix)
31{
32 m_wireHitFilter.exposeParameters(moduleParamList, prefix);
33}
34
35void WireHitBackgroundDetector::apply(std::vector<CDCWireHit>& wireHits)
36{
37 // we will apply classifier to all hits at once, this is much faster for python-based MVA
38 std::vector<CDCWireHit*> wireHitsPtr(wireHits.size());
39 for (size_t iHit = 0; iHit < wireHits.size(); iHit += 1) {
40 wireHitsPtr[iHit] = &wireHits[iHit];
41 }
42
43 auto probs = m_wireHitFilter(wireHitsPtr);
44
45 for (size_t iHit = 0; iHit < probs.size(); iHit += 1) {
46 if (std::isnan(probs[iHit])) {
47 wireHits[iHit]->setTakenFlag();
48 wireHits[iHit]->setBackgroundFlag();
49 wireHits[iHit]->setBadADCOrTOTFlag();
50 }
51 }
52}
The Module parameter list class.
std::string getDescription() final
Short description of the findlet.
ChooseableWireHitFilter m_wireHitFilter
Chooseable WireHit filter to be used to filter background.
void apply(std::vector< TrackingUtilities::CDCWireHit > &wireHits) final
Main algorithm marking hit as background.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Abstract base class for different kinds of events.