Main function of the track finding by the cellular automaton.
90{
93
95
96 const std::map<ITrackType, CDCHitVector>& mcTracksByMCParticleIdx =
98
99 std::size_t nAxialTracks = mcTracksByMCParticleIdx.size();
100 outputAxialTracks.reserve(outputAxialTracks.size() + nAxialTracks);
101
102 for (const std::pair<ITrackType, CDCHitVector> mcTracksAndMCParticleIdx : mcTracksByMCParticleIdx) {
103
104 const CDCHitVector& mcTrack = mcTracksAndMCParticleIdx.second;
105
106 outputAxialTracks.push_back(CDCTrack());
107 CDCTrack& axialTrack = outputAxialTracks.back();
108 bool reachedOuterMostLayer = false;
109 for (const CDCHit* ptrHit : mcTrack) {
110
112
113
114
115 if (ptrHit->getISuperLayer() == 8 and ptrHit->getILayer() == 5) {
116 reachedOuterMostLayer = true;
117 }
118 if (reachedOuterMostLayer and ptrHit->getILayer() != 5) {
119 break;
120 }
121 }
122
123 const CDCWireHit* wireHit = simHitLookUp.
getWireHit(ptrHit, inputWireHits);
124 if (not wireHit) continue;
125
127 if (not recoHit2D.
isAxial())
continue;
128
129 CDCRecoHit3D recoHit3D(recoHit2D.
getRLWireHit(), {recoHit2D.getRecoPos2D(), 0}, NAN);
130 axialTrack.push_back(recoHit3D);
131 }
132
133
134 if (axialTrack.size() < 5) outputAxialTracks.pop_back();
135 }
136
137 CDC::RealisticTDCCountTranslator tdcCountTranslator;
138 for (CDCTrack& track : outputAxialTracks) {
139 for (CDCRecoHit3D& recoHit3D : track) {
140 Vector2D recoPos2D = recoHit3D.getRecoPos2D();
141 Vector2D flightDirection = recoHit3D.getFlightDirection2D();
142 double alpha = recoPos2D.
angleWith(flightDirection);
143
144 const CDCWire& wire = recoHit3D.getWire();
145 const bool rl = recoHit3D.getRLInfo() == ERightLeft::c_Right;
146
147 double driftLength = std::fabs(recoHit3D.getSignedRecoDriftLength());
149
150
151 const double beta = 1;
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170 driftLength = recoHit3D.getWireHit().getRefDriftLength();
171
172 } else {
173
176 rl,
178 alpha);
179
180 driftLength += gRandom->Gaus(0, std::sqrt(driftLengthVariance));
181 }
182 bool snapRecoPos = true;
183 recoHit3D.setRecoDriftLength(driftLength, snapRecoPos);
184 }
185 }
186
188 CDCKarimakiFitter fitter;
189 for (CDCTrack& track : outputAxialTracks) {
190 CDCTrajectory2D trajectory2D = fitter.fit(track);
193 }
194 } else {
196 for (CDCTrack& track : outputAxialTracks) {
200 }
201 }
202
204 for (CDCTrack& track : outputAxialTracks) {
206 }
207 }
208}
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 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.
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 tracks imitating the Legendre finder.
bool m_param_fit
Parameter : Fit the track instead of forwarding the MC truth information.
bool m_param_useOnlyBeforeTOP
Parameter : Cut tracks after the last layer of the CDC has been reached, assuming the tracks left the...
TrackingUtilities::CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.
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, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > & getMCTracksByMCParticleIdx() const
Getter for the stored Monte Carlo tracks 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.
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit associated with the reconstructed hit.
bool isAxial() const
Indicator if the underlying wire is axial.
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
static CDCTrajectorySZ basicAssumption()
Constructs a basic assumption, what the z0 start position and the sz slope are, including some broad ...
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
static void normalizeTrack(TrackingUtilities::CDCTrack &track)
Refit and resort the track. Unmask all hits.