9 #include "LitDetectorGeometryElectron.h"
10 #include "LitHitDataElectron.h"
12 #include "../LitAddMaterial.h"
13 #include "../LitExtrapolation.h"
14 #include "../LitFieldGrid.h"
15 #include "../LitFiltration.h"
16 #include "../LitHit.h"
17 #include "../LitMath.h"
18 #include "../LitTrack.h"
19 #include "../LitTypes.h"
20 #include "../LitVecPack.h"
28 : fMaxNofMissingHits(4)
30 , fMaxCovSq(20. * 20.)
31 , fChiSqPixelHitCut(15.) {}
36 const PixelHitArray&
hits,
37 const TrackArray& trackSeeds,
40 InitTrackSeeds(trackSeeds);
46 for (
unsigned int iTrack = 0; iTrack < fTracks.size(); iTrack++) {
49 if (!track->
IsGood()) {
continue; }
56 for_each(fTracks.begin(), fTracks.end(),
DeleteObject());
62 const PixelHitArray&
hits) {
63 for (
unsigned int iHit = 0; iHit <
hits.size(); iHit++) {
66 fHitData.AddHit(hit->planeId, hit);
73 const TrackArray& trackSeeds) {
74 fscal QpCut = 1. / 0.1;
75 for (
unsigned int iTrack = 0; iTrack < trackSeeds.size(); iTrack++) {
81 fTracks.push_back(newTrack);
87 std::vector<unsigned int> tracksId1;
88 std::vector<unsigned int> tracksId2;
91 for (
unsigned int i = 0;
i < fTracks.size();
i++) {
92 tracksId1.push_back(
i);
96 unsigned int nofTracks = tracksId1.size();
97 unsigned int nofTracksVec =
99 unsigned int dTracks =
105 for (
unsigned int iTrack = 0; iTrack < nofTracksVec; iTrack++) {
106 unsigned int start =
fvecLen * iTrack;
110 tracks[
i] = fTracks[tracksId1[start +
i]];
112 PropagateToFirstStation(
tracks);
118 std::vector<LitScalTrack> dummyTracks(
fvecLen - dTracks);
119 unsigned int start =
fvecLen * nofTracksVec;
120 for (
unsigned int i = 0;
i < dTracks;
i++) {
121 tracks[
i] = fTracks[tracksId1[start +
i]];
125 for (
unsigned int i = 0;
i <
fvecLen - dTracks;
i++) {
126 tracks[dTracks +
i] = &dummyTracks[
i];
129 PropagateToFirstStation(
tracks);
137 unsigned char nofStationGroups = fLayout.GetNofStationGroups();
138 for (
unsigned char iStationGroup = 0; iStationGroup < nofStationGroups;
140 const LitStationGroupElectron<fvec>& stg =
141 fLayout.GetStationGroup(iStationGroup);
144 unsigned char nofStations = stg.GetNofStations();
145 for (
unsigned char iStation = 0; iStation < nofStations;
148 unsigned int nofTracks = tracksId1.size();
149 unsigned int nofTracksVec =
151 unsigned int dTracks =
158 for (
unsigned int iTrack = 0; iTrack < nofTracksVec;
160 unsigned int start =
fvecLen * iTrack;
164 tracks[
i] = fTracks[tracksId1[start +
i]];
166 ProcessStation(
tracks, iStationGroup, iStation);
173 std::vector<LitScalTrack> dummyTracks(
fvecLen - dTracks);
174 unsigned int start =
fvecLen * nofTracksVec;
175 for (
unsigned int i = 0;
i < dTracks;
i++) {
176 tracks[
i] = fTracks[tracksId1[start +
i]];
180 for (
unsigned int i = 0;
i <
fvecLen - dTracks;
i++) {
181 tracks[dTracks +
i] = &dummyTracks[
i];
184 ProcessStation(
tracks, iStationGroup, iStation);
190 for (
unsigned int iTrack = 0; iTrack < tracksId1.size(); iTrack++) {
191 unsigned int id = tracksId1[iTrack];
192 if (fTracks[
id]->GetNofMissingHits() <= fMaxNofMissingHits) {
193 tracksId2.push_back(
id);
196 tracksId1.assign(tracksId2.begin(), tracksId2.end());
212 for (
unsigned char ivp = 0; ivp < fLayout.GetNofVirtualPlanes() - 1; ivp++) {
213 const LitVirtualPlaneElectronVec& vp1 = fLayout.GetVirtualPlane(ivp);
214 const LitVirtualPlaneElectronVec& vp2 = fLayout.GetVirtualPlane(ivp + 1);
224 vp1.GetFieldGridMid(),
240 unsigned char stationGroup,
241 unsigned char station) {
243 const LitStationGroupElectron<fvec>& stg =
244 fLayout.GetStationGroup(stationGroup);
245 const LitStationElectron<fvec>& sta = stg.GetStation(station);
257 for (
unsigned char im = 0; im < sta.GetNofMaterialsBefore(); im++) {
263 CollectHits(&par[
i],
tracks[
i], stationGroup, station);
266 for (
unsigned char im = 0; im < sta.GetNofMaterialsAfter(); im++) {
274 unsigned char stationGroup,
275 unsigned char station) {
276 PixelHitConstIteratorPair
hits;
279 const std::vector<LitScalPixelHit*>& hitvec =
280 fHitData.GetHits(stationGroup, station);
281 fscal err = fHitData.GetMaxErr(stationGroup, station);
283 MinMaxIndex(par, hitvec, err,
hits.first,
hits.second);
284 unsigned int nofHits = std::distance(
hits.first,
hits.second);
286 bool hitAdded = AddNearestHit(track,
hits, nofHits, stationGroup, station);
294 const PixelHitConstIteratorPair&
hits,
295 unsigned int nofHits,
298 bool hitAdded =
false;
311 const std::vector<LitScalPixelHit*>& hitvec =
312 fHitData.GetHits(stationGroup, station);
313 unsigned int nofHitsVec =
319 for (
unsigned int iHit = 0; iHit < nofHitsVec; iHit++) {
321 std::distance(hitvec.begin(),
hits.first) +
fvecLen * iHit;
326 hit[
i] = *hitvec[start +
i];
340 if (chisq[
i] < fChiSqPixelHitCut[
i] && chisq[
i] < chiSq) {
342 hita = hitvec[start +
i];
349 std::distance(hitvec.begin(),
hits.first) +
fvecLen * nofHitsVec;
354 for (
unsigned int i = 0;
i < dHits;
i++) {
355 hit[
i] = *hitvec[start +
i];
360 for (
unsigned int i = 0;
i <
fvecLen - dHits;
i++) {
361 hit[dHits +
i] = *hitvec[start + dHits - 1];
375 if ((chisq[
i] < fChiSqPixelHitCut[
i]) && (chisq[
i] < chiSq)) {
377 hita = hitvec[start +
i];
396 const PixelHitArray&
hits,
398 PixelHitConstIterator&
first,
399 PixelHitConstIterator& last) {
404 if (C0 > fMaxCovSq || C0 < 0.) {
return; }
406 hit.
X = par->
X - devX;
408 std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());
409 hit.
X = par->
X + devX;
411 std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());