7 #include "../LitAddMaterial.h"
8 #include "../LitExtrapolation.h"
9 #include "../LitFieldGrid.h"
10 #include "../LitFiltration.h"
11 #include "../LitHit.h"
12 #include "../LitMath.h"
13 #include "../LitTrackSelection.h"
14 #include "../LitTypes.h"
15 #include "../LitVecPack.h"
28 , fMaxNofMissingHits(3)
29 , fIsProcessSubstationsTogether(true)
31 , fMaxCovSq(20. * 20.)
32 , fChiSqPixelHitCut(25) {}
37 const PixelHitArray&
hits,
38 const TrackArray& trackSeeds,
41 InitTrackSeeds(trackSeeds);
44 DoTrackSelectionMuon(fTracks.begin(), fTracks.end());
48 for (
unsigned int iTrack = 0; iTrack < fTracks.size(); iTrack++) {
51 if (!track->
IsGood()) {
continue; }
59 for_each(fTracks.begin(), fTracks.end(),
DeleteObject());
65 const PixelHitArray&
hits) {
66 for (
unsigned int iHit = 0; iHit <
hits.size(); iHit++) {
69 fHitData.AddHit(hit->planeId, hit);
76 const TrackArray& trackSeeds) {
77 fscal QpCut = 1. / 1.5;
78 for (
unsigned int iTrack = 0; iTrack < trackSeeds.size(); iTrack++) {
84 fTracks.push_back(newTrack);
90 std::vector<unsigned int> tracksId1;
91 std::vector<unsigned int> tracksId2;
94 for (
unsigned int i = 0;
i < fTracks.size();
i++) {
95 tracksId1.push_back(
i);
99 unsigned char nofStationGroups = fLayout.GetNofStationGroups();
100 for (
unsigned char iStationGroup = 0; iStationGroup < nofStationGroups;
103 fLayout.GetStationGroup(iStationGroup);
106 PropagateThroughAbsorber(tracksId1, stg.
GetAbsorber());
110 for (
unsigned char iStation = 0; iStation < nofStations;
114 ProcessStation(tracksId1, iStationGroup, iStation);
118 for (
unsigned int iTrack = 0; iTrack < tracksId1.size(); iTrack++) {
119 unsigned int id = tracksId1[iTrack];
120 if (fTracks[
id]->GetNofMissingHits() <= fMaxNofMissingHits) {
121 tracksId2.push_back(
id);
124 tracksId1.assign(tracksId2.begin(), tracksId2.end());
131 const std::vector<unsigned int>& tracksId1,
133 unsigned int nofTracks = tracksId1.size();
134 unsigned int nofTracksVec =
136 unsigned int dTracks =
142 for (
unsigned int iTrack = 0; iTrack < nofTracksVec; iTrack++) {
143 unsigned int start =
fvecLen * iTrack;
147 tracks[
i] = fTracks[tracksId1[start +
i]];
149 PropagateThroughAbsorber(
tracks, absorber);
155 std::vector<LitScalTrack> dummyTracks(
fvecLen - dTracks);
156 unsigned int start =
fvecLen * nofTracksVec;
157 for (
unsigned int i = 0;
i < dTracks;
i++) {
158 tracks[
i] = fTracks[tracksId1[start +
i]];
162 for (
unsigned int i = 0;
i <
fvecLen - dTracks;
i++) {
163 tracks[dTracks +
i] = &dummyTracks[
i];
166 PropagateThroughAbsorber(
tracks, absorber);
203 const std::vector<unsigned int>& tracksId1,
204 unsigned char stationGroup,
205 unsigned char station) {
206 unsigned int nofTracks = tracksId1.size();
207 unsigned int nofTracksVec =
209 unsigned int dTracks =
214 for (
unsigned int iTrack = 0; iTrack < nofTracksVec;
216 unsigned int start =
fvecLen * iTrack;
220 tracks[
i] = fTracks[tracksId1[start +
i]];
222 ProcessStation(
tracks, stationGroup, station);
228 std::vector<LitScalTrack> dummyTracks(
fvecLen - dTracks);
229 unsigned int start =
fvecLen * nofTracksVec;
230 for (
unsigned int i = 0;
i < dTracks;
i++) {
231 tracks[
i] = fTracks[tracksId1[start +
i]];
235 for (
unsigned int i = 0;
i <
fvecLen - dTracks;
i++) {
236 tracks[dTracks +
i] = &dummyTracks[
i];
239 ProcessStation(
tracks, stationGroup, station);
245 unsigned char stationGroup,
246 unsigned char station) {
252 std::vector<std::vector<LitTrackParamScal>> par(
253 nofSubstations, std::vector<LitTrackParamScal>(
fvecLen));
255 par[0][
i] =
tracks[
i]->GetParamLast();
257 std::vector<LitTrackParam<fvec>> lpar(nofSubstations);
266 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations;
273 if (iSubstation < nofSubstations - 1) {
274 lpar[iSubstation + 1] = lpar[iSubstation];
278 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations;
283 std::vector<LitTrackParamScal> spar(nofSubstations);
284 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations;
286 spar[iSubstation] = par[iSubstation][
i];
289 CollectHits(spar,
tracks[
i], stationGroup, station, nofSubstations);
294 std::vector<LitTrackParamScal>& par,
296 unsigned char stationGroup,
297 unsigned char station,
298 unsigned char nofSubstations) {
299 std::vector<PixelHitConstIteratorPair>
hits(nofSubstations);
300 unsigned int nofHits = 0;
303 for (
unsigned char iSubstation = 0; iSubstation < nofSubstations;
307 const PixelHitArray& hitvec =
308 fHitData.GetHits(stationGroup, station, iSubstation);
309 fscal err = fHitData.GetMaxErr(stationGroup, station, iSubstation);
311 MinMaxIndex(&par[iSubstation],
315 hits[iSubstation].second);
316 nofHits += std::distance(
hits[iSubstation].
first,
hits[iSubstation].second);
320 bool hitAdded =
false;
321 PixelHitArray ahits(nofHits);
322 std::vector<LitTrackParamScal*> apars(nofHits);
323 unsigned int cnt = 0;
324 for (
unsigned char iss = 0; iss < nofSubstations; iss++) {
325 for (PixelHitConstIterator j =
hits[iss].
first; j !=
hits[iss].second;
328 apars[cnt] = &par[iss];
333 if (AddNearestHit(track, ahits, apars, nofHits)) { hitAdded =
true; }
340 const PixelHitArray&
hits,
341 const std::vector<LitTrackParamScal*>& pars,
342 unsigned int nofHits) {
343 bool hitAdded =
false;
348 unsigned int nofHitsVec =
354 for (
unsigned int iHit = 0; iHit < nofHitsVec; iHit++) {
355 unsigned int start =
fvecLen * iHit;
360 hit[
i] = *
hits[start +
i];
367 par[
i] = *pars[start +
i];
379 if (chisq[
i] < fChiSqPixelHitCut[
i] && chisq[
i] < chiSq) {
381 hita =
hits[start +
i];
387 unsigned int start =
fvecLen * nofHitsVec;
392 for (
unsigned int i = 0;
i < dHits;
i++) {
393 hit[
i] = *
hits[start +
i];
394 par[
i] = *pars[start +
i];
398 for (
unsigned int i = 0;
i <
fvecLen - dHits;
i++) {
399 hit[dHits +
i] = *
hits[nofHits - 1];
400 par[dHits +
i] = *pars[nofHits - 1];
413 if (chisq[
i] < fChiSqPixelHitCut[
i] && chisq[
i] < chiSq) {
415 hita =
hits[start +
i];
434 const PixelHitArray&
hits,
436 PixelHitConstIterator&
first,
437 PixelHitConstIterator& last) {
442 if (C0 > fMaxCovSq || C0 < 0.) {
return; }
444 hit.
X = par->
X - devX;
446 std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());
447 hit.
X = par->
X + devX;
449 std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());