13#include "LitDetectorGeometryElectron.h"
14#include "LitHitDataElectron.h"
32 : fMaxNofMissingHits(4)
34 , fMaxCovSq(20. * 20.)
35 , fChiSqPixelHitCut(15.)
45 InitTrackSeeds(trackSeeds);
51 for (
unsigned int iTrack = 0; iTrack < fTracks.size(); iTrack++) {
65 for_each(fTracks.begin(), fTracks.end(),
DeleteObject());
72 for (
unsigned int iHit = 0; iHit <
hits.size(); iHit++) {
75 fHitData.AddHit(hit->planeId, hit);
83 fscal QpCut = 1. / 0.1;
84 for (
unsigned int iTrack = 0; iTrack < trackSeeds.size(); iTrack++) {
92 fTracks.push_back(newTrack);
99 std::vector<unsigned int> tracksId1;
100 std::vector<unsigned int> tracksId2;
103 for (
unsigned int i = 0; i < fTracks.size(); i++) {
104 tracksId1.push_back(i);
108 unsigned int nofTracks = tracksId1.size();
109 unsigned int nofTracksVec = nofTracks / fvecLen;
110 unsigned int dTracks = nofTracks - fvecLen * nofTracksVec;
113 for (
unsigned int iTrack = 0; iTrack < nofTracksVec; iTrack++) {
114 unsigned int start = fvecLen * iTrack;
117 for (
unsigned int i = 0; i < fvecLen; i++) {
118 tracks[i] = fTracks[tracksId1[start + i]];
120 PropagateToFirstStation(
tracks);
126 std::vector<LitScalTrack> dummyTracks(fvecLen - dTracks);
127 unsigned int start = fvecLen * nofTracksVec;
128 for (
unsigned int i = 0; i < dTracks; i++) {
129 tracks[i] = fTracks[tracksId1[start + i]];
132 if (dTracks < fvecLen) {
133 for (
unsigned int i = 0; i < fvecLen - dTracks; i++) {
134 tracks[dTracks + i] = &dummyTracks[i];
137 PropagateToFirstStation(
tracks);
145 unsigned char nofStationGroups = fLayout.GetNofStationGroups();
146 for (
unsigned char iStationGroup = 0; iStationGroup < nofStationGroups;
148 const LitStationGroupElectron<fvec>& stg = fLayout.GetStationGroup(iStationGroup);
151 unsigned char nofStations = stg.GetNofStations();
152 for (
unsigned char iStation = 0; iStation < nofStations; iStation++) {
154 unsigned int nofTracks = tracksId1.size();
155 unsigned int nofTracksVec = nofTracks / fvecLen;
156 unsigned int dTracks = nofTracks - fvecLen * nofTracksVec;
160 for (
unsigned int iTrack = 0; iTrack < nofTracksVec; iTrack++) {
161 unsigned int start = fvecLen * iTrack;
164 for (
unsigned int i = 0; i < fvecLen; i++) {
165 tracks[i] = fTracks[tracksId1[start + i]];
167 ProcessStation(
tracks, iStationGroup, iStation);
174 std::vector<LitScalTrack> dummyTracks(fvecLen - dTracks);
175 unsigned int start = fvecLen * nofTracksVec;
176 for (
unsigned int i = 0; i < dTracks; i++) {
177 tracks[i] = fTracks[tracksId1[start + i]];
180 if (dTracks < fvecLen) {
181 for (
unsigned int i = 0; i < fvecLen - dTracks; i++) {
182 tracks[dTracks + i] = &dummyTracks[i];
185 ProcessStation(
tracks, iStationGroup, iStation);
191 for (
unsigned int iTrack = 0; iTrack < tracksId1.size(); iTrack++) {
192 unsigned int id = tracksId1[iTrack];
193 if (fTracks[
id]->GetNofMissingHits() <= fMaxNofMissingHits) {
194 tracksId2.push_back(
id);
197 tracksId1.assign(tracksId2.begin(), tracksId2.end());
207 for (
unsigned int i = 0; i < fvecLen; i++) {
208 par[i] =
tracks[i]->GetParamLast();
213 for (
unsigned char ivp = 0; ivp < fLayout.GetNofVirtualPlanes() - 1; ivp++) {
214 const LitVirtualPlaneElectronVec& vp1 = fLayout.GetVirtualPlane(ivp);
215 const LitVirtualPlaneElectronVec& vp2 = fLayout.GetVirtualPlane(ivp + 1);
230 for (
unsigned int i = 0; i < fvecLen; i++) {
231 tracks[i]->SetParamLast(par[i]);
236 unsigned char station)
239 const LitStationGroupElectron<fvec>& stg = fLayout.GetStationGroup(stationGroup);
240 const LitStationElectron<fvec>& sta = stg.GetStation(station);
244 for (
unsigned int i = 0; i < fvecLen; i++) {
245 par[i] =
tracks[i]->GetParamLast();
252 for (
unsigned char im = 0; im < sta.GetNofMaterialsBefore(); im++) {
257 for (
unsigned int i = 0; i < fvecLen; i++) {
258 CollectHits(&par[i],
tracks[i], stationGroup, station);
261 for (
unsigned char im = 0; im < sta.GetNofMaterialsAfter(); im++) {
267 unsigned char stationGroup,
unsigned char station)
269 PixelHitConstIteratorPair
hits;
272 const std::vector<LitScalPixelHit*>& hitvec = fHitData.GetHits(stationGroup, station);
273 fscal err = fHitData.GetMaxErr(stationGroup, station);
275 MinMaxIndex(par, hitvec, err,
hits.first,
hits.second);
276 unsigned int nofHits = std::distance(
hits.first,
hits.second);
278 bool hitAdded = AddNearestHit(track,
hits, nofHits, stationGroup, station);
287 const PixelHitConstIteratorPair&
hits,
288 unsigned int nofHits,
int stationGroup,
int station)
290 bool hitAdded =
false;
293 fscal chiSq = std::numeric_limits<fscal>::max();
297 for (
unsigned int i = 0; i < fvecLen; i++) {
303 const std::vector<LitScalPixelHit*>& hitvec = fHitData.GetHits(stationGroup, station);
304 unsigned int nofHitsVec = nofHits / fvecLen;
305 unsigned int dHits = nofHits - fvecLen * nofHitsVec;
306 for (
unsigned int iHit = 0; iHit < nofHitsVec; iHit++) {
307 unsigned int start = std::distance(hitvec.begin(),
hits.first) + fvecLen * iHit;
311 for (
unsigned int i = 0; i < fvecLen; i++) {
312 hit[i] = *hitvec[start + i];
325 for (
unsigned int i = 0; i < fvecLen; i++) {
326 if (chisq[i] < fChiSqPixelHitCut[i] && chisq[i] < chiSq) {
328 hita = hitvec[start + i];
334 unsigned int start = std::distance(hitvec.begin(),
hits.first) + fvecLen * nofHitsVec;
339 for (
unsigned int i = 0; i < dHits; i++) {
340 hit[i] = *hitvec[start + i];
344 if (dHits < fvecLen) {
345 for (
unsigned int i = 0; i < fvecLen - dHits; i++) {
346 hit[dHits + i] = *hitvec[start + dHits - 1];
359 for (
unsigned int i = 0; i < fvecLen; i++) {
360 if ((chisq[i] < fChiSqPixelHitCut[i]) && (chisq[i] < chiSq)) {
362 hita = hitvec[start + i];
381 PixelHitConstIterator& last)
387 if (C0 > fMaxCovSq || C0 < 0.) {
390 fscal devX = fSigmaCoef * (std::sqrt(C0) + maxErr);
391 hit.
X = par->
X - devX;
392 first = std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());
393 hit.
X = par->
X + devX;
394 last = std::lower_bound(
hits.begin(),
hits.end(), &hit, ComparePixelHitXLess());
static vector< vector< QAHit > > hits
Functions for calculation of the material effects.
Class stores a grid of magnetic field values in XY slice at Z position.
Parallel SIMDized implementation of TRD tracking.
Header files for SSE operations.
Functions to pack and unpack vector data classes.
Functor class for convenient memory release.
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.
unsigned short GetNofHits() const
Returns number of hits in track.
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.
virtual ~LitTrackFinderNNVecElectron()
Destructor.
void PropagateToFirstStation(LitScalTrack *tracks[])
void DoFind(const PixelHitArray &hits, const TrackArray &trackSeeds, TrackArray &tracks)
Main function for track reconstruction.
LitTrackFinderNNVecElectron()
Constructor.
void CollectHits(LitTrackParamScal *par, LitScalTrack *track, unsigned char stationGroup, unsigned char station)
bool AddNearestHit(LitScalTrack *track, const PixelHitConstIteratorPair &hits, unsigned int nofHits, int stationGroup, int station)
void MinMaxIndex(const LitTrackParamScal *par, const PixelHitArray &hits, fscal maxErr, PixelHitConstIterator &first, PixelHitConstIterator &last)
void InitTrackSeeds(const TrackArray &trackSeeds)
void ProcessStation(LitScalTrack *tracks[], unsigned char stationGroup, unsigned char station)
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.