Belle II Software development
CutsFromDBWireHitFilter Class Reference

Filter rejecting hits according to DB values. More...

#include <CutsFromDBWireHitFilter.h>

Inheritance diagram for CutsFromDBWireHitFilter:
Filter< AObject > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object = AObject
 Type of the object to be analysed.
 
using Interface = Filter< AObject >
 Mark this class as the basic interface.
 

Public Member Functions

 CutsFromDBWireHitFilter ()
 Default constructor.
 
virtual ~CutsFromDBWireHitFilter ()=default
 Default destructor.
 
void initialize () final
 Called at the beginning of the processing.
 
void beginRun () final
 Called when a new run is started.
 
Weight operator() (const CDCWireHit &wireHit) final
 Basic filter method to override.
 
virtual void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix)
 Expose the set of parameters of the filter to the module parameter list.
 
virtual bool needsTruthInformation ()
 Indicates if the filter requires Monte Carlo information.
 
virtual Weight operator() (const Object &obj)
 Function to evaluate the object.
 
Weight operator() (const Object *obj)
 Function to evaluate the object.
 
virtual std::vector< float > operator() (const std::vector< Object * > &objs)
 Function to evaluate a vector of objects Base implementation applies the function to each object.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = ProcessingSignalListener
 Type of the base class.
 

Private Member Functions

void checkIfDBObjPtrIsValid ()
 Check if m_CDCWireHitRequirementsFromDB is valid and set m_DBPtrIsValidForCurrentRun accordingly.
 
template<typename T >
bool isInRange (const T &value, const std::pair< T, T > &range) const
 Check if value >= range.first and value <= range.second If range.second == -1, then check only if value >= range.first.
 
template<typename T >
bool isLessThanOrEqualTo (const T &value, const T &upper_value) const
 Check if value <= upper_value If upper_value == -1, then return true.
 

Private Attributes

std::unique_ptr< DBObjPtr< CDCWireHitRequirements > > m_CDCWireHitRequirementsFromDB
 Cut values from the Data Base.
 
bool m_DBPtrIsValidForCurrentRun
 Boolean asserting if DBObjPtr is valid for the current run.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Filter rejecting hits according to DB values.

Definition at line 23 of file CutsFromDBWireHitFilter.h.

Member Typedef Documentation

◆ Interface

using Interface = Filter<AObject>
inherited

Mark this class as the basic interface.

Definition at line 38 of file Filter.dcl.h.

◆ Object

using Object = AObject
inherited

Type of the object to be analysed.

Definition at line 35 of file Filter.dcl.h.

◆ Super

using Super = ProcessingSignalListener
privateinherited

Type of the base class.

Definition at line 25 of file CompositeProcessingSignalListener.h.

Constructor & Destructor Documentation

◆ CutsFromDBWireHitFilter()

Default constructor.

Definition at line 16 of file CutsFromDBWireHitFilter.cc.

16 :
18{
19}
std::unique_ptr< DBObjPtr< CDCWireHitRequirements > > m_CDCWireHitRequirementsFromDB
Cut values from the Data Base.
bool m_DBPtrIsValidForCurrentRun
Boolean asserting if DBObjPtr is valid for the current run.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ beginEvent()

void beginEvent ( )
overridevirtualinherited

Receive and dispatch signal for the start of a new event.

Reimplemented from ProcessingSignalListener.

Reimplemented in SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
finalvirtual

Called when a new run is started.

Reimplemented from ProcessingSignalListener.

Definition at line 27 of file CutsFromDBWireHitFilter.cc.

28{
30}
void checkIfDBObjPtrIsValid()
Check if m_CDCWireHitRequirementsFromDB is valid and set m_DBPtrIsValidForCurrentRun accordingly.

◆ checkIfDBObjPtrIsValid()

void checkIfDBObjPtrIsValid ( )
private

Check if m_CDCWireHitRequirementsFromDB is valid and set m_DBPtrIsValidForCurrentRun accordingly.

Definition at line 32 of file CutsFromDBWireHitFilter.cc.

33{
35 B2ERROR("std::unique_ptr<DBObjPtr<CDCWireHitRequirements> > m_CDCWireHitRequirementsFromDB not properly set.\n"
36 "Cut not applied on CDCWireHit by CutsFromDBWireHitFilter. { findlet: CutsFromDBWireHitFilter }");
38 } else {
39 if (!((*m_CDCWireHitRequirementsFromDB).isValid())) {
40 B2WARNING("DBObjPtr<CDCWireHitRequirements> not valid for current run. { findlet: CutsFromDBWireHitFilter }\n"
41 "Cut not applied on CDCWireHit by CutsFromDBWireHitFilter. { findlet: CutsFromDBWireHitFilter }");
43 } else {
45 }
46 }
47}

◆ endRun()

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList moduleParamList,
const std::string &  prefix 
)
virtualinherited

Expose the set of parameters of the filter to the module parameter list.

Note that not all filters have yet exposed their parameters in this way.

This method is deprecated as the exposeParams below uses a less compile heavy equivalent.

Reimplemented in LayerSVDRelationFilter< AFilter, APrefilter >, SectorMapBasedSVDPairFilter, MCAxialSegmentPairFilter, Chi2FacetFilter, FeasibleRLFacetFilter, RealisticFacetFilter, SimpleFacetFilter, MCFacetRelationFilter, MCSegmentPairFilter, MCSegmentPairRelationFilter, MCSegmentRelationFilter, MCSegmentTripleFilter, MCSegmentTripleRelationFilter, WholeWireHitRelationFilter, LayerRelationFilter< AFilter >, DuplicateCDCPathPairFilter, DistanceCDCStateFilter, ExtrapolateAndUpdateCDCStateFilter, RoughCDCfromEclStateFilter, RoughCDCStateFilter, AdvanceFilter< AState, AnAdvancer >, AngularDistancePXDPairFilter, CylinderDistancePXDPairFilter, InterceptDistancePXDPairFilter, LayerPXDRelationFilter< AFilter, APrefilter >, LoosePXDPairFilter, SensorPXDPairFilter, LooseSVDPairFilter, SensorSVDPairFilter, ResidualSVDStateFilter, PhiRecoTrackRelationFilter, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, Chi2FacetRelationFilter, SimpleFacetRelationFilter, PhiTrackRelationFilter, BridgingWireHitRelationFilter, FiveHitFilter, FourHitFilter, QualityIndicatorFilter, ThreeHitFilter, TwoHitVirtualIPFilter, TwoHitVirtualIPQIFilter, AngleAndTimeRelationFilter, and SimpleRelationFilter.

Definition at line 40 of file Filter.icc.h.

42 {
43 }

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
finalvirtual

Called at the beginning of the processing.

Reimplemented from ProcessingSignalListener.

Definition at line 21 of file CutsFromDBWireHitFilter.cc.

22{
23 m_CDCWireHitRequirementsFromDB = std::make_unique<DBObjPtr<CDCWireHitRequirements> >();
25}

◆ isInRange()

bool isInRange ( const T &  value,
const std::pair< T, T > &  range 
) const
private

Check if value >= range.first and value <= range.second If range.second == -1, then check only if value >= range.first.

Definition at line 52 of file CutsFromDBWireHitFilter.cc.

53{
54 if (range.second == -1) {
55 return (value >= range.first);
56 } else {
57 return (value >= range.first) && (value <= range.second);
58 }
59}

◆ isLessThanOrEqualTo()

bool isLessThanOrEqualTo ( const T &  value,
const T &  upper_value 
) const
private

Check if value <= upper_value If upper_value == -1, then return true.

Definition at line 64 of file CutsFromDBWireHitFilter.cc.

65{
66 if (upper_value == -1) {
67 return true;
68 } else {
69 return value <= upper_value;
70 }
71}

◆ needsTruthInformation()

◆ operator()() [1/4]

Weight operator() ( const CDCWireHit wireHit)
final

Basic filter method to override.

Definition at line 73 of file CutsFromDBWireHitFilter.cc.

74{
75 const short ADC = (*wireHit.getHit()).getADCCount();
76 const short TOT = (*wireHit.getHit()).getTOT();
77 const float ADCOverTOT = (TOT != 0) ? static_cast<float>(ADC) / TOT : 0;
78
80 if ((*wireHit.getHit()).getISuperLayer() == 0) {
81 // First super layer (0)
82 // Check if ADC, TOT and ADC/TOT are in the corresponding allowed ranges.
83 if (isInRange<short>(ADC, (*m_CDCWireHitRequirementsFromDB)->getADCRangeFirstSuperLayer()) &&
84 isInRange<short>(TOT, (*m_CDCWireHitRequirementsFromDB)->getTOTRangeFirstSuperLayer()) &&
85 isInRange<float>(ADCOverTOT, (*m_CDCWireHitRequirementsFromDB)->getADCOverTOTRangeFirstSuperLayer()) &&
86 isLessThanOrEqualTo<short>(ADC, (*m_CDCWireHitRequirementsFromDB)->getMaxADCGivenTOTFirstSuperLayer(TOT))) {
87 // Hit accepted
88 return ADC;
89 } else {
90 // Hit rejected
91 return NAN;
92 }
93
94 } else {
95 // Outer super layers (1-8)
96 // Check if ADC, TOT and ADC/TOT are in the corresponding allowed ranges.
97 if (isInRange<short>(ADC, (*m_CDCWireHitRequirementsFromDB)->getADCRangeOuterSuperLayers()) &&
98 isInRange<short>(TOT, (*m_CDCWireHitRequirementsFromDB)->getTOTRangeOuterSuperLayers()) &&
99 isInRange<float>(ADCOverTOT, (*m_CDCWireHitRequirementsFromDB)->getADCOverTOTRangeOuterSuperLayers()) &&
100 isLessThanOrEqualTo<short>(ADC, (*m_CDCWireHitRequirementsFromDB)->getMaxADCGivenTOTOuterSuperLayers(TOT))) {
101 // Hit accepted
102 return ADC;
103 } else {
104 // Hit rejected
105 return NAN;
106 }
107 }
108 }
109 // If the DB pointer is not valid, the hit is accepted (cf. B2WARNING above)
110 return ADC;
111}
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition: CDCWireHit.h:159

◆ operator()() [2/4]

◆ operator()() [3/4]

Weight operator() ( const Object obj)
inherited

Function to evaluate the object.

Base implementation accepts all objects, except nullptr.

Parameters
objThe object to be accepted or rejected.
Returns
A finit float value if the object is accepted. NAN if the object is rejected. Nullptr is always rejected.

Definition at line 58 of file Filter.icc.h.

59 {
60 return obj ? operator()(*obj) : NAN;
61 }
virtual Weight operator()(const Object &obj)
Function to evaluate the object.
Definition: Filter.icc.h:52

◆ operator()() [4/4]

std::vector< float > operator() ( const std::vector< Object * > &  objs)
virtualinherited

Function to evaluate a vector of objects Base implementation applies the function to each object.

Can be optimized for MVA filters

Parameters
objsA vector of pointers to objects
Returns
A vector of float or NAN values. See above

Definition at line 64 of file Filter.icc.h.

65 {
66 std::vector<float> out;
67 for (const auto& obj : objs) {
68 out.push_back(operator()(obj));
69 }
70 return out;
71 }

◆ terminate()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ m_CDCWireHitRequirementsFromDB

std::unique_ptr<DBObjPtr<CDCWireHitRequirements> > m_CDCWireHitRequirementsFromDB
private

Cut values from the Data Base.

Definition at line 59 of file CutsFromDBWireHitFilter.h.

◆ m_DBPtrIsValidForCurrentRun

bool m_DBPtrIsValidForCurrentRun
private

Boolean asserting if DBObjPtr is valid for the current run.

Definition at line 62 of file CutsFromDBWireHitFilter.h.

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 52 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated = false
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.


The documentation for this class was generated from the following files: