8#include <tracking/trackFindingCDC/filters/wireHit/CutsFromDBWireHitFilter.h>
9#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
10#include <cdc/dataobjects/CDCHit.h>
13using namespace TrackFindingCDC;
17 m_CDCWireHitRequirementsFromDB(nullptr), m_DBPtrIsValidForCurrentRun(false)
35 B2ERROR(
"std::unique_ptr<DBObjPtr<CDCWireHitRequirements> > m_CDCWireHitRequirementsFromDB not properly set.\n"
36 "Cut not applied on CDCWireHit by CutsFromDBWireHitFilter. { findlet: CutsFromDBWireHitFilter }");
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 }");
54 if (range.second == -1) {
55 return (value >= range.first);
57 return (value >= range.first) && (value <= range.second);
66 if (upper_value == -1) {
69 return value <= upper_value;
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;
80 if ((*wireHit.
getHit()).getISuperLayer() == 0) {
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))) {
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))) {
Class representing a hit wire in the central drift chamber.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
std::unique_ptr< DBObjPtr< CDCWireHitRequirements > > m_CDCWireHitRequirementsFromDB
Cut values from the Data Base.
void initialize() final
Called at the beginning of the processing.
void beginRun() final
Called when a new run is started.
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 val...
Weight operator()(const CDCWireHit &wireHit) final
Basic filter method to override.
CutsFromDBWireHitFilter()
Default constructor.
void checkIfDBObjPtrIsValid()
Check if m_CDCWireHitRequirementsFromDB is valid and set m_DBPtrIsValidForCurrentRun accordingly.
bool m_DBPtrIsValidForCurrentRun
Boolean asserting if DBObjPtr is valid for the current run.
bool isLessThanOrEqualTo(const T &value, const T &upper_value) const
Check if value <= upper_value If upper_value == -1, then return true.
Abstract base class for different kinds of events.