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/trackFindingCDC/eventdata/hits/CDCWireHit.h>
11
12#include <framework/core/ModuleParamList.templateDetails.h>
13
14using namespace Belle2;
15using namespace TrackFindingCDC;
16
18{
21}
22
24{
25 return "Marks hits as background based on the result of a filter.";
26}
27
29 const std::string& prefix)
30{
31 m_wireHitFilter.exposeParameters(moduleParamList, prefix);
32}
33
34void WireHitBackgroundDetector::apply(std::vector<CDCWireHit>& wireHits)
35{
36 // we will apply classifier to all hits at once, this is much faster for python-based MVA
37 std::vector<CDCWireHit*> wireHitsPtr(wireHits.size());
38 for (size_t iHit = 0; iHit < wireHits.size(); iHit += 1) {
39 wireHitsPtr[iHit] = &wireHits[iHit];
40 }
41
42 auto probs = m_wireHitFilter(wireHitsPtr);
43
44 for (size_t iHit = 0; iHit < probs.size(); iHit += 1) {
45 if (std::isnan(probs[iHit])) {
46 wireHits[iHit]->setTakenFlag();
47 wireHits[iHit]->setBackgroundFlag();
48 wireHits[iHit]->setBadADCOrTOTFlag();
49 }
50 }
51}
The Module parameter list class.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void apply(std::vector< CDCWireHit > &wireHits) final
Main algorithm marking hit as background.
std::string getDescription() final
Short description of the findlet.
ChooseableWireHitFilter m_wireHitFilter
Chooseable WireHit filter to be used to filter background.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Abstract base class for different kinds of events.