Main function of the segment finding by the cellular automaton.
69{
72
74
75 const std::map<ITrackType, std::vector<CDCHitVector>>& mcSegmentsByMCParticleIdx =
77
78 std::size_t nSegments = 0;
79 for (const std::pair<ITrackType, std::vector<CDCHitVector>> mcSegmentsAndMCParticleIdx : mcSegmentsByMCParticleIdx) {
80 const std::vector<CDCHitVector>& mcSegments = mcSegmentsAndMCParticleIdx.second;
81 nSegments += mcSegments.size();
82 }
83
84 outputSegments.reserve(outputSegments.size() + nSegments);
85 for (const std::pair<ITrackType, std::vector<CDCHitVector>> mcSegmentsAndMCParticleIdx : mcSegmentsByMCParticleIdx) {
86
87 const std::vector<CDCHitVector>& mcSegments = mcSegmentsAndMCParticleIdx.second;
88 for (const CDCHitVector& mcSegment : mcSegments) {
89 outputSegments.push_back(CDCSegment2D());
90 CDCSegment2D& segment2D = outputSegments.back();
91 for (const CDCHit* ptrHit : mcSegment) {
92 const CDCWireHit* wireHit = simHitLookUp.
getWireHit(ptrHit, inputWireHits);
93 if (not wireHit) continue;
94
96 segment2D.push_back(recoHit2D);
97 }
98 if (segment2D.size() < 3) outputSegments.pop_back();
99 }
100 }
101
102 CDC::RealisticTDCCountTranslator tdcCountTranslator;
103 for (CDCSegment2D& segment : outputSegments) {
104 for (CDCRecoHit2D& recoHit2D : segment) {
107 double alpha = recoPos2D.
angleWith(flightDirection);
108
109 const CDCWire& wire = recoHit2D.
getWire();
111 const bool rl = recoHit2D.
getRLInfo() == ERightLeft::c_Right;
112
115
116
117 const double beta = 1;
118 double flightTimeEstimate = 0;
120
121 driftLength =
124 flightTimeEstimate,
125 rl,
127 alpha);
128 } else {
129
132 rl,
134 alpha);
135
136 driftLength += gRandom->Gaus(0, std::sqrt(driftLengthVariance));
137 }
138 bool snapRecoPos = true;
140 }
141 }
142
144 for (CDCSegment2D& segment : outputSegments) {
145 if (segment.size() > 1) {
146 CDCRLWireHitSegment rlWireHitSegment = segment.getRLWireHitSegment();
148 }
149 }
150 }
151
152 for (CDCSegment2D& segment : outputSegments) {
153 segment.receiveISuperCluster();
154 }
155 std::sort(outputSegments.begin(), outputSegments.end());
156}
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.
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 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...
static const CDCSimHitLookUp & getInstance()
Getter for the singletone instance.
const CDCWireHit * getWireHit(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Retrieve the wire hit the given CDCHit form the given wire hits.
CDCRecoHit2D getClosestPrimaryRecoHit2D(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Construct an CDCRecoHit2D from the closest primary CDCSimHit information related to the CDCHit.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
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.
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
virtual double getFlightTime2D(const Vector2D &, double, double=1) const
Default estimator for the flight time.
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...
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.