8#include <tracking/trackFindingCDC/filters/wireHitRelation/WholeWireHitRelationFilter.h>
10#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
12#include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
13#include <tracking/trackFindingCDC/topology/CDCWire.h>
15#include <tracking/trackFindingCDC/filters/base/RelationFilter.icc.h>
17#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
18#include <tracking/trackFindingCDC/utilities/Functional.h>
20#include <framework/core/ModuleParamList.templateDetails.h>
27using namespace TrackFindingCDC;
32 : m_param_degree(neighborhoodDegree)
39 const std::string& prefix)
44 "Neighbor degree which are included. 1 for primary, 2 for secondary, 3 ...",
50 const std::vector<CDCWireHit*>& wireHits)
const
52 assert(std::is_sorted(wireHits.begin(), wireHits.end(),
LessOf<Deref>()) &&
53 "Expected wire hits to be sorted");
56 std::vector<const CDCWire*> m_wireNeighbors;
57 m_wireNeighbors.reserve(nWireNeighbors);
59 std::vector<CDCWireHit*> m_wireHitNeighbors;
60 m_wireHitNeighbors.reserve(2 * nWireNeighbors);
63 const CDCWire& wire = from->getWire();
71 const CDCWire* cwSixthSecondWireNeighbor = ccwSixthSecondWireNeighbor;
75 const CDCWire* cwTwelvethSecondWireNeighbor = ccwTwelvethSecondWireNeighbor;
81 m_wireNeighbors.push_back(ccwSixthSecondWireNeighbor);
83 if (cwInWireNeighbor) m_wireNeighbors.push_back(cwInWireNeighbor);
84 if (ccwInWireNeighbor) m_wireNeighbors.push_back(ccwInWireNeighbor);
86 if (cwWireNeighbor) m_wireNeighbors.push_back(cwWireNeighbor);
87 if (ccwWireNeighbor) m_wireNeighbors.push_back(ccwWireNeighbor);
89 if (cwOutWireNeighbor) m_wireNeighbors.push_back(cwOutWireNeighbor);
90 if (ccwOutWireNeighbor) m_wireNeighbors.push_back(ccwOutWireNeighbor);
93 m_wireNeighbors.push_back(ccwTwelvethSecondWireNeighbor);
96 if (cwSixthSecondWireNeighbor) {
97 cwSixthSecondWireNeighbor = cwSixthSecondWireNeighbor->
getNeighborCW();
98 m_wireNeighbors.push_back(cwSixthSecondWireNeighbor);
100 if (ccwSixthSecondWireNeighbor) {
101 ccwSixthSecondWireNeighbor = ccwSixthSecondWireNeighbor->
getNeighborCCW();
102 m_wireNeighbors.push_back(ccwSixthSecondWireNeighbor);
105 if (cwInWireNeighbor) {
107 m_wireNeighbors.push_back(cwInWireNeighbor);
109 if (ccwInWireNeighbor) {
111 m_wireNeighbors.push_back(ccwInWireNeighbor);
114 if (cwWireNeighbor) {
116 m_wireNeighbors.push_back(cwWireNeighbor);
118 if (ccwWireNeighbor) {
120 m_wireNeighbors.push_back(ccwWireNeighbor);
123 if (cwOutWireNeighbor) {
125 m_wireNeighbors.push_back(cwOutWireNeighbor);
127 if (ccwOutWireNeighbor) {
129 m_wireNeighbors.push_back(ccwOutWireNeighbor);
132 if (cwTwelvethSecondWireNeighbor) {
133 cwTwelvethSecondWireNeighbor = cwTwelvethSecondWireNeighbor->
getNeighborCW();
134 m_wireNeighbors.push_back(cwTwelvethSecondWireNeighbor);
136 if (ccwTwelvethSecondWireNeighbor) {
137 ccwTwelvethSecondWireNeighbor = ccwTwelvethSecondWireNeighbor->
getNeighborCCW();
138 m_wireNeighbors.push_back(ccwTwelvethSecondWireNeighbor);
142 std::sort(std::begin(m_wireNeighbors), std::end(m_wireNeighbors));
144 for (
const CDCWire* neighborWire : m_wireNeighbors) {
146 std::equal_range(wireHits.begin(), wireHits.end(), neighborWire,
LessOf<Deref>())};
148 m_wireHitNeighbors.insert(m_wireHitNeighbors.end(),
149 neighborWireHits.begin(),
150 neighborWireHits.end());
153 return m_wireHitNeighbors;
The Module parameter list class.
Class representing a hit wire in the central drift chamber.
Class representing the sense wire arrangement in the whole of the central drift chamber.
MayBePtr< const CDCWire > getNeighborCCWInwards(const WireID &wireID) const
Getter for the nearest counterclockwise neighbor in the next layer outwards.
MayBePtr< const CDCWire > getSecondNeighborSixOClock(const WireID &wireID) const
Getter for secondary neighbor at the six o'clock position.
MayBePtr< const CDCWire > getNeighborCCWOutwards(const WireID &wireID) const
Getter for the nearest counterclockwise neighbor in the next layer outwards.
MayBePtr< const CDCWire > getSecondNeighborTwelveOClock(const WireID &wireID) const
Getter for secondary neighbor at the twelve o'clock position.
MayBePtr< const CDCWire > getNeighborCWInwards(const WireID &wireID) const
Getter for the nearest clockwise neighbor in the next layer outwards.
MayBePtr< const CDCWire > getNeighborCCW(const WireID &wireID) const
Getter for the nearest counterclockwise neighbor.
MayBePtr< const CDCWire > getNeighborCWOutwards(const WireID &wireID) const
Getter for the nearest clockwise neighbor in the next layer outwards.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
MayBePtr< const CDCWire > getNeighborCW(const WireID &wireID) const
Getter for the nearest clockwise neighbor.
Class representing a sense wire in the central drift chamber.
MayBePtr< const CDCWire > getNeighborCCW() const
Gives the closest neighbor in the counterclockwise direction - always exists.
MayBePtr< const CDCWire > getNeighborCW() const
Gives the closest neighbor in the clockwise direction - always exists.
A pair of iterators usable with the range base for loop.
Base class for filtering the neighborhood of objects.
~WholeWireHitRelationFilter()
Default destructor.
WholeWireHitRelationFilter(int neighborhoodDegree=2)
Constructor form the default neighborhood degree.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
std::vector< CDCWireHit * > getPossibleTos(CDCWireHit *from, const std::vector< CDCWireHit * > &wireHits) const final
Returns a vector containing the neighboring wire hits of the given wire hit out of the sorted range g...
int m_param_degree
Degree of the neighbor extend.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.
Functor factory turning a binary functor and two functors into a new functor which executes the binar...