33 , fMaxNofMissingHits(3)
34 , fIsProcessSubstationsTogether(true)
36 , fMaxCovSq(20. * 20.)
37 , fChiSqPixelHitCut(25)
47 InitTrackSeeds(trackSeeds);
50 DoTrackSelectionMuon(fTracks.begin(), fTracks.end());
54 for (
unsigned int iTrack = 0; iTrack < fTracks.size(); iTrack++) {
67 for_each(fTracks.begin(), fTracks.end(),
DeleteObject());
74 for (
unsigned int iHit = 0; iHit <
hits.size(); iHit++) {
77 fHitData.AddHit(hit->planeId, hit);
85 fscal QpCut = 1. / 1.5;
86 for (
unsigned int iTrack = 0; iTrack < trackSeeds.size(); iTrack++) {
94 fTracks.push_back(newTrack);
101 std::vector<unsigned int> tracksId1;
102 std::vector<unsigned int> tracksId2;
105 for (
unsigned int i = 0; i < fTracks.size(); i++) {
106 tracksId1.push_back(i);
110 unsigned char nofStationGroups = fLayout.GetNofStationGroups();
111 for (
unsigned char iStationGroup = 0; iStationGroup < nofStationGroups;
116 PropagateThroughAbsorber(tracksId1, stg.
GetAbsorber());
120 for (
unsigned char iStation = 0; iStation < nofStations; iStation++) {
123 ProcessStation(tracksId1, iStationGroup, iStation);
127 for (
unsigned int iTrack = 0; iTrack < tracksId1.size(); iTrack++) {
128 unsigned int id = tracksId1[iTrack];
129 if (fTracks[
id]->GetNofMissingHits() <= fMaxNofMissingHits) {
130 tracksId2.push_back(
id);
133 tracksId1.assign(tracksId2.begin(), tracksId2.end());
142 unsigned int nofTracks = tracksId1.size();
143 unsigned int nofTracksVec = nofTracks / fvecLen;
144 unsigned int dTracks = nofTracks - fvecLen * nofTracksVec;
147 for (
unsigned int iTrack = 0; iTrack < nofTracksVec; iTrack++) {
148 unsigned int start = fvecLen * iTrack;
150 std::vector<LitScalTrack*>
tracks(fvecLen);
151 for (
unsigned int i = 0; i < fvecLen; i++) {
152 tracks[i] = fTracks[tracksId1[start + i]];
154 PropagateThroughAbsorber(
tracks, absorber);
159 std::vector<LitScalTrack*>
tracks(fvecLen);
160 std::vector<LitScalTrack> dummyTracks(fvecLen - dTracks);
161 unsigned int start = fvecLen * nofTracksVec;
162 for (
unsigned int i = 0; i < dTracks; i++) {
163 tracks[i] = fTracks[tracksId1[start + i]];
166 if (dTracks < fvecLen) {
167 for (
unsigned int i = 0; i < fvecLen - dTracks; i++) {
168 tracks[dTracks + i] = &dummyTracks[i];
171 PropagateThroughAbsorber(
tracks, absorber);
180 for (
unsigned int i = 0; i < fvecLen; i++) {
181 par[i] =
tracks[i]->GetParamLast();
199 for (
unsigned int i = 0; i < fvecLen; i++) {
200 tracks[i]->SetParamLast(par[i]);
205 unsigned char stationGroup,
unsigned char station)
207 unsigned int nofTracks = tracksId1.size();
208 unsigned int nofTracksVec = nofTracks / fvecLen;
209 unsigned int dTracks = nofTracks - fvecLen * nofTracksVec;
211 for (
unsigned int iTrack = 0; iTrack < nofTracksVec; iTrack++) {
212 unsigned int start = fvecLen * iTrack;
214 std::vector<LitScalTrack*>
tracks(fvecLen);
215 for (
unsigned int i = 0; i < fvecLen; i++) {
216 tracks[i] = fTracks[tracksId1[start + i]];
218 ProcessStation(
tracks, stationGroup, station);
223 std::vector<LitScalTrack*>
tracks(fvecLen);
224 std::vector<LitScalTrack> dummyTracks(fvecLen - dTracks);
225 unsigned int start = fvecLen * nofTracksVec;
226 for (
unsigned int i = 0; i < dTracks; i++) {
227 tracks[i] = fTracks[tracksId1[start + i]];
230 if (dTracks < fvecLen) {
231 for (
unsigned int i = 0; i < fvecLen - dTracks; i++) {
232 tracks[dTracks + i] = &dummyTracks[i];
235 ProcessStation(
tracks, stationGroup, station);
240 unsigned char station)
247 std::vector<std::vector<LitTrackParamScal>> par(nofSubstations, std::vector<LitTrackParamScal>(fvecLen));
248 for (
unsigned int i = 0; i < fvecLen; i++) {
249 par[0][i] =
tracks[i]->GetParamLast();
251 std::vector<LitTrackParam<fvec>> lpar(nofSubstations);
260 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations; iSubstation++) {
266 if (iSubstation < nofSubstations - 1) {
267 lpar[iSubstation + 1] = lpar[iSubstation];
271 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations; iSubstation++) {
274 for (
unsigned int i = 0; i < fvecLen; i++) {
275 std::vector<LitTrackParamScal> spar(nofSubstations);
276 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations; iSubstation++) {
277 spar[iSubstation] = par[iSubstation][i];
280 CollectHits(spar,
tracks[i], stationGroup, station, nofSubstations);
285 unsigned char stationGroup,
unsigned char station,
286 unsigned char nofSubstations)
288 std::vector<PixelHitConstIteratorPair>
hits(nofSubstations);
289 unsigned int nofHits = 0;
292 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations; iSubstation++) {
295 const PixelHitArray& hitvec = fHitData.GetHits(stationGroup, station, iSubstation);
296 fscal err = fHitData.GetMaxErr(stationGroup, station, iSubstation);
298 MinMaxIndex(&par[iSubstation], hitvec, err,
hits[iSubstation].
first,
hits[iSubstation].second);
299 nofHits += std::distance(
hits[iSubstation].
first,
hits[iSubstation].second);
303 bool hitAdded =
false;
304 PixelHitArray ahits(nofHits);
305 std::vector<LitTrackParamScal*> apars(nofHits);
306 unsigned int cnt = 0;
307 for (
unsigned char iss = 0; iss < nofSubstations; iss++) {
308 for (PixelHitConstIterator j =
hits[iss].
first; j !=
hits[iss].second; j++) {
310 apars[cnt] = &par[iss];
315 if (AddNearestHit(track, ahits, apars, nofHits)) {
325 const std::vector<LitTrackParamScal*>& pars,
326 unsigned int nofHits)
328 bool hitAdded =
false;
331 fscal chiSq = std::numeric_limits<fscal>::max();
333 unsigned int nofHitsVec = nofHits / fvecLen;
334 unsigned int dHits = nofHits - fvecLen * nofHitsVec;
335 for (
unsigned int iHit = 0; iHit < nofHitsVec; iHit++) {
336 unsigned int start = fvecLen * iHit;
340 for (
unsigned int i = 0; i < fvecLen; i++) {
341 hit[i] = *
hits[start + i];
347 for (
unsigned int i = 0; i < fvecLen; i++) {
348 par[i] = *pars[start + i];
359 for (
unsigned int i = 0; i < fvecLen; i++) {
360 if (chisq[i] < fChiSqPixelHitCut[i] && chisq[i] < chiSq) {
362 hita =
hits[start + i];
368 unsigned int start = fvecLen * nofHitsVec;
373 for (
unsigned int i = 0; i < dHits; i++) {
374 hit[i] = *
hits[start + i];
375 par[i] = *pars[start + i];
378 if (dHits < fvecLen) {
379 for (
unsigned int i = 0; i < fvecLen - dHits; i++) {
380 hit[dHits + i] = *
hits[nofHits - 1];
381 par[dHits + i] = *pars[nofHits - 1];
393 for (
unsigned int i = 0; i < fvecLen; i++) {
394 if (chisq[i] < fChiSqPixelHitCut[i] && chisq[i] < chiSq) {
396 hita =
hits[start + i];
415 PixelHitConstIterator& last)
421 if (C0 > fMaxCovSq || C0 < 0.) {
424 fscal devX = fSigmaCoef * (std::sqrt(C0) + maxErr);
425 hit.
X = par->
X - devX;
426 first = std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());
427 hit.
X = par->
X + devX;
428 last = std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());
static vector< vector< QAHit > > hits
Functions for calculation of the material effects.
Classes for muon geometry description of CBM.
Class stores a grid of magnetic field values in XY slice at Z position.
Class for accessing hits in the track reconstruction.
Parallel implementation of MUCH tracking.
Implementation of the track selection algorithms.
Header files for SSE operations.
Functions to pack and unpack vector data classes.
Functor class for convenient memory release.
Absorber in muon detector layout.
const LitFieldGrid & GetFieldGridFront() const
Return magnetic field grid in front of the absorber.
const LitFieldGrid & GetFieldGridMiddle() const
Return magnetic field grid in the middle of the absorber.
const T & GetZ() const
Return Z position of absorber.
const LitMaterialInfo< T > & GetMaterial() const
Return absorber material.
const LitFieldGrid & GetFieldGridBack() const
Return magnetic field grid in the back of the absorber.
Storage for field approximation along Z.
Base class for pixel hits.
Base class for scalar pixel hits.
void IncChiSq(fscal dChiSq)
Increases chi square by dChiSq.
void SetPreviousTrackId(unsigned short previousTrackId)
Sets previous trackId.
const LitTrackParamScal & GetParamFirst() const
Returns first parameter of the track.
void SetNDF(unsigned short NDF)
Sets number of degrees of freedom.
const LitTrackParamScal & GetParamLast() const
Returns last parameter of the track.
bool IsGood() const
Returns true if track is good.
void SetParamLast(const LitTrackParamScal ¶m)
Sets last track parameter.
void IncNofMissingHits(unsigned short dNofMissingHits=1)
Increases number of missing hits by dNofMissingHits.
void AddHit(const LitScalPixelHit *hit)
Adds hit to track.
void GetFieldRegion(T x, T y, LitFieldRegion< T > &field) const
Calculate field region for the group of stations.
unsigned char GetNofStations() const
Return number of stations in this station group.
const LitStationMuon< T > & GetStation(unsigned short index) const
Return station by index.
const LitAbsorber< T > & GetAbsorber() const
Return absorber.
Station in muon detector layout.
const LitSubstationMuon< T > & GetSubstation(unsigned short index) const
Return substation by index.
unsigned char GetNofSubstations() const
Return number of substations in station.
Substation in muon detector layout.
const T & GetZ() const
Return Z position of substation.
const LitMaterialInfo< T > & GetMaterial() const
Return material of substation.
virtual ~LitTrackFinderNNVecMuon()
Destructor.
void InitTrackSeeds(const TrackArray &trackSeeds)
void MinMaxIndex(const LitTrackParamScal *par, const PixelHitArray &hits, fscal maxErr, PixelHitConstIterator &first, PixelHitConstIterator &last)
void CollectHits(std::vector< LitTrackParamScal > &par, LitScalTrack *track, unsigned char stationGroup, unsigned char station, unsigned char nofSubstations)
void PropagateThroughAbsorber(const std::vector< unsigned int > &tracksId1, const LitAbsorber< fvec > &absorber)
bool AddNearestHit(LitScalTrack *track, const PixelHitArray &hits, const std::vector< LitTrackParamScal * > &pars, unsigned int nofHits)
LitTrackFinderNNVecMuon()
Constructor.
void ProcessStation(const std::vector< unsigned int > &tracksId1, unsigned char stationGroup, unsigned char station)
virtual void DoFind(const PixelHitArray &hits, const TrackArray &trackSeeds, TrackArray &tracks)
Main function for tracking.
void ArrangeHits(const PixelHitArray &hits)
void PackPixelHit(const LitScalPixelHit hit[], LitPixelHit< fvec > &lhit)
Packs LitPixelHit.
void UnpackTrackParam(const LitTrackParam< fvec > &lpar, LitTrackParam< fscal > par[])
Unpacks LitTrackParam.
void LitRK4Extrapolation(LitTrackParam< T > &par, T zOut, const LitFieldGrid &field1, const LitFieldGrid &field2, const LitFieldGrid &field3)
void LitFiltration(LitTrackParam< T > &par, const LitPixelHit< T > &hit, T &chiSq)
Function implements Kalman filter update step for pixel hit.
void LitLineExtrapolation(LitTrackParam< T > &par, T zOut)
Line track extrapolation for the field free regions.
void PackTrackParam(const LitTrackParam< fscal > par[], LitTrackParam< fvec > &lpar)
Packs LitTrackParam.
void LitAddMaterial(LitTrackParam< T > &par, T siliconThickness)
unsigned short NDF(const LitScalTrack &track)
Returns number of degrees of freedom for the track.