Main function of the segment finding by the cellular automaton.
71{
74
76
77 const std::map<ITrackType, std::vector<CDCHitVector>>& mcSegmentsByMCParticleIdx =
79
80 std::size_t nSegments = 0;
81 for (const std::pair<ITrackType, std::vector<CDCHitVector>> mcSegmentsAndMCParticleIdx : mcSegmentsByMCParticleIdx) {
82 const std::vector<CDCHitVector>& mcSegments = mcSegmentsAndMCParticleIdx.second;
83 nSegments += mcSegments.size();
84 }
85
86 outputSegments.reserve(outputSegments.size() + nSegments);
87 for (const std::pair<ITrackType, std::vector<CDCHitVector>> mcSegmentsAndMCParticleIdx : mcSegmentsByMCParticleIdx) {
88
89 const std::vector<CDCHitVector>& mcSegments = mcSegmentsAndMCParticleIdx.second;
90 for (const CDCHitVector& mcSegment : mcSegments) {
91 outputSegments.push_back(CDCSegment2D());
92 CDCSegment2D& segment2D = outputSegments.back();
93 for (const CDCHit* ptrHit : mcSegment) {
94 const CDCWireHit* wireHit = simHitLookUp.
getWireHit(ptrHit, inputWireHits);
95 if (not wireHit) continue;
96
98 segment2D.push_back(recoHit2D);
99 }
100 if (segment2D.size() < 3) outputSegments.pop_back();
101 }
102 }
103
104 CDC::RealisticTDCCountTranslator tdcCountTranslator;
105 for (CDCSegment2D& segment : outputSegments) {
106 for (CDCRecoHit2D& recoHit2D : segment) {
109 double alpha = recoPos2D.
angleWith(flightDirection);
110
111 const CDCWire& wire = recoHit2D.
getWire();
113 const bool rl = recoHit2D.
getRLInfo() == ERightLeft::c_Right;
114
117
118
119 const double beta = 1;
120 double flightTimeEstimate = 0;
122
123 driftLength =
126 flightTimeEstimate,
127 rl,
129 alpha);
130 } else {
131
134 rl,
136 alpha);
137
138 driftLength += gRandom->Gaus(0, std::sqrt(driftLengthVariance));
139 }
140 bool snapRecoPos = true;
142 }
143 }
144
146 for (CDCSegment2D& segment : outputSegments) {
147 if (segment.size() > 1) {
148 CDCRLWireHitSegment rlWireHitSegment = segment.getRLWireHitSegment();
150 }
151 }
152 }
153
154 for (CDCSegment2D& segment : outputSegments) {
155 segment.receiveISuperCluster();
156 }
157 std::sort(outputSegments.begin(), outputSegments.end());
158}
short getTDCCount() const
Getter for TDC count.
const WireID & getWireID() const
Getter for the wire id.
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
double getDriftLength(unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
Get Drift length.
double getDriftLengthResolution(double driftLength, const WireID &wireID=WireID(), bool leftRight=false, double z=0, double alpha=0, double=static_cast< double >(TMath::Pi()/2.)) override
Get position resolution^2 corresponding to the drift length from getDriftLength of this class.
static const CDCMCTrackStore & getInstance()
Getter for the singletone instance.
std::vector< const CDCHit * > CDCHitVector
Type for an ordered sequence of pointers to the CDCHit.
const std::map< ITrackType, std::vector< Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > > & getMCSegmentsByMCParticleIdx() const
Getter for the stored Monte Carlo segments ordered by their Monte Carlo Id.
static const CDCSimHitLookUp & getInstance()
Getter for the singletone instance.
TrackingUtilities::CDCRecoHit2D getClosestPrimaryRecoHit2D(const CDCHit *ptrHit, const std::vector< TrackingUtilities::CDCWireHit > &wireHits) const
Construct an TrackingUtilities::CDCRecoHit2D from the closest primary CDCSimHit information related t...
const TrackingUtilities::CDCWireHit * getWireHit(const CDCHit *ptrHit, const std::vector< TrackingUtilities::CDCWireHit > &wireHits) const
Retrieve the wire hit the given CDCHit form the given wire hits.
virtual double getFlightTime2D(const TrackingUtilities::Vector2D &, double, double=1) const
Default estimator for the flight time.
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
bool m_param_reconstructedDriftLength
Parameter : Setup the drift length as it can be estimated from two dimensional information.
bool m_param_reconstructedPositions
Parameter : Switch to reconstruct the positions in the segments imitating the facet ca picking up all...
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the reconstructed hit.
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
const CDC::CDCWire & getWire() const
Getter for the wire the reconstructed hit associated to.
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
ERightLeft getRLInfo() const
Getter for the right left passage information.
static CDCSegment2D reconstructUsingFacets(const CDCRLWireHitSegment &rlWireHitSegment)
Reconstruct from wire hits with attached right left passage hypotheses by constructing facets between...
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.