Belle II Software  release-05-01-25
SectorMapBasedSVDPairFilter.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun, Christian Wessel *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/ckf/svd/filters/relations/SectorMapBasedSVDPairFilter.h>
11 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
12 
13 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
14 
15 #include <tracking/spacePointCreation/SpacePoint.h>
16 #include <framework/core/ModuleParamList.templateDetails.h>
17 #include <tracking/dataobjects/FullSecID.h>
18 
19 namespace Belle2 {
25  {
27 
29  if (not m_vxdtfFilters) {
30  B2FATAL("Requested secMapName '" << m_param_sectorMapName << "' does not exist!");
31  }
32  }
33 
34  void SectorMapBasedSVDPairFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
35  {
36  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "sectorMapName"), m_param_sectorMapName,
37  "Name of the sector map to use.", m_param_sectorMapName);
38  }
39 
40  TrackFindingCDC::Weight SectorMapBasedSVDPairFilter::operator()(const std::pair<const CKFToSVDState*, const CKFToSVDState*>&
41  relation)
42  {
43  const CKFToSVDState* fromState = relation.first;
44  const CKFToSVDState* toState = relation.second;
45 
46  B2ASSERT("From and to state must be set", fromState and toState);
47 
48  const CKFToSVDState::stateCache& outerStateCache = fromState->getStateCache();
49  const CKFToSVDState::stateCache& innerStateCache = toState->getStateCache();
50 
51  B2ASSERT("Both hits must be present!", outerStateCache.isHitState and innerStateCache.isHitState);
52 
53  // TODO maybe it would be better to look for the full IDs first; maybe not
54  B2ASSERT("Outer hit is invalid",
55  m_vxdtfFilters->areCoordinatesValid(outerStateCache.sensorID, outerStateCache.localNormalizedu, outerStateCache.localNormalizedv));
56  B2ASSERT("Inner hit is invalid",
57  m_vxdtfFilters->areCoordinatesValid(innerStateCache.sensorID, innerStateCache.localNormalizedu, innerStateCache.localNormalizedv));
58 
59  FullSecID outerSecID = m_vxdtfFilters->getFullID(outerStateCache.sensorID, outerStateCache.localNormalizedu,
60  outerStateCache.localNormalizedv);
61  FullSecID innerSecID = m_vxdtfFilters->getFullID(innerStateCache.sensorID, innerStateCache.localNormalizedu,
62  innerStateCache.localNormalizedv);
63 
64  const auto* outerStaticSector = m_vxdtfFilters->getStaticSector(outerSecID);
65 
66  const auto* filter = outerStaticSector->getFilter2sp(innerSecID);
67  if (not filter) {
68  return NAN;
69  }
70 
71  const SpacePoint* outerHit = fromState->getHit();
72  const SpacePoint* innerHit = toState->getHit();
73 
74  if (not filter->accept(*outerHit, *innerHit)) {
75  return NAN;
76  }
77 
78  B2INFO(outerSecID.getVxdID() << " -> " << innerSecID.getVxdID());
79  return 1;
80  }
82 }
Belle2::SectorMapBasedSVDPairFilter::beginRun
void beginRun() final
Initialize the sector map.
Definition: SectorMapBasedSVDPairFilter.cc:32
Belle2::filter
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double >> &runs, double cut, std::map< ExpRun, std::pair< double, double >> &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:43
Belle2::SectorMapBasedSVDPairFilter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters of the filter.
Definition: SectorMapBasedSVDPairFilter.cc:42
Belle2::SectorMapBasedSVDPairFilter::m_vxdtfFilters
SectorMapFilter * m_vxdtfFilters
The sector map filter, will be set in begin run.
Definition: SectorMapBasedSVDPairFilter.h:59
Belle2::FullSecID::getVxdID
VxdID getVxdID() const
returns VxdID of sensor.
Definition: FullSecID.h:148
Belle2::SpacePoint
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:52
Belle2::VXDTFFilters::areCoordinatesValid
bool areCoordinatesValid(VxdID aSensorID, double normalizedU, double normalizedV) const
check if using getFullID() would be safe (true if it is safe):
Definition: VXDTFFilters.h:260
Belle2::FiltersContainer::getFilters
VXDTFFilters< point_t > * getFilters(const std::string &setupName)
Gives access to the sector map and filters of a given setup.
Definition: FiltersContainer.h:81
Belle2::VXDTFFilters::getStaticSector
const staticSector_t * getStaticSector(const FullSecID secID) const
returns pointer to static sector for given fullSecID.
Definition: VXDTFFilters.h:232
Belle2::FullSecID
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:43
Belle2::ModuleParamList::addParameter
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Definition: ModuleParamList.templateDetails.h:38
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::beginRun
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
Definition: CompositeProcessingSignalListener.cc:25
Belle2::CKFToSVDState::getStateCache
const struct stateCache & getStateCache() const
Get the cached data of this state.
Definition: CKFToSVDState.h:56
Belle2::SectorMapBasedSVDPairFilter::m_filtersContainer
FilterContainer & m_filtersContainer
The filter container to use.
Definition: SectorMapBasedSVDPairFilter.h:57
Belle2::CKFState::getHit
const Hit * getHit() const
Return the SP this state is related to. May be nullptr.
Definition: CKFState.h:76
Belle2::SectorMapBasedSVDPairFilter::m_param_sectorMapName
std::string m_param_sectorMapName
Name of the sector map to use.
Definition: SectorMapBasedSVDPairFilter.h:61
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::CKFToSVDState
Specialized CKF State for extrapolating into the SVD.
Definition: CKFToSVDState.h:29
Belle2::SectorMapBasedSVDPairFilter::operator()
TrackFindingCDC::Weight operator()(const std::pair< const CKFToSVDState *, const CKFToSVDState * > &relation) override
Give a final weight to the possibilities by asking the filter.
Definition: SectorMapBasedSVDPairFilter.cc:48
Belle2::VXDTFFilters::getFullID
FullSecID getFullID(VxdID aSensorID, double normalizedU, double normalizedV) const
returns fullSecID for given sensorID and local coordinates.
Definition: VXDTFFilters.h:271