ATLAS Offline Software
SiTrajectory_xk.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <iostream>
8 #include <iomanip>
9 #include <boost/io/ios_state.hpp>
10 
12 // Set work information to trajectory
14 
16 {
17  m_tools = t;
18  for (int i=0; i!=300; ++i) m_elements[i].setTools(t);
19 }
20 
22 {
23  for (int i=0; i!=300; ++i) m_elements[i].setParameters();
24 }
25 
27 // Erase trajector element
29 
31 {
32  if (n>=0 && n<m_nElements) {
33  for (int i=n; i!=m_nElements-1; ++i) m_elementsMap[i] = m_elementsMap[i+1];
34  --m_nElements;
35  }
36 }
37 
39 // Trajectory conversion to TrackStateOnSurface
41 
44 {
45  if (!cosmic || m_elements[m_elementsMap[m_firstElement]].parametersUB().parameters()[2] < 0.) {
47  }
49 }
50 
52 // Trajectory conversion to TrackStateOnSurface with old direction
54 
57 {
58 
59  auto dtsos = Trk::TrackStates();
60 
61  bool multi = m_tools->multiTrack();
62  if (m_nclusters <= m_tools->clustersmin() ||
63  pTfirst() < m_tools->pTmin()) multi = false;
64 
65  int i = m_firstElement;
66 
68  tsos = m_elements[m_elementsMap[i]].trackStateOnSurface(false,true,multi,1);
69 
70  if (tsos) dtsos.push_back(tsos);
71 
72  for (++i; i!=m_lastElement; ++i) {
73 
74  int m = m_elementsMap[i];
75  if (m_elements[m].cluster() || m_elements[m].clusterNoAdd() ) {
76  tsos = m_elements[m].trackStateOnSurface(false,false,multi,0);
77  if (tsos) dtsos.push_back(tsos);
78  }
79  }
80 
81  i = m_lastElement;
82  tsos = m_elements[m_elementsMap[i]].trackStateOnSurface(false,false,multi,2);
83  if (tsos) dtsos.push_back(tsos);
84 
85  if (multi) {
86  m_ntos = 0;
87  for (int i=m_firstElement; i<=m_lastElement; ++i) {
88 
89  int m = m_elementsMap[i];
90  if (!m_elements[m].ntsos()) continue;
91  m_atos[m_ntos ] = m;
92  m_itos[m_ntos++] = 0;
93  }
94  }
95  return dtsos;
96 }
97 
99 // Trajectory conversion to TrackStateOnSurface with new direction
101 
104 {
105 
106  auto dtsos = Trk::TrackStates();
107 
108  bool multi = m_tools->multiTrack();
109  if (pTfirst() < m_tools->pTmin()) multi = false;
110 
111  int i = m_lastElement;
112 
114  tsos = m_elements[m_elementsMap[i]].trackStateOnSurface(true,true,multi,2);
115 
116  if (tsos) dtsos.push_back(tsos);
117 
118  for (--i; i!=m_firstElement; --i) {
119 
120  int m = m_elementsMap[i];
121  if (m_elements[m].cluster() || m_elements[m].clusterNoAdd() ) {
122  tsos = m_elements[m].trackStateOnSurface(true,false,multi,0);
123  if (tsos) dtsos.push_back(tsos);
124  }
125  }
126 
127  i = m_firstElement;
128  tsos = m_elements[m_elementsMap[i]].trackStateOnSurface(true,false,multi,1);
129  if (tsos) dtsos.push_back(tsos);
130 
131  return dtsos;
132 }
133 
135 // Trajectory conversion to simple TrackStateOnSurface
137 
140 {
141  if (!cosmic || m_elements[m_elementsMap[m_firstElement]].parametersUB().parameters()[2] < 0.) {
143  }
145 }
146 
148 // Trajectory conversion to simple TrackStateOnSurface with old direction
150 
153 {
154  auto dtsos = Trk::TrackStates();
155 
156  int i = m_firstElement;
157 
160 
161  if (tsos) dtsos.push_back(tsos);
162 
164 
165  if (tsos) dtsos.push_back(tsos);
166 
167  int lastClusterElement = 0;
168  for (int j=m_lastElement; j>=i; j--) {
169  int m = m_elementsMap[j];
170  if (m_elements[m].cluster()) {
171  lastClusterElement = j;
172  break;
173  }
174  }
175  if( lastClusterElement==0 || lastClusterElement==i ) return dtsos;
176 
177  for (++i; i<std::min(lastClusterElement,m_lastElement); ++i) {
178 
179  int m = m_elementsMap[i];
180  if (m_elements[m].cluster()) {
181  tsos = m_elements[m].trackSimpleStateOnSurface(false,false,0);
182  if (tsos) dtsos.push_back(tsos);
183  }
184  }
185 
186  i = std::min(lastClusterElement,m_lastElement);
187  tsos = m_elements[m_elementsMap[i]].trackSimpleStateOnSurface(false,true,2);
188  if (tsos) dtsos.push_back(tsos);
189 
190  return dtsos;
191 }
192 
194 // Trajectory conversion to simple TrackStateOnSurface with new direction
196 
199 {
200  auto dtsos = Trk::TrackStates();
201 
202  int i = m_lastElement;
203 
205  tsos = m_elements[m_elementsMap[i]].trackSimpleStateOnSurface(true,true,2);
206 
207  if (tsos) dtsos.push_back(tsos);
208 
209  for (--i; i!=m_firstElement; --i) {
210 
211  int m = m_elementsMap[i];
212  if (m_elements[m].cluster() || m_elements[m].clusterNoAdd() ) {
213  tsos = m_elements[m].trackSimpleStateOnSurface(true,false,0);
214  if (tsos) dtsos.push_back(tsos);
215  }
216  }
217 
218  i = m_firstElement;
219  tsos = m_elements[m_elementsMap[i]].trackSimpleStateOnSurface(true,false,1);
220  if (tsos) dtsos.push_back(tsos);
221 
222  return dtsos;
223 }
224 
226 // Trajectory conversion to simple TrackStateOnSurface
227 // Only for Disappearing Track Trigger that uses also failed tracks
229 
232 {
233  if (!cosmic || m_elements[m_elementsMap[m_firstElement]].parametersUB().parameters()[2] < 0.) {
235  }
237 }
238 
240 // Trajectory conversion to simple TrackStateOnSurface with old direction
241 // Only for Disappearing Track Trigger that uses also failed tracks
243 
246 {
247  auto dtsos = Trk::TrackStates();
248 
249  int i = m_firstElement;
250 
253 
254  if (tsos) dtsos.push_back(tsos);
255 
256  tsos = m_elements[m_elementsMap[i]].trackSimpleStateOnSurface(false,false,0);
257 
258  if (tsos) dtsos.push_back(tsos);
259 
260  int lastClusterElement = 0;
261  for (int j=m_lastElement; j>=i; j--) {
262  int m = m_elementsMap[j];
263  if (m_elements[m].cluster()) {
264  lastClusterElement = j;
265  break;
266  }
267  }
268  if( lastClusterElement==0 || lastClusterElement==i ) return dtsos;
269 
270  for (++i; i<std::min(lastClusterElement,m_lastElement); ++i) {
271 
272  int m = m_elementsMap[i];
273  if (m_elements[m].cluster()) {
274  tsos = m_elements[m].trackSimpleStateOnSurface(false,false,0);
275  if (tsos) dtsos.push_back(tsos);
276  }
277  }
278 
279  i = std::min(lastClusterElement,m_lastElement);
280  tsos = m_elements[m_elementsMap[i]].trackSimpleStateOnSurface(false,true,2);
281  if (tsos) dtsos.push_back(tsos);
282 
283  return dtsos;
284 }
285 
287 // FitQuality production
289 
290 std::unique_ptr<Trk::FitQuality> InDet::SiTrajectory_xk::convertToFitQuality() const{
292  return std::make_unique<Trk::FitQuality>(xi2, (m_ndf - 5));
293 }
294 
296 // Test is it new track
298 
300 (std::multimap<const Trk::PrepRawData*,const Trk::Track*>& map) const
301 {
302  if (m_firstElement==-100) return false;//i.e. the int array never had elements inserted
303  const Trk::PrepRawData* prd [100];
304  std::multimap<const Trk::PrepRawData*,const Trk::Track*>::const_iterator
305  ti,t[100],te = map.end();
306  int n = 0 ;
307  for (int i=m_firstElement; i<=m_lastElement; ++i) {
308  if (n >= 100) break;
309  int m = m_elementsMap[i];
310 
311  if (m_elements[m].cluster()) {
312  prd[n] = m_elements[m].cluster();
313  t[n] = map.find(prd[n]);
314  if (t[n]==te) return true;
315  ++n;
316  } else if (m_elements[m].clusterNoAdd()) {
317  prd[n] = m_elements[m].clusterNoAdd();
318  t[n] = map.find(prd[n]);
319  if (t[n]==te) return true;
320  ++n;
321  }
322  }
323 
324  int nclt = m_nclusters + m_nclustersNoAdd;
325 
326  for (int i=0; i!=n; ++i) {
327  int nclmax = 0;
328  for (ti=t[i]; ti!=te; ++ti) {
329  if ( (*ti).first != prd[i] ) break;
330  int ncl = (*ti).second->measurementsOnTrack()->size();
331  if (ncl > nclmax) nclmax = ncl;
332  }
333  if (nclt > nclmax) return true;
334  }
335  return false;
336 }
337 
339 // Overload of << operator std::ostream
341 
342 std::ostream& InDet::operator <<
343 (std::ostream& sl,const InDet::SiTrajectory_xk& se)
344 {
345  return se.dump(sl);
346 }
347 
349 // Dumps relevant information into the ostream
351 
352 std::ostream& InDet::SiTrajectory_xk::dump( std::ostream& out ) const
353 {
354  boost::io::ios_all_saver ias(out);
355 
356  if (m_nElements <=0 ) {
357  out<<"Trajectory does not exist"<<std::endl; ias.restore();
358  return out;
359  }
360  if (m_firstElement >= m_lastElement ) {
361  out<<"Trajectory is wrong"<<std::endl; ias.restore();
362  return out;
363  }
364 
365  out<<"|--------------------------------------------------------------------------------------------------------|"
366  <<std::endl;
367  out<<"| TRAJECTORY "
368  <<" |"
369  <<std::endl;
370 
371  out<<"| Has"<<std::setw(3)<<m_nElements
372  <<" ("
373  <<std::setw(3)<<m_nActiveElements
374  <<")"
375  <<" elements and "
376  <<std::setw(2)<<m_nclusters+m_nclustersNoAdd<<" ("
377  <<std::setw(2)<<m_nclustersNoAdd<<") clusters and "
378  <<std::setw(2)<<m_ndf<<" weighted clusters and quality = "<<std::setw(12)<<std::setprecision(5)<<quality()
379  <<" |"
380  <<std::endl;
381  out<<"| Has number of holes before, inside, after and gap= "
382  <<std::setw(2)<<m_nHolesBefore
383  <<std::setw(2)<<m_nholes
384  <<std::setw(2)<<m_nHolesAfter
385  <<std::setw(3)<<m_dholes<<" |"
386  <<std::endl;
387  out<<"| F B |"
388  <<std::endl;
389 
390  out<<"|---|--|---|-----|-|-|---------|---------|---------|---------|----------|---------|-|--|--|--|-|-|-|-|-|-|---------|"
391  <<std::endl;
392  out<<"| # |SS| D| Ncl |C|O| Xi2F | Xi2B | Az.Angle| Radius | pT(GeV) | dZ/dR |N|In|Lf|Lb|S|D|H|G|H|G| Step |"
393  <<std::endl;
394  out<<"|---|--|---|-----|-|-|---------|---------|---------|---------|----------|---------|-|--|--|--|-|-|-|-|-|-|---------|"
395  <<std::endl;
396 
397  for (int i=0; i!=m_nElements; ++i) {
398 
399  int m = m_elementsMap[i];
400 
401  std::string DET = "D ";
403  std::string DE = " ";
404  if (m_elements[m].detstatus() < 0) DE = "-";
405  if (D) {
406  if (D->isPixel()) {
407  if (D->isBarrel()) DET = "Pb"; else DET = "Pe";
408  }
409  else if (D->isSCT()) {
410  if (D->isBarrel()) DET = "Sb"; else DET = "Se";
411  }
412  }
413  int c = 0;
414  if (m_elements[m].detstatus() > 0) c = m_elements[m].numberClusters();
415 
416  out<<"|"<<std::setw(3)<<unsigned(i);
417 
418  std::string S0=" ";
419  if (m_firstElement == i) S0="=>";
420  if (m_lastElement == i) S0="=>";
421 
422  std::string S1=" ";
423  std::string S2=" ";
424  if (m_elements[m].cluster ()) S1="+";
425  if (m_elements[m].clusterNoAdd()) S2="+";
426 
427  out<<"|"
428  <<S0<<"|"
429  <<std::setw(1)<<DE
430  <<std::setw(2)<<DET <<"|"
431  <<std::setw(5)<<c <<"|"
432  <<S1<<"|"
433  <<S2<<"|";
434 
435  if (m_elements[m].status()) {
436 
437  out<<std::setw(9)<<std::setprecision(3)<<m_elements[m].xi2F()<<"|";
438  out<<std::setw(9)<<std::setprecision(3)<<m_elements[m].xi2B()<<"|";
439 
440  double ra = 0.;
441  double pt = 0.;
442  double tz = 0.;
443  double fa = 0.;
444 
445  if (m_elements[m].status()==1) {
446 
447  if (m_elements[m].cluster()) {
448 
450  ra = sqrt(gp.x()*gp.x()+gp.y()*gp.y());
451  fa = atan2(gp.y(),gp.x());
452  pt = m_elements[m].parametersUF().momentum().perp();
453  tz = m_elements[m].parametersUF().cotTheta();
454  }
455  else {
456 
458  ra = sqrt(gp.x()*gp.x()+gp.y()*gp.y());
459  fa = atan2(gp.y(),gp.x());
460  pt = m_elements[m].parametersPF().momentum().perp();
461  tz = m_elements[m].parametersPF().cotTheta();
462  }
463  }
464  else if ((m_tools->useFastTracking() and m_elements[m].status()>2) or m_elements[m].status()==2) {
465 
466  if (m_elements[m].cluster()) {
467 
469  ra = sqrt(gp.x()*gp.x()+gp.y()*gp.y());
470  fa = atan2(gp.y(),gp.x());
471  pt = m_elements[m].parametersUB().momentum().perp();
472  tz = m_elements[m].parametersUB().cotTheta();
473  }
474  else {
475 
477  ra = sqrt(gp.x()*gp.x()+gp.y()*gp.y());
478  fa = atan2(gp.y(),gp.x());
479  pt = m_elements[m].parametersPB().momentum().perp();
480  tz = m_elements[m].parametersPB().cotTheta();
481  }
482  }
483  else {
484 
485  Trk::PatternTrackParameters S1,SM,S2(m_elements[m].parametersPF());
486 
487  if (m_elements[m].cluster()) S1 = m_elements[m].parametersUB();
488  else S1 = m_elements[m].parametersPB();
489 
490  bool QA = m_tools->updatorTool()->combineStates(S1,S2,SM);
491 
492  if (QA) {
493 
494  Amg::Vector3D gp = SM.position();
495  ra = sqrt(gp.x()*gp.x()+gp.y()*gp.y());
496  fa = atan2(gp.y(),gp.x());
497  pt = SM.momentum().perp();
498  tz = SM.cotTheta();
499  }
500  }
501  out<<std::setw( 9)<<std::setprecision(4)<<fa <<"|";
502  out<<std::setw( 9)<<std::setprecision(4)<<ra <<"|";
503  out<<std::setw(10)<<std::setprecision(4)<<pt*.001<<"|";
504  out<<std::setw( 9)<<std::setprecision(4)<<tz <<"|";
505  out<<std::setw(1)<<unsigned(m_elements[m].noiseModel())<<"|";
506  out<<std::setw(2)<<m_elements[m].inside()<<"|";
507  out<<std::setw(2)<<unsigned(m_elements[m].nlinksF())<<"|";
508  out<<std::setw(2)<<unsigned(m_elements[m].nlinksB())<<"|";
509  out<<std::setw(1)<<unsigned(m_elements[m].status())<<"|";
510  out<<std::setw(1)<<unsigned(m_elements[m].difference())<<"|";
511  out<<std::setw(1)<<unsigned(m_elements[m].nholesF())<<"|";
512  out<<std::setw(1)<<unsigned(m_elements[m].dholesF())<<"|";
513  out<<std::setw(1)<<unsigned(m_elements[m].nholesB())<<"|";
514  out<<std::setw(1)<<unsigned(m_elements[m].dholesB())<<"|";
515  out<<std::setw(9)<<std::setprecision(4)<<m_elements[m].step()<<"|";
516  }
517  else {
518  out<<" |";
519  out<<" |";
520  out<<" |";
521  out<<" |";
522  out<<" |";
523  out<<" |";
524  out<<" |";
525  out<<" |";
526  out<<" |";
527  out<<" |";
528  out<<" |";
529  out<<" |";
530  out<<" |";
531  out<<" |";
532  out<<" |";
533  out<<" |";
534  out<<std::setw(9)<<std::setprecision(4)<<m_elements[m].step();
535  out<<"|";
536  }
537  out<<std::endl;
538  }
539  out<<"|---|--|---|-----|-|-|---------|---------|---------|---------|----------|---------|-|--|--|--|-|-|-|-|-|-|---------|"
540  <<std::endl;
541  ias.restore();
542  return out;
543 }
544 
546 // pT seed estimation
548 
550  (const Trk::TrackParameters & Tp,
551  std::vector<const InDet::SiCluster*> & Cl,
552  std::vector<const InDet::SiDetElementBoundaryLink_xk*>& DE,
553  const EventContext & ctx)
554 {
555  double Xi2cut = 30.;
556 
557  InDet::SiClusterCollection::const_iterator sib,sie;
559  std::vector<const InDet::SiCluster*> ::iterator s=Cl.begin();
560 
561  int n = 0;
562  if(!m_elements[n].set(1,(*r),sib,sie,(*s),ctx) ) return 0.;
563  if(!m_elements[n].firstTrajectorElement(Tp,ctx)) return 0.;
564 
565  for(++r; r!=re; ++r) {
566  ++n; ++s;
567  if(!m_elements[n].set(1,(*r),sib,sie,(*s),ctx) ) return 0.;
568  if(!m_elements[n].ForwardPropagationWithoutSearch(m_elements[n-1], ctx)) return 0.;
569  if( m_elements[n].xi2F() > Xi2cut ) return 0.;
570  }
571  return m_elements[n].parametersUF().momentum().perp();
572 }
573 
574 
576 // Initiate trajectory
578 
580 (bool PIX,
581  bool SCT,
582  const InDet::PixelClusterContainer* PIXc ,
583  const InDet::SCT_ClusterContainer* SCTc ,
584  const Trk::TrackParameters & Tp ,
585  std::vector<const InDet::SiCluster*> & lSiCluster,
586  std::vector<const InDet::SiDetElementBoundaryLink_xk*>& DE ,
587  bool & rquality ,
588  const EventContext & ctx )
589 {
591  m_nholes = 0;
592  m_nHolesBefore = 0;
593  m_nHolesAfter = 0;
594  m_dholes = 0;
595  m_nclusters = 0;
596  m_nclustersNoAdd = 0;
597  m_nElements = 0;
598  m_nActiveElements = 0;
599  m_firstElement = -100;
600  m_lastElement = 0;
601  m_ndfcut = 0;
602  rquality = true;
603  m_ntos = 0;
604  int ndfwrong = 0;
605  double Xi2cut = 2.*m_tools->xi2max();
606 
607  // radius of the dead cylinder
608  double Rdead = 142.5;
609  // boolean to decide if initialisation is needed or not
610  // initDeadMaterial is False (which means dead material needs be initialised)
611  // for ITk fast tracking configuration
612  bool initDeadMaterial = not(m_tools->isITkGeometry() and m_tools->useFastTracking());
613 
614  if(!initDeadMaterial and !m_surfacedead) m_surfacedead = std::make_unique<const Trk::CylinderSurface>(Rdead,5000.);
615 
617  if (lSiCluster.size() < 2) return false;
618 
619  std::vector<const InDet::SiDetElementBoundaryLink_xk*>::iterator iter_boundaryLink,endBoundaryLinks=DE.end();
620 
621  int up = 0;
622  int last = 0;
623 
626  for (iter_boundaryLink=DE.begin(); iter_boundaryLink!=endBoundaryLinks; ++iter_boundaryLink) {
627 
629  const InDetDD::SiDetectorElement* detectorElement = (*iter_boundaryLink)->detElement();
630  IdentifierHash id = detectorElement->identifyHash();
631 
633  const InDet::SiCluster* theCluster = nullptr;
634 
636  if (detectorElement->isPixel()) {
637  if (PIX) {
638 
639  // Set dead material
640  //
641  // if already initialised, not doing it again
642  if(not initDeadMaterial) {
643  const Trk::PlaneSurface* pla = static_cast<const Trk::PlaneSurface*>(&detectorElement->surface());
644  double R = pla->center().perp();
645  if(R > Rdead) {
646  initDeadMaterial = true;
647  if(!m_elements[m_nElements].setDead(m_surfacedead.get())) return false;
649  if(m_nclusters && !lSiCluster.empty()) {
650  if(!m_elements[m_nElements].ForwardPropagationWithoutSearch(m_elements[up], ctx)) return false;
651  up = m_nElements;
652  }
653  if(++m_nElements==300) break;
654  }
655  }
656 
657  InDet::PixelClusterCollection::const_iterator iter_PixelClusterColl, iter_PixelClusterCollEnd;
659  const InDet::PixelClusterCollection *clustersOnElement = (*PIXc).indexFindPtr(id);
661  if (clustersOnElement!=nullptr && clustersOnElement->begin()!=clustersOnElement->end()) {
662 
664  iter_PixelClusterColl = clustersOnElement->begin();
665  iter_PixelClusterCollEnd = clustersOnElement->end();
666 
669  for (iter_cluster=lSiCluster.begin(); iter_cluster!=lSiCluster.end(); ++iter_cluster) {
671  if ((*iter_cluster)->detectorElement()==detectorElement) {
673  if (m_nclusters==0){
675  }
677  else{
679  }
681  ++m_nclusters;
683  m_ndfcut+=2;
685  theCluster=(*iter_cluster);
687  iter_cluster=lSiCluster.erase(iter_cluster);
691  break;
692  }
693  }
696  bool valid_set = m_elements[m_nElements].set(1,(*iter_boundaryLink),iter_PixelClusterColl,iter_PixelClusterCollEnd,theCluster,ctx);
697  if(m_tools->isITkGeometry() && !valid_set) return false;
700  }
702  else if (m_nActiveElements) {
704  bool valid_set = m_elements[m_nElements].set(0,(*iter_boundaryLink),iter_PixelClusterColl,iter_PixelClusterCollEnd,theCluster,ctx);
705  if(m_tools->isITkGeometry() && !valid_set) return false;
706  }
708  else {
709 
710  continue;
711  }
717  if (++m_nElements==300) break;
718  }
719  }
720  else if (SCT) {
722  InDet::SCT_ClusterCollection::const_iterator iter_stripClusterColl, iter_StripClusterCollEnd;
724  const InDet::SCT_ClusterCollection *clustersOnElement = (*SCTc).indexFindPtr(id);
725 
727  if (clustersOnElement!=nullptr && clustersOnElement->begin()!=clustersOnElement->end()) {
728 
729  iter_stripClusterColl = clustersOnElement->begin();
730  iter_StripClusterCollEnd = clustersOnElement->end();
731 
733  for (iter_cluster=lSiCluster.begin(); iter_cluster!=lSiCluster.end(); ++iter_cluster) {
734  if ((*iter_cluster)->detectorElement()==detectorElement) {
736  if (m_nclusters==0){
739  }
741  else{
743  }
745  ++m_nclusters;
747  m_ndfcut+=1;
749  theCluster=(*iter_cluster);
750  iter_cluster=lSiCluster.erase(iter_cluster);
753  break;
754  }
755  }
757  bool valid_set = m_elements[m_nElements].set(1,(*iter_boundaryLink),iter_stripClusterColl,iter_StripClusterCollEnd,theCluster,ctx);
758  if(m_tools->isITkGeometry() && !valid_set) return false;
761  }
763  else if (m_nActiveElements) {
765  bool valid_set = m_elements[m_nElements].set(0,(*iter_boundaryLink),iter_stripClusterColl,iter_StripClusterCollEnd,theCluster,ctx);
766  if(m_tools->isITkGeometry() && !valid_set) return false;
767  }
769  else {
771  continue;
772  }
777  if (++m_nElements==300) break;
778  }
779 
781  if (m_firstElement == m_nElements-1) {
782  up = m_nElements-1;
783  if (!m_elements[up].firstTrajectorElement(Tp, ctx)) return false;
784  }
789  else if (theCluster) {
790 
792  if (!m_elements[m_nElements-1].ForwardPropagationWithoutSearch(m_elements[up],ctx)) {
793  return false;
794  }
796  up = m_nElements-1;
798  if (m_elements[m_nElements-1].xi2F() <= Xi2cut) {
799  last=up;
800  }
802  else {
803  if (m_tools->isITkGeometry()) return false;
804  else{
806  ndfwrong+=m_elements[m_nElements-1].ndf();
808  if (ndfwrong > 3) return false;
812  --m_nclusters;
815  }
816  }
817  }
821  else if (m_nclusters && !lSiCluster.empty()) {
824  if (!m_elements[m_nElements-1].ForwardPropagationWithoutSearch(m_elements[up], ctx)) {
826  if(not m_tools->isITkGeometry() and m_elements[m_nElements-1].cluster()) return false;
829  --m_nElements;
831  if (m_elements[m_nElements-1].detstatus()) --m_nActiveElements;
832  }
834  else {
836  if (m_elements[m_nElements-1].inside()<0) ++m_nholes;
838  up = m_nElements-1;
839  }
840  }
841  }
842 
844  if (!lSiCluster.empty()) {
846  rquality = false;
847  return false;
848  }
851  if (not m_tools->isITkGeometry() && ndfwrong && m_ndfcut < 6) return false;
852 
854  m_ndf = m_ndfcut;
856  if (m_tools->isITkGeometry() || m_ndfcut > 6) m_ndfcut = 6;
857 
859  int n = m_nElements-1;
861  for (; n>0; --n) {
863  if (m_elements[n].detstatus()>=0) break;
864  }
867  m_nElements = n+1;
868 
870  for (; n>0; --n) {
871  if (m_elements[n].detstatus() == 1) {
873  break;
874  }
875  }
876 
879  int m = m_firstElement+1;
880  m_lastElement = last ;
883  for (n = m; n!=m_lastElement; ++n) {
887  if (En.cluster() || En.inside() <= 0) m_elementsMap[m++] = m_elementsMap[n];
888  }
890 
892  if (m!=n) {
894  m_lastElement = m;
896  for (; n!=m_nElements; ++n){
898  }
899  m_nElements = m;
900  }
901  if (!m_tools->bremNoise()) return true;
902 
904  for (n=m_lastElement; n!=m_nElements; ++n) {
906  }
907  return true;
908 }
909 
911 // Seacrh cluster compatible with track parameters
913 
915 (const InDet::PixelClusterContainer* PIXc ,
916  const InDet::SCT_ClusterContainer* SCTc ,
917  const Trk::TrackParameters & Tp ,
918  std::vector<const InDet::SiDetElementBoundaryLink_xk*> & DE ,
919  std::multimap<const Trk::PrepRawData*,const Trk::Track*>& PT ,
920  std::vector<const InDet::SiCluster*> & lSiCluster,
921  const EventContext& ctx)
922 {
923  m_nElements = 0;
924  m_ndf = 0;
925 
926  std::multimap<double,const InDet::SiCluster*> xi2cluster;
927 
928  std::vector<const InDet::SiDetElementBoundaryLink_xk*>::iterator iter_boundaryLink,endBoundaryLinks=DE.end();
929  std::multimap<const Trk::PrepRawData*,const Trk::Track*>::const_iterator t, te =PT.end();
930 
931  double xi2Cut = .5;
932  int ndfCut = 6;
933 
934  for (iter_boundaryLink=DE.begin(); iter_boundaryLink!=endBoundaryLinks; ++iter_boundaryLink) {
935 
936  const InDetDD::SiDetectorElement* detectorElement = (*iter_boundaryLink)->detElement();
937  IdentifierHash id = detectorElement->identifyHash();
938 
939  bool sct = detectorElement->isSCT();
940 
941  if (!sct) {
942  InDet::PixelClusterCollection::const_iterator sib, sie;
943  const InDet::PixelClusterCollection *w = (*PIXc).indexFindPtr(id);
944 
945  if (w!=nullptr && w->begin()!=w->end()) {
946  sib = w->begin();
947  sie = w->end ();
948  } else {
949  continue;
950  }
951  if (!m_elements[0].ForwardPropagationForClusterSeach(m_nElements,Tp,(*iter_boundaryLink),sib,sie,ctx)) return false;
952  } else {
953  InDet::SCT_ClusterCollection::const_iterator sib, sie;
954  const InDet::SCT_ClusterCollection *w = (*SCTc).indexFindPtr(id);
955 
956  if (w!=nullptr && w->begin()!=w->end()) {
957  sib = w->begin();
958  sie = w->end ();
959  } else {
960  continue;
961  }
962  if (!m_elements[0].ForwardPropagationForClusterSeach(m_nElements,Tp,(*iter_boundaryLink),sib,sie,ctx)) return false;
963  }
964 
965  for (int i=0; i!=m_elements[0].nlinksF(); ++i) {
966 
967  double x = m_elements[0].linkF(i).xi2();
968 
969  if (sct) {
970  t = PT.find(m_elements[0].linkF(i).cluster());
971  if (t!=te && (*t).second->measurementsOnTrack()->size() >= 10) continue;
972  } else {
973  x*=.5;
974  }
975 
976  if (x <= xi2Cut) xi2cluster.insert(std::make_pair(x,m_elements[0].linkF(i).cluster()));
977  break;
978  }
979  ++m_nElements;
980  }
981 
982  if (xi2cluster.size() < 3) return false;
983 
984  std::multimap<double,const InDet::SiCluster*>::iterator xc = xi2cluster.begin(), xce = xi2cluster.end();
985 
986  for (; xc!=xce; ++xc) {
987  lSiCluster.push_back((*xc).second);
988  (*xc).second->detectorElement()->isSCT() ? m_ndf+=1 : m_ndf+=2;
989  if ( m_ndf >= ndfCut ) break;
990  }
991 
992  return m_ndf >= 6;
993 }
994 
996 // Seacrh cluster compatible with global positions
998 
1000 (const InDet::PixelClusterContainer* PIXc ,
1001  const InDet::SCT_ClusterContainer* SCTc ,
1002  const std::vector<Amg::Vector3D> & Gp ,
1003  std::vector<const InDet::SiDetElementBoundaryLink_xk*> & DE ,
1004  std::multimap<const Trk::PrepRawData*,const Trk::Track*>& PT ,
1005  std::vector<const InDet::SiCluster*> & lSiCluster)
1006 {
1007  std::vector<const InDet::SiDetElementBoundaryLink_xk*>::iterator iter_boundaryLink = DE.begin(), endBoundaryLinks = DE.end();
1008  std::vector<Amg::Vector3D>::const_iterator g,gb = Gp.begin(), ge = Gp.end();
1009  InDet::PixelClusterCollection::const_iterator pib, pie;
1010  InDet::SCT_ClusterCollection::const_iterator sib, sie;
1011  std::multimap<const Trk::PrepRawData*,const Trk::Track*>::const_iterator t, te =PT.end();
1012 
1014 
1015  double pv[ 5]={0.,0.,0.,0.,0.};
1016  double cv[15]={ .1 ,
1017  0. , .1,
1018  0. , 0.,.001,
1019  0. , 0., 0.,.001,
1020  0. , 0., 0., 0.,.00001};
1021 
1022  double xi2Cut = 10.;
1023  m_ndf = 0 ;
1024 
1025  for (; iter_boundaryLink!=endBoundaryLinks; ++iter_boundaryLink) {
1026 
1027  const InDetDD::SiDetectorElement* d = (*iter_boundaryLink)->detElement();
1028  IdentifierHash id = d->identifyHash ();
1029  const Trk::Surface* su = &d->surface();
1030  const Trk::PlaneSurface* pla = static_cast<const Trk::PlaneSurface*>(su);
1031  if (!pla) continue;
1032 
1033  const Amg::Transform3D& tr = pla->transform();
1034  double Ax[3] = {tr(0,0),tr(1,0),tr(2,0)};
1035  double Ay[3] = {tr(0,1),tr(1,1),tr(2,1)};
1036  double Az[3] = {tr(0,2),tr(1,2),tr(2,2)};
1037  double x0 = tr(0,3);
1038  double y0 = tr(1,3);
1039  double z0 = tr(2,3);
1040  double zcut = .001 ;
1041 
1042  bool sct = d->isSCT();
1043  if (!sct) {
1044  const InDet::PixelClusterCollection *w = (*PIXc).indexFindPtr(id);
1045  if (w!=nullptr && w->begin()!=w->end()) {
1046  pib = w->begin();
1047  pie = w->end ();
1048  } else {
1049  continue;
1050  }
1051  } else {
1052  zcut = 1.;
1053  const InDet::SCT_ClusterCollection *w = (*SCTc).indexFindPtr(id);
1054  if (w!=nullptr && w->begin()!=w->end()) {
1055  sib = w->begin();
1056  sie = w->end ();
1057  } else {
1058  continue;
1059  }
1060  }
1061 
1062  for (g=gb; g!=ge; ++g) {
1063 
1064  double dx = (*g).x()-x0;
1065  double dy = (*g).y()-y0;
1066  double dz = (*g).z()-z0;
1067  double z = dx*Az[0]+dy*Az[1]+dz*Az[2];
1068  if (std::abs(z) > zcut) continue;
1069 
1070  pv[0] = dx*Ax[0]+dy*Ax[1]+dz*Ax[2];
1071  pv[1] = dx*Ay[0]+dy*Ay[1]+dz*Ay[2];
1072 
1073  Tp.setParametersWithCovariance(su,pv,cv);
1074 
1075  if (!sct) m_elements[0].CloseClusterSeach(Tp, (*iter_boundaryLink), pib, pie);
1076  else m_elements[0].CloseClusterSeach(Tp, (*iter_boundaryLink), sib, sie);
1077  const InDet::SiCluster* c = m_elements[0].cluster();
1078  if (!c || m_elements[0].xi2F() > xi2Cut) continue;
1079  if (sct) {
1080  t = PT.find(c);
1081  if (t!=te && (*t).second->measurementsOnTrack()->size() >= 10) continue;
1082  }
1083  sct ? m_ndf+=1 : m_ndf+=2;
1084  lSiCluster.push_back(c);
1085  }
1086  }
1087  return m_ndf >= 6;
1088 }
1089 
1091 // Backward test initial trajectory
1093 
1094 bool InDet::SiTrajectory_xk::backwardSmoother(bool TWO, const EventContext& ctx)
1095 {
1096  if (m_firstElement >= m_lastElement) return false;
1097 
1098  // Trajectory difference test
1099  //
1100  int m = m_lastElement;
1101  for (; m>=m_firstElement; --m) {
1102  if (m_elements[m_elementsMap[m]].difference()) break;
1103  }
1104  if (m < m_firstElement) return true;
1105 
1106  if (!m_elements[m_elementsMap[m_lastElement]].lastTrajectorElement()) return false;
1107 
1108  int firstElement = m_lastElement ;
1109  int maxholes = m_tools->maxholes ();
1110  int maxdholes = m_tools->maxdholes();
1111  m_nclustersNoAdd = 0 ;
1112  m_difference = 0 ;
1113 
1114  m = m_lastElement-1;
1115  int n = m ;
1116 
1117  for (; m>=m_firstElement; --m) {
1118 
1121 
1122  if (!Em.BackwardPropagationSmoother(En,TWO,ctx)) {
1123 
1124  if (m == m_firstElement) break;
1125 
1126  for (int i=m+1; i!=m_nElements; ++i) m_elementsMap[i-1] = m_elementsMap[i];
1127  --m_lastElement;
1128  --m_nElements;
1129  --firstElement;
1130  continue;
1131  }
1132 
1133  if ((Em.cluster() && Em.clusterOld()) && (Em.cluster()!=Em.clusterOld())) ++m_difference;
1134 
1135  if (Em.cluster()) {
1136  firstElement = m;
1137  }
1138  else {
1139  n=m;
1140  if (Em.clusterNoAdd()) ++m_nclustersNoAdd;
1141  if (Em.nholesB() > maxholes || Em.dholesB() > maxdholes) {
1142  ++m_difference; break;
1143  }
1144  }
1145  }
1146 
1147  m_firstElement = firstElement ;
1148  m = m_elementsMap[firstElement] ;
1149  n = m_elementsMap[ n ] ;
1151  m_nholes = m_elements[m].nholesB () ;
1153  m_ndf = m_elements[m].ndfB() ;
1154  if (m_ndf < m_ndfcut) return false;
1155 
1156  // Erase trajectory elements with big distance from the track
1157  //
1158  m = firstElement+1;
1159  n = m;
1160  for (; m!=m_lastElement; ++m) {
1161 
1163  if (Em.inside() > 0) {
1164  if (Em.detstatus() > 0) --m_nActiveElements;
1165  }
1166  else {
1168  }
1169  }
1170  m_lastElement = n;
1171 
1172  // Test number trajector elemenst with clusters
1173  //
1174  if (m_nActiveElements < m_tools->clustersmin() && m_nholes+m_nHolesAfter) return false;
1175  if (n!=m) {
1176  for (; m!=m_nElements; ++m) m_elementsMap[n++] = m_elementsMap[m];
1177  m_nElements = n;
1178  }
1179  return true;
1180 }
1181 
1183 // Backward trajectory extension
1185 
1186 bool InDet::SiTrajectory_xk::backwardExtension(int itmax, const EventContext& ctx)
1187 {
1188  if (m_firstElement >= m_lastElement) return false;
1189  int L = m_firstElement;
1190  if (L==0) return true;
1191 
1192  int MPbest[300] ;
1193  int TE [100] ;
1194  const InDet::SiCluster* CL [100] ;
1195  double XI2B [100] ;
1196  Trk::PatternTrackParameters PUB[100] ;
1198 
1199  int maxholes = m_tools->maxholes ();
1200  int maxdholes = m_tools->maxdholes();
1201  const int itm = itmax-1 ;
1202  int it = 0 ;
1203  int itbest = 0 ;
1204  int qbest =-100 ;
1205  int nbest = 0 ;
1206  int ndfbest = 0 ;
1207  int lbest = L ;
1208  int hbest = 0 ;
1209  int hbestb = 0 ;
1210  int nclbest = 0 ;
1211  int ndcut = 3 ;
1212  int F = L ;
1213  double Xi2best = 0. ;
1214 
1216 
1217  for (; it!=itmax; ++it) {
1218 
1219  int l = F;
1220  int lastElementWithExpHit = F;
1221 
1222  for (--F; F>=0; --F) {
1223 
1226 
1227  if (!Ef.BackwardPropagationFilter(El, ctx)) break;
1228 
1229  if (Ef.cluster()) {
1230  lastElementWithExpHit = F;
1231  l = F;
1232  }
1233  else if (Ef.inside() < 0) {
1234  lastElementWithExpHit = F;
1235  if (Ef.nholesB() > maxholes || Ef.dholesB() > maxdholes) break;
1236  }
1237 
1238  int nm = Ef.nclustersB()+F;
1239  if (Ef.ndist() > ndcut ||
1240  nm < nclbest ||
1241  (nm == nclbest && Ef.xi2totalB() > Xi2best) ) break;
1242  }
1243 
1244  int fl = F;
1245  if (fl<0) fl = 0;
1246 
1247  int m = m_elementsMap[l];
1248  int nc = m_elements[m].nclustersB();
1249 
1250  if (it==0 && nc==m_nclusters) return true;
1251 
1252  int np = m_elements[m].npixelsB();
1253  int nh = m_elements[m].nholesB();
1254  int nd = m_elements[m_elementsMap[fl]].ndist();
1255  int q = nc-nh;
1256  double X = m_elements[m].xi2totalB();
1257 
1258  if ( (q > qbest) || (q==qbest && X < Xi2best ) ) {
1259 
1260  qbest = q ;
1261  nbest = 0 ;
1262  ndfbest = 0 ;
1263  hbest = nh ;
1264  hbestb = m_elements[m_elementsMap[lastElementWithExpHit]].nholesB()-nh ;
1265  itbest = it ;
1266  Xi2best = X ;
1268 
1269  if (fl==0 && nd < ndcut) ndcut = nd;
1270 
1271  if (fl!=0 || nd > 0 || np < 3) {
1272 
1273  lbest = l-1;
1274  for (int i=l; i!=L; ++i) {
1275 
1277 
1278  if (Ei.inside() <= 0 ) {
1279  MPbest[++lbest] = i;
1280  if (Ei.cluster()) {
1281  CL[nbest] = Ei.cluster();
1282  XI2B[nbest] = Ei.xi2B();
1283  PUB[nbest] = Ei.parametersUB();
1284  TE[nbest++] = lbest;
1285  ndfbest += Ei.ndf();
1286  }
1287  }
1288  }
1289  }
1290  else {
1291 
1292  l = -1;
1293  lbest = fl-1;
1294  for (int i=fl; i!=L; ++i) {
1295 
1297 
1298  if (Ei.inside() <= 0 && ++lbest >=0 ) {
1299  MPbest[lbest] = lbest;
1300  if (Ei.cluster()) {
1301  CL[nbest] = Ei.cluster();
1302  XI2B[nbest] = Ei.xi2B();
1303  PUB[nbest] = Ei.parametersUB();
1304  TE[nbest++] = lbest;
1305  ndfbest += Ei.ndf();
1306  if (l<0) l=lbest;
1307  }
1308  m_elementsMap[lbest] = m_elementsMap[i];
1309  }
1310 
1311  }
1312 
1313  int dn = L-1-lbest;
1314 
1315  if (dn!=0) {
1316 
1317  for (int i=L; i!= m_nElements; ++i) {
1319  }
1320 
1321  L -=dn;
1322  m_nElements -=dn;
1323  m_lastElement-=dn;
1324  }
1325  }
1326  nclbest = m_nclusters+nbest;
1327  }
1328 
1329  F = -1;
1330  if (l<=0) l=1;
1331  bool cl = false;
1332  double Xn = 0.;
1333 
1334  for (; l < L; ++l) {
1336 
1337  if (Ei.cluster() && Ei.isNextClusterHoleB(cl,Xn)) {
1338  int nm = l+Ei.nclustersB();
1339  if (!cl) {
1340  if (Ei.dist() < -2. && Ei.ndist() > ndcut-1 ) continue;
1341  --nm;
1342  }
1343  if (nm < nclbest || (nm == nclbest && Xn > Xi2best)) continue;
1344  F=l; break;
1345  }
1346  }
1347 
1348  if (F < 0 ) break;
1349  if (it!=itm) if (!m_elements[m_elementsMap[F]].addNextClusterB()) break;
1350  }
1351  if (it == itmax) --it;
1352  if (!nbest) return true;
1353 
1354  m_nholes = hbest ;
1355  m_nHolesBefore = hbestb;
1356  m_nclusters += nbest ;
1357  m_ndf += ndfbest;
1358  m_firstElement = TE[0] ;
1360 
1361  int dn = L-1-lbest;
1362 
1363  if (dn != 0) {
1364 
1365  m_nElements -=dn;
1366  m_lastElement-=dn;
1367 
1368  int n = m_firstElement;
1369  for (; n <= lbest ; ++n) m_elementsMap[n]=m_elementsMap[MPbest[n]];
1370  for (; n!= m_nElements; ++n) m_elementsMap[n]=m_elementsMap[n +dn ];
1371  }
1372 
1373  if (itbest==it) return true;
1374 
1375  for (int n = L-1-dn; n>=0; --n) {
1376 
1378  int m = nbest-1;
1379  for (; m>=0; --m) if (TE[m]==n) break;
1380 
1381  if (m>=0) {
1382  if (m_tools->useFastTracking()) {
1383  En.setClusterB(CL[m],XI2B[m]);
1384  En.setParametersB(PUB[m]);
1385  }
1386  else En.setCluster(CL[m]);
1387  if (--nbest==0) break;
1388  }
1389  else {
1390  if (m_tools->useFastTracking()) En.setClusterB( nullptr ,10000.);
1391  else En.setCluster( nullptr );
1392  }
1393  }
1394  return true;
1395 }
1396 
1398 // Forward trajectory extension
1400 
1401 bool InDet::SiTrajectory_xk::forwardExtension(bool smoother,int itmax, const EventContext& ctx)
1402 {
1403  const double pi2 = 2.*M_PI;
1404  const double pi = M_PI;
1405 
1406  if (m_firstElement >= m_lastElement) return false;
1407 
1409  int extensionStartIndex = m_lastElement;
1411  int lastElementOnTraj = m_nElements-1;
1412 
1415  if (smoother) {
1416 
1417  extensionStartIndex = m_firstElement;
1418 
1421  if (m_elements[m_elementsMap[extensionStartIndex]].difference()) {
1424 
1426  if (!m_elements[m_elementsMap[extensionStartIndex]].firstTrajectorElement(false)) return false;
1428  for (++extensionStartIndex; extensionStartIndex<=m_lastElement; ++extensionStartIndex) {
1429  InDet::SiTrajectoryElement_xk& previousElement = m_elements[m_elementsMap[extensionStartIndex-1]];
1430  InDet::SiTrajectoryElement_xk& thisElement = m_elements[m_elementsMap[extensionStartIndex ]];
1432  if (!thisElement.ForwardPropagationWithoutSearch(previousElement,ctx)) return false;
1433  }
1434  }
1437  else{
1438  bool diff = false;
1440  for (++extensionStartIndex; extensionStartIndex<=m_lastElement; ++extensionStartIndex) {
1441 
1442  InDet::SiTrajectoryElement_xk& previousElement = m_elements[m_elementsMap[extensionStartIndex-1]];
1443  InDet::SiTrajectoryElement_xk& thisElement = m_elements[m_elementsMap[extensionStartIndex ]];
1446  if (!diff) {
1448  diff = thisElement.difference();
1450  if (diff) {
1452  if (!thisElement.addNextClusterF(previousElement,thisElement.cluster())) return false;
1453  }
1454  }
1456  else {
1458  if (!thisElement.ForwardPropagationWithoutSearch(previousElement,ctx)) return false;
1459  }
1460  }
1461  }
1462  --extensionStartIndex;
1463  }
1464 
1466  if ( extensionStartIndex== lastElementOnTraj) return true;
1467 
1468  // Search best forward trajectory prolongation
1471  int MP [300] ;
1472  int MPbest[300] ;
1474  int TE [100] ;
1476  const InDet::SiCluster* CL [100] ;
1477 
1479  int maxholes = m_tools->maxholes () ;
1480  int maxdholes = m_tools->maxdholes() ;
1482  const int itm = itmax-1 ;
1484  int iteration = 0 ;
1486  int itbest = 0 ;
1488  int qbest =-100 ;
1490  int nbest = 0 ;
1491  int ndfbest = 0 ;
1493  int hbest = 0 ;
1495  int hbeste = 0 ;
1497  int ndbest = 0 ;
1499  int ndcut = 3 ;
1501  int nclbest = 0 ;
1503  int lbest = extensionStartIndex ;
1505  int index_currentElement = extensionStartIndex ;
1507  int M = extensionStartIndex ;
1509  MP [M] = extensionStartIndex ;
1510  double Xi2best = 0. ;
1512  const double dfmax = 2.2 ;
1513 
1515  double f0 = m_elements[m_elementsMap[m_firstElement]].parametersUF().parameters()[2];
1516 
1517 
1518  m_elements[m_elementsMap[index_currentElement]].setNdist(0);
1519 
1521  for (; iteration!=itmax; ++iteration) {
1522 
1523  int lastElementWithSeenHit = index_currentElement;
1524  int lastElementWithExpHit = index_currentElement;
1526  int index_previousElement = index_currentElement;
1528  int mLastCluster = M;
1530  int Cm = nclbest-lastElementOnTraj;
1532  bool haveHole = false;
1533 
1536  for (++index_currentElement; index_currentElement!=m_nElements; ++index_currentElement) {
1537 
1539  InDet::SiTrajectoryElement_xk& prevElement = m_elements[m_elementsMap[index_previousElement]];
1540  InDet::SiTrajectoryElement_xk& currentElement = m_elements[m_elementsMap[index_currentElement ]];
1541 
1543  if (!currentElement.ForwardPropagationWithSearch(prevElement, ctx)) {
1545 
1547  if (!currentElement.isBarrel() || index_previousElement!=index_currentElement-1) break;
1548 
1552  int index_auxElement = index_currentElement;
1553  for (; index_auxElement!=m_nElements; ++index_auxElement) {
1554  if (!m_elements[m_elementsMap[index_auxElement]].isBarrel() ) break;
1555  }
1557  if (index_auxElement==m_nElements) break;
1558 
1562  index_currentElement = index_auxElement-1;
1563  continue;
1564  }
1565 
1568  else {
1571  index_previousElement = index_currentElement;
1572  }
1574 
1576  MP[++M] = index_currentElement;
1577 
1579  if (currentElement.cluster()) {
1580  if (not m_tools->isITkGeometry()) {
1582  double df = std::abs(currentElement.parametersUF().parameters()[2]-f0);
1584  if (df > pi) df = pi2-df;
1586  if (df > dfmax) break;
1587  }
1589  lastElementWithExpHit = index_currentElement;
1590  lastElementWithSeenHit = index_currentElement;
1591  mLastCluster = M;
1592  haveHole = false;
1593  }
1594 
1596  else if (currentElement.inside() < 0 ) {
1597  lastElementWithExpHit=index_currentElement;
1599  if (currentElement.nholesF() > maxholes || currentElement.dholesF() > maxdholes) break;
1600 
1601  haveHole = true;
1602  if (not m_tools->isITkGeometry()) {
1604  double df = std::abs(currentElement.parametersPF().parameters()[2]-f0);
1605  if (df > pi) df = pi2-df;
1606  if (df > dfmax ) break;
1607  }
1608  }
1609 
1611  else if (not m_tools->isITkGeometry()) {
1613  double df = std::abs(currentElement.parametersPF().parameters()[2]-f0);
1614  if (df > pi) df = pi2-df;
1615  if (df > dfmax) break;
1616  }
1619  int nm = currentElement.nclustersF()-index_currentElement;
1621  if ( currentElement.ndist() > ndcut
1622  || nm < Cm
1623  || (nm == Cm && currentElement.xi2totalF() > Xi2best)
1624  ) break;
1625  }
1626 
1628 
1630  int m = m_elementsMap[lastElementWithSeenHit];
1632  int nc = m_elements[m].nclustersF();
1634  int nh = m_elements[m].nholesF();
1636  m_nHolesAfter = m_elements[m_elementsMap[lastElementWithExpHit]].nholesF()-nh;
1637 
1640  if (iteration==0 && nc==m_nclusters) return true;
1641 
1643  int lastElementProcessed = index_currentElement;
1645  if (lastElementProcessed==m_nElements) --lastElementProcessed;
1646 
1648  int nd = m_elements[m_elementsMap[lastElementProcessed]].ndist();
1651  int q = nc-nh;
1653  double X = m_elements[m].xi2totalF();
1655  if ( (q > qbest) || (q==qbest && X < Xi2best ) ) {
1657  qbest = q;
1659  nbest = 0;
1661  ndfbest = 0;
1663  hbest = nh;
1665  hbeste = m_elements[m_elementsMap[lastElementWithExpHit]].nholesF()-nh;
1667  itbest = iteration;
1670  lbest = extensionStartIndex ;
1672  Xi2best = X ;
1674  ndbest = nd;
1677  if (lastElementProcessed==lastElementOnTraj && nd < ndcut) ndcut = nd;
1678 
1680  for (int j=extensionStartIndex+1; j<=mLastCluster; ++j) {
1682  int i = MP[j];
1685  if (Ei.inside() <= 0) {
1687  MPbest[++lbest] = i;
1689  if (Ei.cluster()) {
1691  CL[nbest] = Ei.cluster();
1692  TE[nbest++] = lbest;
1694  ndfbest += Ei.ndf();
1695  }
1696  }
1697  }
1699  nclbest = m_nclusters+nbest;
1702  if ( (nclbest >= 14 && !haveHole) || (lastElementProcessed==lastElementOnTraj && ndbest == 0)) break;
1703  }
1704 
1706  index_currentElement = -1;
1708  bool cl = false;
1710  int nb = lastElementOnTraj-nclbest-1;
1712  double Xn;
1713 
1719 
1721  for (int j=mLastCluster; j!=extensionStartIndex; --j) {
1723  int i = MP[j];
1725 
1727  if (i!=lastElementOnTraj && Ei.cluster() && Ei.isNextClusterHoleF(cl,Xn)) {
1728 
1732  int nm = nb-i+Ei.nclustersF();
1733 
1735  if (!cl) {
1738  if (Ei.dist() < -2. && Ei.ndist() > ndcut-1) continue;
1739  }
1741  else ++nm;
1742 
1745  if (nm < 0 || (nm == 0 && Xn > Xi2best)) continue;
1747  index_currentElement = i;
1748  M = j;
1749  break;
1750  }
1751  }
1752 
1754  if (index_currentElement < 0 ) break;
1757  if (iteration!=itm && !m_elements[m_elementsMap[index_currentElement]].addNextClusterF()) break;
1758  }
1759 
1761  if (iteration == itmax) --iteration;
1762 
1764  if (!nbest) return true;
1765 
1767  m_nholes = hbest ;
1768  m_nHolesAfter = hbeste ;
1769  m_nclusters += nbest ;
1770  m_ndf += ndfbest ;
1771  m_lastElement = TE[nbest-1];
1773 
1775  if (m_lastElement != MPbest[m_lastElement]) {
1777  for (int n = extensionStartIndex+1; n<=m_lastElement; ++n){
1778  m_elementsMap[n]=m_elementsMap[MPbest[n]];
1779  }
1780  }
1782  if (itbest==iteration) return true;
1783 
1785  int mb = 0;
1787  index_currentElement = -1;
1788 
1790  for (int n = extensionStartIndex+1; n!=m_nElements; ++n) {
1793 
1794  int m = mb;
1796  for (; m!=nbest; ++m) if (TE[m]==n) break;
1798  if (m!=nbest) {
1800  if (CL[m]!=En.cluster()) {
1802  if (index_currentElement<0) {
1804  index_currentElement=n;
1808  }
1811  else {
1812  En.setCluster(CL[m]);
1813  }
1814  }
1815  if (++mb == nbest) break;
1817  }
1818  else {
1821  if (En.cluster()) {
1823  if (index_currentElement<0) {
1824  index_currentElement = n;
1826  En.addNextClusterF(m_elements[m_elementsMap[n-1]],nullptr);
1827  }
1830  else {
1832  En.setCluster(nullptr);
1833  }
1834  }
1835  }
1836  }
1837 
1840  if (index_currentElement < 0 || m_lastElement == index_currentElement) {
1841  return true;
1842  }
1843 
1846  for (++index_currentElement; index_currentElement<=m_lastElement; ++index_currentElement) {
1847  InDet::SiTrajectoryElement_xk& prevElement = m_elements[m_elementsMap[index_currentElement-1]];
1848  InDet::SiTrajectoryElement_xk& currentElement = m_elements[m_elementsMap[index_currentElement ]];
1849  if (!currentElement.ForwardPropagationWithoutSearch(prevElement, ctx)) return false;
1850  }
1852  return true;
1853 }
1854 
1856 // Get clusters list from trajectory
1858 
1860 (std::vector<const InDet::SiCluster*>& Cl) const
1861 {
1862  for (int i = m_firstElement; i<=m_lastElement; ++i) {
1863  int m = m_elementsMap[i];
1864  if (m_elements[m].cluster()) Cl.push_back(m_elements[m].cluster());
1865  }
1866 }
1867 
1869 // Forward filter without search
1871 
1872 bool InDet::SiTrajectory_xk::forwardFilter(const EventContext& ctx)
1873 {
1874  int L = m_firstElement;
1875 
1876  if (!m_elements[m_elementsMap[L]].firstTrajectorElement(false)) return false;
1877 
1878  for (++L; L<=m_lastElement; ++L) {
1879 
1882  if (!Ef.ForwardPropagationWithoutSearch(El,ctx)) return false;
1883  }
1884  return true;
1885 }
1886 
1887 
1889 // Filter with precise clusters error
1891 
1893 {
1894  int L = m_firstElement;
1895  int I = 0 ;
1896 
1897  if(!m_elements[m_elementsMap[L]].cluster()) return false;
1899 
1900  for(++L; L<=m_lastElement; ++L) {
1901 
1902  int K = m_elementsMap[L];
1903  if(m_elements[K].cluster() ||
1904  m_elements[K].clusterNoAdd() ||
1905  m_elements[K].inside() < 0 ) m_elementsMap[++I] = K;
1906  }
1907  m_firstElement = 0 ;
1908  m_lastElement = I ;
1909  m_nElements = I+1;
1910 
1911  // Forward filter
1912  //
1913  L = 0;
1914 
1915  // firstTrajectorElement with correction = true
1916  if(!m_elements[m_elementsMap[L]].firstTrajectorElement(true)) return false;
1917 
1918  for(++L; L<=m_lastElement; ++L) {
1919 
1922 
1923  if(!Ef.ForwardPropagationWithoutSearchPreciseWithCorrection(El, ctx)) return false;
1924  }
1925 
1926  // Backward smoother
1927  //
1928  if(!m_elements[m_elementsMap[m_lastElement]].lastTrajectorElementPrecise()) return false;
1929 
1930  int m = m_lastElement-1;
1931  for(; m>=0; --m) {
1932 
1935 
1936  if(!Em.BackwardPropagationPrecise(En, ctx)) return false;
1937  }
1938 
1939  return true;
1940 }
1941 
1942 
1944 // Test order of detector elements
1946 
1948 {
1949  int L = m_firstElement ;
1950  int n = m_elementsMap[L];
1951  double step = 0. ;
1952  bool order = true ;
1953 
1954  for (++L; L<=m_lastElement; ++L) {
1955 
1956  int m = m_elementsMap[L];
1957  if (!m_elements[m].cluster() &&
1958  !m_elements[m].clusterNoAdd() &&
1959  m_elements[m].inside()>=0) continue;
1960 
1961  double stp = m_elements[m].step(m_elements[n]);
1962  if ( step == 0.) step = stp ;
1963  else if ((step*stp) < 0.) {order = false; break;}
1964  n = m;
1965  }
1966  if (order) return true;
1967 
1968  L = m_firstElement ;
1969  n = m_elementsMap[L];
1971  double rad = gp.x()*gp.x()+gp.y()*gp.y();
1972  for (++L; L<=m_lastElement; ++L) {
1973 
1974  int m = m_elementsMap[L];
1975  if (!m_elements[m].cluster() &&
1976  !m_elements[m].clusterNoAdd() &&
1977  m_elements[m].inside()>=0) continue;
1978 
1979  gp = m_elements[m].globalPosition();
1980  double R = gp.x()*gp.x()+gp.y()*gp.y();
1981  if (R < rad) return false;
1982  rad = R;
1983  n=m;
1984  }
1985  return true;
1986 }
1987 
1989 // Sort of detector elements in step order
1991 
1993 {
1994  int L = m_firstElement;
1995  int LA = m_firstElement;
1996 
1997  for (++L; L<=m_lastElement; ++L) {
1998 
1999  int m = m_elementsMap[L];
2000  if (!m_elements[m].cluster() &&
2001  !m_elements[m].clusterNoAdd() &&
2002  m_elements[m].inside()>=0) continue;
2003 
2004  m_elementsMap[++LA] = m;
2005  }
2006 
2007  m_lastElement = LA;
2008  L = m_firstElement;
2009  m_nElements = LA+1;
2010 
2011  bool nc = true;
2012  bool so = true;
2014 
2015  if (ds > 0.) { // Sort in increase order
2016 
2017  while(nc) {
2018  nc = false;
2019  int m = L, n = L+1;
2020  for (; n<=LA; ++n) {
2021 
2022  int Mn = m_elementsMap[n];
2023  int Mm = m_elementsMap[m];
2024 
2025  if (m_elements[Mn].step() < m_elements[Mm].step()) {
2026  if (m_elements[Mn].step(m_elements[Mm]) < 0.) {
2027  m_elementsMap[m] = Mn;
2028  m_elementsMap[n] = Mm;
2029  nc = true; so = false;
2030  }
2031  }
2032  ++m;
2033  }
2034  }
2035  }
2036  else {
2037 
2038  while(nc) { // Sort in decrease order
2039  nc = false;
2040  int m = L, n = L+1;
2041  for (; n<=LA; ++n) {
2042 
2043  int Mn = m_elementsMap[n];
2044  int Mm = m_elementsMap[m];
2045 
2046  if (m_elements[Mn].step() > m_elements[Mm].step()) {
2047  if (m_elements[Mn].step(m_elements[Mm]) > 0.) {
2048  m_elementsMap[m] = Mn;
2049  m_elementsMap[n] = Mm;
2050  nc = true; so = false;
2051  }
2052  }
2053  ++m;
2054  }
2055  }
2056  }
2057  if (so) return;
2058 
2059  // Search first detector elements with cluster
2060  //
2061  int n = L;
2062  for (; n<= LA; ++n) {
2063 
2064  int e = m_elementsMap[n];
2065  if (m_elements[e].cluster()) break;
2066  if (m_elements[e].clusterNoAdd()) --m_nclustersNoAdd;
2067  else if (m_elements[e].inside() < 0 &&
2068  m_elements[e].detstatus()>=0) {--m_nholes; ++m_nHolesBefore;}
2069  }
2070 
2071  // Search last detector elements with cluster
2072  //
2073  int m = LA;
2074  for (; m>=n ; --m) {
2075 
2076  int e = m_elementsMap[m];
2077  if (m_elements[e].cluster()) break;
2078  if (m_elements[e].clusterNoAdd()) --m_nclustersNoAdd;
2079  else if (m_elements[e].inside() < 0 &&
2080  m_elements[e].detstatus()>=0) {--m_nholes; ++m_nHolesAfter;}
2081  }
2082  m_firstElement = n;
2083  m_lastElement = m;
2084 
2085 }
2086 
2088 // Test possibility for trajectory to jump through perigee
2090 
2092 {
2093  int i = m_firstElement;
2095 
2096  for (; i<=m_lastElement; ++i) {
2097  int m = m_elementsMap[i];
2098  if (m_elements[m].cluster() &&
2099  (m_elements[m].ndf()!=2 || (m_elements[m].stepToPerigee()*St) <= 0.)) break;
2100 
2101  if (m_elements[m].cluster()){
2102  --m_nclusters;
2103  m_ndf -= m_elements[m].ndf();
2104  }
2105  else if (m_elements[m].clusterNoAdd()) --m_nclustersNoAdd;
2106  else --m_nholes ;
2107  }
2108 
2109  if (i == m_firstElement) return false;
2110  m_firstElement = i;
2111  return true;
2112 }
2113 
2115 // Trajectory quality without optimization
2117 
2119 {
2120  int holes = 0 ;
2121  double quality = 0.;
2122 
2123  for (int i = m_firstElement; i<=m_lastElement; ++i) {
2125  }
2126  return quality;
2127 }
2128 
2130 // Trajectory quality with otimization
2132 
2134 {
2135  int lE = m_firstElement;
2136  int h = 0 ;
2137  double q = 0 ;
2138  double qM = 0. ;
2139 
2140  for (int i = m_firstElement; i<=m_lastElement; ++i) {
2141  int m = m_elementsMap[i];
2142  q+=m_elements[m].quality(h);
2143  if (m_elements[m].cluster() && q > qM) {
2144  qM = q;
2145  lE = i;
2146  }
2147  }
2148 
2149  if (lE == m_firstElement) return -100;
2150 
2151  int fE = lE;
2152  int nclustersNoAdd = 0 ;
2153  int nclusters = 0 ;
2154  int nholes = 0 ;
2155  int dholes = 0 ;
2156  int ndf = 0 ;
2157  h = 0 ;
2158  q = 0.;
2159  qM = 0.;
2160 
2161  for (int i = lE; i>=m_firstElement; --i) {
2162 
2163  int m = m_elementsMap[i];
2164  q+=m_elements[m].quality(h);
2165 
2166  if (m_elements[m].cluster()) {
2167 
2168  ++nclusters;
2169  ndf+=m_elements[m].ndf();
2170 
2171  if (q > qM) {
2172  qM = q;
2173  fE = i;
2176  m_nholes = nholes ;
2177  m_dholes = dholes ;
2178  m_ndf = ndf ;
2179  }
2180 
2181  }
2182  else if (m_elements[m].clusterNoAdd()) {
2183  ++nclustersNoAdd;
2184  }
2185  else if (m_elements[m].inside() < 0 && m_elements[m].detstatus() >=0) {
2186  ++nholes;
2187  if (h > dholes) dholes = h;
2188  }
2189  }
2190 
2191  if (fE==lE || m_nclusters+m_nclustersNoAdd < m_tools->clustersmin()) return -100.;
2192  m_firstElement = fE;
2193  m_lastElement = lE;
2194  return qM;
2195 }
2196 
2198 // Trajectory conversion to TrackStateOnSurface for next tracks
2200 
2203 {
2204  int i=0;
2205  for (; i!=m_ntos; ++i) {
2206  if (m_itos[i]+1 < m_elements[m_atos[i]].ntsos()) {++m_itos[i]; break;}
2207  m_itos[i] = 0;
2208  }
2209  if (i==m_ntos) {
2210  return Trk::TrackStates();
2211  }
2212 
2213  auto dtsos = Trk::TrackStates();
2214 
2215  for (i=0; i!=m_ntos; ++i) {
2216 
2218  if (tsos) dtsos.push_back(tsos);
2219  }
2220  return dtsos;
2221 }
2222 
2224 // pT of the first elementtrajectory
2226 
2228 {
2229  int n = m_firstElement ; if (n <0 || n>=300) return 0.;
2230  n = m_elementsMap[n]; if (n <0 || n>=300) return 0.;
2231  int s = m_elements[n].status();
2232  if (s<=1) return 0.;
2233  return m_elements[n].parametersUB().momentum().perp();
2234 }
2235 
2238 
2241 
2243  bool prevIsSctHole = false;
2244 
2246 
2247  for (int theEle = m_firstElement+1; theEle<m_lastElement; ++theEle) {
2249  int m = m_elementsMap[theEle];
2250  InDet::SiTrajectoryElement_xk & theElement = m_elements[m];
2252  bool isPix = theElement.ndf() == 2;
2253  bool isSCTHole=false;
2254 
2257  if (theElement.cluster() || theElement.clusterNoAdd()) {
2258  prevIsSctHole = false;
2259  continue;
2260  }
2261 
2263  else {
2264  std::unique_ptr<const Trk::TrackParameters> pars {theElement.trackParameters(true,0)};
2266  switch (boundaryStatus){
2270  if (isPix) {
2272  }
2273  else {
2275  isSCTHole=true;
2276  }
2277  break;
2283  break;
2287  if (isPix){
2289  }
2290  else{
2292  }
2293  break;
2294  }
2295  }
2296 
2299  if (isSCTHole && prevIsSctHole){
2300  prevIsSctHole = false;
2302  }
2303  else {
2304  prevIsSctHole = isSCTHole;
2305  }
2306  }
2310  }
2311 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
InDet::SiTrajectoryElement_xk::xi2B
const double & xi2B() const
Definition: SiTrajectoryElement_xk.h:122
InDet::SiTrajectory_xk::initialize
bool initialize(bool, bool, const PixelClusterContainer *, const SCT_ClusterContainer *, const Trk::TrackParameters &, std::vector< const InDet::SiCluster * > &, std::vector< const InDet::SiDetElementBoundaryLink_xk * > &, bool &, const EventContext &)
Definition: SiTrajectory_xk.cxx:580
InDet::SiTrajectory_xk::m_nclusters
int m_nclusters
index of the last element where we have
Definition: SiTrajectory_xk.h:174
InDet::SiTrajectory_xk::convertToTrackStateOnSurface
Trk::TrackStates convertToTrackStateOnSurface()
Definition: SiTrajectory_xk.cxx:56
InDet::SiTools_xk::multiTrack
const bool & multiTrack() const
Definition: SiTools_xk.h:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
InDet::SiTrajectory_xk::backwardSmoother
bool backwardSmoother(bool, const EventContext &)
Definition: SiTrajectory_xk.cxx:1094
beamspotman.r
def r
Definition: beamspotman.py:676
InDet::SiTrajectoryElement_xk::isNextClusterHoleF
bool isNextClusterHoleF(bool &, double &)
checks if removing this cluster from the forward propagation would result in a critical number of hol...
Definition: SiTrajectoryElement_xk.cxx:2103
InDet::SiTrajectoryElement_xk::nholesF
const int & nholesF() const
Definition: SiTrajectoryElement_xk.h:54
InDet::SiTrajectoryElement_xk::step
const double & step() const
Definition: SiTrajectoryElement_xk.h:68
S1
struct TBPatternUnitContext S1
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:260
Trk::PatternTrackParameters::setParametersWithCovariance
void setParametersWithCovariance(const Surface *, const double *, const double *)
InDet::SiTrajectoryElement_xk
Definition: SiTrajectoryElement_xk.h:36
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
InDet::SiTrajectory_xk::m_lastElement
int m_lastElement
index of the first element where we have
Definition: SiTrajectory_xk.h:172
InDet::SiTrajectory_xk::forwardFilter
bool forwardFilter(const EventContext &)
Definition: SiTrajectory_xk.cxx:1872
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
InDet::SiTrajectoryElement_xk::BackwardPropagationFilter
bool BackwardPropagationFilter(SiTrajectoryElement_xk &, const EventContext &ctx)
Definition: SiTrajectoryElement_xk.cxx:532
Trk::BoundaryCheckResult::DeadElement
@ DeadElement
outside the element
InDet::SiTrajectoryElement_xk::nholesB
const int & nholesB() const
Definition: SiTrajectoryElement_xk.h:55
InDet::SiTrajectory_xk::m_ndf
int m_ndf
Definition: SiTrajectory_xk.h:185
InDet::SiTrajectory_xk::forwardExtension
bool forwardExtension(bool, int, const EventContext &)
Definition: SiTrajectory_xk.cxx:1401
Trk::BoundaryCheckResult
BoundaryCheckResult
Definition: IBoundaryCheckTool.h:14
Trk::IBoundaryCheckTool::boundaryCheck
virtual BoundaryCheckResult boundaryCheck(const Trk::TrackParameters &) const =0
InDet::SiTrajectoryElement_xk::inside
const int & inside() const
Definition: SiTrajectoryElement_xk.h:49
InDet::SiTrajectoryElement_xk::nlinksF
const int & nlinksF() const
Definition: SiTrajectoryElement_xk.h:52
Trk::BoundaryCheckResult::Insensitive
@ Insensitive
close to the edge of an active element
InDetDD::holes
@ holes
Definition: InDetDD_Defs.h:17
hist_file_dump.d
d
Definition: hist_file_dump.py:137
InDet::SiTrajectoryElement_xk::setNdist
void setNdist(int)
Definition: SiTrajectoryElement_xk.cxx:2153
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
InDet::SiTrajectory_xk::updateHoleSearchResult
void updateHoleSearchResult()
Helper method to determine the hole search outcome for use in the later reco.
Definition: SiTrajectory_xk.cxx:2237
Trk::BoundaryCheckResult::Candidate
@ Candidate
InDet::SiTrajectory_xk::backwardExtension
bool backwardExtension(int, const EventContext &)
Definition: SiTrajectory_xk.cxx:1186
InDet::SiTrajectory_xk::m_nholes
int m_nholes
Definition: SiTrajectory_xk.h:179
InDet::SiTrajectoryElement_xk::isNextClusterHoleB
bool isNextClusterHoleB(bool &, double &)
Definition: SiTrajectoryElement_xk.cxx:2082
InDet::PatternHoleSearchOutcome::nPixelDeads
int nPixelDeads
Definition: SiTrajectory_xk.h:37
InDet::SiTrajectoryElement_xk::clusterOld
const InDet::SiCluster * clusterOld() const
Definition: SiTrajectoryElement_xk.h:74
skel.it
it
Definition: skel.GENtoEVGEN.py:396
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
python.PhysicalConstants.pi2
float pi2
Definition: PhysicalConstants.py:52
InDet::SiTrajectory_xk::pTfirst
double pTfirst() const
Definition: SiTrajectory_xk.cxx:2227
M_PI
#define M_PI
Definition: ActiveFraction.h:11
InDet::SiTrajectoryElement_xk::ndfB
const int & ndfB() const
Definition: SiTrajectoryElement_xk.h:66
InDetDD::SolidStateDetectorElementBase::surface
Trk::Surface & surface()
Element Surface.
InDet::SiTrajectory_xk::convertToFitQuality
std::unique_ptr< Trk::FitQuality > convertToFitQuality() const
Definition: SiTrajectory_xk.cxx:290
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
InDet::SiTrajectoryElement_xk::xi2totalF
const double & xi2totalF() const
Definition: SiTrajectoryElement_xk.h:123
InDet::SCT_ClusterContainer
Trk::PrepRawDataContainer< SCT_ClusterCollection > SCT_ClusterContainer
Definition: SCT_ClusterContainer.h:27
InDet::SiTrajectoryElement_xk::dist
const double & dist() const
Definition: SiTrajectoryElement_xk.h:69
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
InDet::SiTrajectoryElement_xk::lastActive
void lastActive()
Definition: SiTrajectoryElement_xk.cxx:2313
cosmic
@ cosmic
Definition: SUSYToolsTester.cxx:101
InDet::SiTools_xk::boundaryCheckTool
const Trk::IBoundaryCheckTool * boundaryCheckTool() const
Definition: SiTools_xk.h:56
InDet::PixelClusterContainer
Trk::PrepRawDataContainer< PixelClusterCollection > PixelClusterContainer
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelClusterContainer.h:28
InDet::SiTrajectory_xk::sortStep
void sortStep()
Definition: SiTrajectory_xk.cxx:1992
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
PlotCalibFromCool.multi
multi
Definition: PlotCalibFromCool.py:99
InDet::SiTrajectoryElement_xk::setCluster
void setCluster(const InDet::SiCluster *)
Definition: SiTrajectoryElement_xk.cxx:2130
PlotPulseshapeFromCool.np
np
Definition: PlotPulseshapeFromCool.py:64
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
mc.SM
SM
Definition: mc.PhPy8EG_A14NNPDF23_DY_SLQ_example.py:47
SiTrajectory_xk.h
keylayer_zslicemap.se
se
Definition: keylayer_zslicemap.py:194
InDet::SiTrajectory_xk::m_nHolesAfter
int m_nHolesAfter
Definition: SiTrajectory_xk.h:178
x
#define x
InDet::SiTrajectory_xk::m_atos
int m_atos[100]
Definition: SiTrajectory_xk.h:187
InDet::SiTrajectoryElement_xk::parametersUB
const Trk::PatternTrackParameters & parametersUB() const
observed
Definition: SiTrajectoryElement_xk.h:135
InDet::PatternHoleSearchOutcome::nSCTDeads
int nSCTDeads
Definition: SiTrajectory_xk.h:38
InDet::SiTrajectory_xk::jumpThroughPerigee
bool jumpThroughPerigee()
Definition: SiTrajectory_xk.cxx:2091
InDet::SiTrajectoryElement_xk::isBarrel
bool isBarrel() const
Definition: SiTrajectoryElement_xk.h:70
InDet::SiTrajectoryElement_xk::ndf
const int & ndf() const
Definition: SiTrajectoryElement_xk.h:64
InDet::SiTrajectory_xk::trackParametersToClusters
bool trackParametersToClusters(const PixelClusterContainer *, const SCT_ClusterContainer *, const Trk::TrackParameters &, std::vector< const InDet::SiDetElementBoundaryLink_xk * > &, std::multimap< const Trk::PrepRawData *, const Trk::Track * > &, std::vector< const InDet::SiCluster * > &, const EventContext &ctx)
Definition: SiTrajectory_xk.cxx:915
InDet::SiTrajectoryElement_xk::trackSimpleStateOnSurface
Trk::TrackStateOnSurface * trackSimpleStateOnSurface(bool, bool, int)
Definition: SiTrajectoryElement_xk.cxx:980
InDet::SiTrajectory_xk::nclustersNoAdd
const int & nclustersNoAdd() const
Definition: SiTrajectory_xk.h:68
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
InDetDD::SolidStateDetectorElementBase::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
InDet::SiTrajectoryElement_xk::eraseClusterForwardPropagation
void eraseClusterForwardPropagation()
Definition: SiTrajectoryElement_xk.cxx:1336
pi
#define pi
Definition: TileMuonFitter.cxx:65
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
InDet::SiTrajectoryElement_xk::xi2totalB
const double & xi2totalB() const
Definition: SiTrajectoryElement_xk.h:124
InDet::SiTrajectoryElement_xk::numberClusters
int numberClusters() const
Definition: SiTrajectoryElement_xk.cxx:2037
InDet::SiTrajectoryElement_xk::detstatus
const int & detstatus() const
Definition: SiTrajectoryElement_xk.h:48
InDet::SiTrajectory_xk::globalPositionsToClusters
bool globalPositionsToClusters(const PixelClusterContainer *, const SCT_ClusterContainer *, const std::vector< Amg::Vector3D > &, std::vector< const InDet::SiDetElementBoundaryLink_xk * > &, std::multimap< const Trk::PrepRawData *, const Trk::Track * > &, std::vector< const InDet::SiCluster * > &)
Definition: SiTrajectory_xk.cxx:1000
InDet::SiTrajectoryElement_xk::setParametersB
void setParametersB(Trk::PatternTrackParameters &)
Definition: SiTrajectoryElement_xk.cxx:2143
InDet::SiTrajectoryElement_xk::npixelsB
const int & npixelsB() const
Definition: SiTrajectoryElement_xk.h:60
InDet::SiTrajectory_xk::convertToSimpleTrackStateOnSurface
Trk::TrackStates convertToSimpleTrackStateOnSurface(const EventContext &ctx)
Definition: SiTrajectory_xk.cxx:152
InDet::SiTrajectory_xk::nholes
const int & nholes() const
Definition: SiTrajectory_xk.h:62
InDet::SiTools_xk::isITkGeometry
const bool & isITkGeometry() const
Definition: SiTools_xk.h:73
InDet::SiTrajectoryElement_xk::parametersPB
const Trk::PatternTrackParameters & parametersPB() const
predicted
Definition: SiTrajectoryElement_xk.h:133
InDet::SiTrajectory_xk::difference
const int & difference() const
Definition: SiTrajectory_xk.h:71
InDet::SiTrajectoryElement_xk::quality
double quality(int &) const
Definition: SiTrajectoryElement_xk.cxx:1348
InDet::SiTrajectory_xk::m_nElements
int m_nElements
count active elements
Definition: SiTrajectory_xk.h:182
InDet::SiTrajectory_xk::setParameters
void setParameters()
Definition: SiTrajectory_xk.cxx:21
InDet::SiTrajectoryElement_xk::ForwardPropagationWithSearch
bool ForwardPropagationWithSearch(SiTrajectoryElement_xk &, const EventContext &)
Definition: SiTrajectoryElement_xk.cxx:428
InDet::SiTools_xk::useFastTracking
const bool & useFastTracking() const
Definition: SiTools_xk.h:72
Trk::TrackStates
DataVector< const Trk::TrackStateOnSurface > TrackStates
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:30
InDet::SiTrajectory_xk::m_elements
SiTrajectoryElement_xk m_elements[300]
Definition: SiTrajectory_xk.h:189
InDet::SiTrajectoryElement_xk::dholesB
const int & dholesB() const
Definition: SiTrajectoryElement_xk.h:57
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDet::SiTrajectoryElement_xk::clusterNoAdd
const InDet::SiCluster * clusterNoAdd() const
Definition: SiTrajectoryElement_xk.h:75
InDet::SiTrajectory_xk::m_nclustersNoAdd
int m_nclustersNoAdd
Number of clusters on trajectory.
Definition: SiTrajectory_xk.h:175
z
#define z
InDet::SiTrajectoryElement_xk::bremNoiseModel
void bremNoiseModel()
Definition: SiTrajectoryElement_xk.cxx:2334
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
beamspotman.n
n
Definition: beamspotman.py:731
InDet::SiTrajectoryElement_xk::trackStateOnSurface
Trk::TrackStateOnSurface * trackStateOnSurface(bool, bool, bool, int)
Definition: SiTrajectoryElement_xk.cxx:902
InDet::SiTrajectoryElement_xk::globalPosition
Amg::Vector3D globalPosition()
Definition: SiTrajectoryElement_xk.cxx:1282
extractSporadic.h
list h
Definition: extractSporadic.py:97
mc.order
order
Configure Herwig7.
Definition: mc.Herwig7_Dijet.py:12
InDet::SiTrajectory_xk::convertToTrackStateOnSurfaceWithNewDirection
Trk::TrackStates convertToTrackStateOnSurfaceWithNewDirection()
Definition: SiTrajectory_xk.cxx:103
python.getCurrentFolderTag.dn
dn
Definition: getCurrentFolderTag.py:64
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
InDet::SiTools_xk
Definition: SiTools_xk.h:31
InDet::SiTools_xk::maxholes
const int & maxholes() const
Definition: SiTools_xk.h:63
Trk::PatternTrackParameters::cotTheta
double cotTheta() const
CalibCoolCompareRT.up
up
Definition: CalibCoolCompareRT.py:109
InDet::PatternHoleSearchOutcome::nSCTDoubleHoles
int nSCTDoubleHoles
Definition: SiTrajectory_xk.h:36
InDet::SiTrajectory_xk::filterWithPreciseClustersError
bool filterWithPreciseClustersError(const EventContext &)
Definition: SiTrajectory_xk.cxx:1892
InDet::SiTrajectoryElement_xk::BackwardPropagationPrecise
bool BackwardPropagationPrecise(SiTrajectoryElement_xk &, const EventContext &ctx)
Definition: SiTrajectoryElement_xk.cxx:720
InDet::SiTrajectory_xk::convertToSimpleTrackStateOnSurfaceForDisTrackTrigger
Trk::TrackStates convertToSimpleTrackStateOnSurfaceForDisTrackTrigger(const EventContext &ctx)
Definition: SiTrajectory_xk.cxx:245
InDet::SiTrajectory_xk::m_dholes
int m_dholes
Definition: SiTrajectory_xk.h:180
InDet::SiTrajectory_xk::m_difference
int m_difference
Definition: SiTrajectory_xk.h:176
InDet::SiTrajectoryElement_xk::ndist
const int & ndist() const
number of crossed without hit - dead + holes
Definition: SiTrajectoryElement_xk.h:51
InDet::SiTrajectoryElement_xk::detElement
const InDetDD::SiDetectorElement * detElement() const
Definition: SiTrajectoryElement_xk.h:72
InDet::SiTrajectoryElement_xk::parametersPF
const Trk::PatternTrackParameters & parametersPF() const
track parameters for forward filter / smoother predicted
Definition: SiTrajectoryElement_xk.h:129
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::BoundaryCheckResult::Outside
@ Outside
with the insensitive area of an active element
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
InDet::SiTrajectory_xk::m_firstElement
int m_firstElement
Definition: SiTrajectory_xk.h:170
InDet::PatternHoleSearchOutcome::nSCTHoles
int nSCTHoles
Definition: SiTrajectory_xk.h:35
InDet::PatternHoleSearchOutcome::nPixelHoles
int nPixelHoles
Definition: SiTrajectory_xk.h:34
DataVector< const Trk::TrackStateOnSurface >
InDet::SiTrajectory_xk::ndf
const int & ndf() const
Definition: SiTrajectory_xk.h:67
InDet::SiTools_xk::bremNoise
const bool & bremNoise() const
Definition: SiTools_xk.h:69
InDet::SiTrajectoryElement_xk::nclustersB
const int & nclustersB() const
Definition: SiTrajectoryElement_xk.h:59
SCT
Definition: SCT_ChipUtils.h:14
InDet::SiTrajectoryElement_xk::dholesF
const int & dholesF() const
Definition: SiTrajectoryElement_xk.h:56
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
InDet::SiTrajectoryElement_xk::BackwardPropagationSmoother
bool BackwardPropagationSmoother(SiTrajectoryElement_xk &, bool, const EventContext &ctx)
Definition: SiTrajectoryElement_xk.cxx:622
InDetDD::SiDetectorElement::isPixel
bool isPixel() const
InDet::SiTrajectory_xk::getClusters
void getClusters(std::vector< const InDet::SiCluster * > &) const
Definition: SiTrajectory_xk.cxx:1860
Trk::PrepRawData
Definition: PrepRawData.h:62
InDet::SiTrajectoryElement_xk::CloseClusterSeach
void CloseClusterSeach(Trk::PatternTrackParameters &Tpa, const InDet::SiDetElementBoundaryLink_xk *&dl, const T &sb, const T &se)
T = InDet::SiClusterCollection::const_iterator or InDet::PixelClusterCollection::const_iterator or In...
keylayer_zslicemap.isPix
isPix
Definition: keylayer_zslicemap.py:127
InDet::SiTrajectory_xk::m_surfacedead
std::unique_ptr< const Trk::Surface > m_surfacedead
Definition: SiTrajectory_xk.h:193
InDet::PatternHoleSearchOutcome
Helper struct for hole search results from the pattern recognition.
Definition: SiTrajectory_xk.h:33
InDet::SiTrajectoryElement_xk::tsos
Trk::TrackStateOnSurface * tsos(int i)
Definition: SiTrajectoryElement_xk.cxx:2318
InDet::SiTrajectoryElement_xk::cluster
const InDet::SiCluster * cluster() const
Definition: SiTrajectoryElement_xk.h:73
InDet::SiTrajectory_xk::m_itos
int m_itos[100]
Definition: SiTrajectory_xk.h:188
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
InDet::SiTrajectory_xk::dump
std::ostream & dump(std::ostream &out) const
Definition: SiTrajectory_xk.cxx:352
InDet::SiTrajectory_xk::qualityOptimization
double qualityOptimization()
Definition: SiTrajectory_xk.cxx:2133
Trk::IPatternParametersUpdator::combineStates
virtual bool combineStates(PatternTrackParameters &, PatternTrackParameters &, PatternTrackParameters &) const =0
combine two track states into a resulting state.
InDet::SiTrajectory_xk::m_tools
const InDet::SiTools_xk * m_tools
Trajectory elements on this trajectory.
Definition: SiTrajectory_xk.h:192
InDet::SiTrajectory_xk::m_ndfcut
int m_ndfcut
Definition: SiTrajectory_xk.h:184
InDet::SiTrajectory_xk::dholes
const int & dholes() const
Definition: SiTrajectory_xk.h:63
InDet::SiTrajectory_xk::isNewTrack
bool isNewTrack(std::multimap< const Trk::PrepRawData *, const Trk::Track * > &) const
Definition: SiTrajectory_xk.cxx:300
InDet::SiTrajectoryElement_xk::set
bool set(int st, const InDet::SiDetElementBoundaryLink_xk *&dl, const T &sb, const T &se, const InDet::SiCluster *si, const EventContext &ctx)
T = InDet::SiClusterCollection::const_iterator or InDet::PixelClusterCollection::const_iterator or In...
InDet::SiTrajectoryElement_xk::trackPerigeeStateOnSurface
Trk::TrackStateOnSurface * trackPerigeeStateOnSurface(const EventContext &ctx)
Definition: SiTrajectoryElement_xk.cxx:1042
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
InDetDD::SiDetectorElement::isBarrel
bool isBarrel() const
InDet::SiTrajectoryElement_xk::parametersUF
const Trk::PatternTrackParameters & parametersUF() const
updated
Definition: SiTrajectoryElement_xk.h:131
InDet::SiTrajectory_xk::m_nActiveElements
int m_nActiveElements
Definition: SiTrajectory_xk.h:181
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InDet::SiTrajectoryElement_xk::difference
bool difference() const
check for a difference between forward and back propagation
Definition: SiTrajectoryElement_xk.cxx:2073
InDet::SiTrajectoryElement_xk::ForwardPropagationWithoutSearchPreciseWithCorrection
bool ForwardPropagationWithoutSearchPreciseWithCorrection(SiTrajectoryElement_xk &, const EventContext &)
Definition: SiTrajectoryElement_xk.cxx:370
InDet::SiTrajectory_xk::pTseed
double pTseed(const Trk::TrackParameters &, std::vector< const InDet::SiCluster * > &, std::vector< const InDet::SiDetElementBoundaryLink_xk * > &, const EventContext &)
Definition: SiTrajectory_xk.cxx:550
InDet::SiTrajectory_xk::quality
double quality() const
Definition: SiTrajectory_xk.cxx:2118
InDet::SiTrajectory_xk::convertToNextTrackStateOnSurface
Trk::TrackStates convertToNextTrackStateOnSurface()
Definition: SiTrajectory_xk.cxx:2202
InDet::PatternHoleSearchOutcome::passPatternHoleCut
bool passPatternHoleCut
Definition: SiTrajectory_xk.h:39
Trk::inside
@ inside
Definition: PropDirection.h:29
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
InDet::SiTrajectory_xk::nclusters
const int & nclusters() const
Definition: SiTrajectory_xk.h:66
InDet::SiTrajectory_xk::convertToSimpleTrackStateOnSurfaceWithNewDirection
Trk::TrackStates convertToSimpleTrackStateOnSurfaceWithNewDirection()
Definition: SiTrajectory_xk.cxx:198
InDet::SiTrajectoryElement_xk::addNextClusterF
bool addNextClusterF()
Definition: SiTrajectoryElement_xk.cxx:783
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
h
InDet::SiTools_xk::updatorTool
const Trk::IPatternParametersUpdator * updatorTool() const
Definition: SiTools_xk.h:50
InDet::SiTrajectory_xk
Definition: SiTrajectory_xk.h:44
InDet::SiTrajectoryElement_xk::xi2F
const double & xi2F() const
Definition: SiTrajectoryElement_xk.h:121
Trk::PlaneSurface
Definition: PlaneSurface.h:64
InDet::SiTrajectory_xk::m_ntos
int m_ntos
Definition: SiTrajectory_xk.h:186
TRT_PAI_physicsConstants::mb
const double mb
1mb to cm2
Definition: TRT_PAI_physicsConstants.h:15
Trk::PatternTrackParameters
Definition: PatternTrackParameters.h:32
re
const boost::regex re(r_e)
F
#define F(x, y, z)
Definition: MD5.cxx:112
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
python.changerun.pv
pv
Definition: changerun.py:81
S2
struct TBPatternUnitContext S2
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
InDet::SiTrajectoryElement_xk::nclustersF
const int & nclustersF() const
Definition: SiTrajectoryElement_xk.h:58
LArCellBinning.step
step
Definition: LArCellBinning.py:158
extractSporadic.q
list q
Definition: extractSporadic.py:98
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
InDet::SiTrajectory_xk::goodOrder
bool goodOrder()
Definition: SiTrajectory_xk.cxx:1947
InDetDD::SiDetectorElement::isSCT
bool isSCT() const
InDet::SiTrajectoryElement_xk::status
const int & status() const
Definition: SiTrajectoryElement_xk.h:62
merge.status
status
Definition: merge.py:17
InDet::SiTools_xk::xi2max
const double & xi2max() const
Definition: SiTools_xk.h:57
Trk::PatternTrackParameters::position
Amg::Vector3D position() const
Definition: PatternTrackParameters.cxx:79
I
#define I(x, y, z)
Definition: MD5.cxx:116
Trk::BoundaryCheckResult::Error
@ Error
within the nominally active area of a dead element
Trk::PatternTrackParameters::momentum
Amg::Vector3D momentum() const
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
InDet::SiTrajectoryElement_xk::trackParameters
std::unique_ptr< Trk::TrackParameters > trackParameters(bool, int)
Definition: SiTrajectoryElement_xk.cxx:1071
hotSpotInTAG.nb
nb
Definition: hotSpotInTAG.py:164
InDet::SiTrajectoryElement_xk::linkF
const InDet::SiClusterLink_xk & linkF(int i) const
Definition: SiTrajectoryElement_xk.h:145
H5Utils::internal::PT
H5::PredType PT
Definition: H5Traits.cxx:15
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
InDet::SCT_ClusterCollection
Trk::PrepRawDataCollection< SCT_Cluster > SCT_ClusterCollection
Definition: SCT_ClusterCollection.h:26
InDet::SiTools_xk::pTmin
const double & pTmin() const
Definition: SiTools_xk.h:62
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
InDet::SiTrajectory_xk::m_patternHoleOutcome
PatternHoleSearchOutcome m_patternHoleOutcome
Definition: SiTrajectory_xk.h:194
InDet::SiTrajectory_xk::m_nHolesBefore
int m_nHolesBefore
Definition: SiTrajectory_xk.h:177
python.compressB64.c
def c
Definition: compressB64.py:93
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
python.TriggerAPI.TriggerAPISession.df
df
Definition: TriggerAPISession.py:432
InDet::SiTrajectoryElement_xk::setClusterB
void setClusterB(const InDet::SiCluster *, double)
Definition: SiTrajectoryElement_xk.cxx:2135
InDet::SiTrajectory_xk::erase
void erase(int)
Definition: SiTrajectory_xk.cxx:30
InDet::SiTrajectory_xk::setTools
void setTools(const InDet::SiTools_xk *)
Definition: SiTrajectory_xk.cxx:15
InDet::SiCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h:40
plotBeamSpotMon.nc
int nc
Definition: plotBeamSpotMon.py:83
InDet::PixelClusterCollection
Trk::PrepRawDataCollection< PixelCluster > PixelClusterCollection
Definition: PixelClusterCollection.h:26
InDet::SiTools_xk::maxdholes
const int & maxdholes() const
Definition: SiTools_xk.h:64
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111
InDet::SiTrajectory_xk::m_elementsMap
int m_elementsMap[300]
Definition: SiTrajectory_xk.h:183
Trk::BoundaryCheckResult::OnEdge
@ OnEdge
within the sensitive area of an active element
InDet::SiTrajectoryElement_xk::ForwardPropagationWithoutSearch
bool ForwardPropagationWithoutSearch(SiTrajectoryElement_xk &, const EventContext &)
Definition: SiTrajectoryElement_xk.cxx:280