ATLAS Offline Software
TRT_SegmentsToTrack.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //======================================================
6 //
7 // Algorithm for creating Tracks out of TrackSegments
8 // by feeding them through a TrackFitter
9 //
10 // Author: Christian Schmitt <Christian.Schmitt@cern.ch>
11 //
12 //=======================================================
13 
14 #include <fstream>
15 #include <iostream>
16 #include <sstream>
17 
18 
21 
22 #include "TrkTrack/Track.h"
31 
32 #include "InDetIdentifier/TRT_ID.h"
33 
36 
39 
40 // Geometry Stuff
41 #include "Identifier/Identifier.h"
43 
45 
48 
49 #include "StoreGate/ReadHandle.h"
50 #include "StoreGate/WriteHandle.h"
51 
52 
53 
54 
55 InDet::TRT_SegmentsToTrack::TRT_SegmentsToTrack(const std::string& name, ISvcLocator* pSvcLocator):
56  AthAlgorithm(name, pSvcLocator),
57  m_idHelper(nullptr),
58  m_trtid(nullptr),
59  m_nTracksReal(0),
60  m_nTracksFake(0),
61  m_noiseratio(0.),
62  m_events(0),
63  m_n_combined_fit(0)
64 {
65  declareProperty("NoiseCut", m_noiseCut = -1.);
66  declareProperty("MinNHit", m_minTRTHits = 1);
67  declareProperty("MaterialEffects", m_materialEffects = false);
68  declareProperty("OutlierRemoval", m_outlierRemoval = false);
69  declareProperty("CombineSegments", m_combineSegments = false);
70 }
71 
73 {
74 }
75 
77 {
78 
79  ATH_MSG_DEBUG("TrkSegmenttoTrack initialize()");
80 
82 
83  m_nTracksReal=0;
84  m_nTracksFake=0;
85  m_events=0;
86  m_noiseratio=0.;
87 
88  // Initialize handle keys
94  ATH_CHECK(m_BECCollectionName.initialize());
95 
96  //--------- Set up fitter -------------
97  CHECK( m_trackFitter.retrieve());
98 
100 
101  CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
102 
103  CHECK(m_extrapolator.retrieve());
104  ATH_CHECK(m_trkSummaryTool.retrieve( DisableTool{ m_trkSummaryTool.empty() } ));
105  ATH_CHECK(m_assoTool.retrieve( DisableTool{ m_assoTool.empty() || (m_trkSummaryTool.empty() && m_assoMapName.empty()) } ));
108  return StatusCode::SUCCESS;
109 }
110 
112 {
113  ATH_MSG_INFO("Summary of" << m_events << " Events");
114  ATH_MSG_INFO("Found Real Tracks : " << m_nTracksReal);
115  ATH_MSG_INFO("Found Fake Tracks : " << m_nTracksFake);
116 
117  if(m_nTracksReal>0) {
118  ATH_MSG_INFO("Average noise percentage " << m_noiseratio/double(m_nTracksReal));
119  }
120 
121  for (const auto& mitr : m_MapReal) {
122  ATH_MSG_INFO("Real tracks with " << mitr.first << " hits: " << mitr.second);
123  }
124  for (const auto& mitr : m_MapFake) {
125  ATH_MSG_INFO("Fake tracks with " << mitr.first << " hits: " << mitr.second);
126  }
127 
128  if(m_combineSegments){
129  ATH_MSG_INFO("Number of combined Barrel+Endcap tracks: "<<m_n_combined_fit);
130  }
131 
132  ATH_MSG_DEBUG(name() << " finalize() successful ");
133 
134  return StatusCode::SUCCESS;
135 }
136 
138 {
139  int segmentCounter=0;
140  const EventContext& ctx = Gaudi::Hive::currentContext();
141  m_events++;
142 
143  ATH_MSG_DEBUG(name() << " execute() start");
144 
145  StatusCode sc = StatusCode::SUCCESS;
146 
147  //combine segments
148  if( m_combineSegments)
149  combineSegments(ctx);
150 
151  // input TrackSegment Collection
152 
154  if (!inputSegments.isValid()) {
155  ATH_MSG_ERROR("Could not open: " <<m_inputSegmentCollectionName.key());
156  sc = StatusCode::FAILURE;
157  return sc;
158  }
159 
160 
161  //output collections for fitted tracks
162 
163  SG::WriteHandle<TrackCollection> final_outputTrackCollection(m_outputTrackCollectionName,ctx);
164  ATH_CHECK(final_outputTrackCollection.record(std::make_unique<TrackCollection>()));
165 
166  std::vector<std::unique_ptr<Trk::Track> > output_track_collection;
167  //try to get truth information
168 
171 
172  if (!truthCollectionTRT.isValid()){
173  ATH_MSG_FATAL("Could not open PRD_MultiTruthCollection : " << m_multiTruthCollectionTRTName.key());
174  return StatusCode::FAILURE;
175  }
176  }
177 
178  Trk::SegmentCollection::const_iterator iseg = inputSegments->begin();
179  Trk::SegmentCollection::const_iterator isegEnd = inputSegments->end();
180 
181 
182 
183  for(iseg=inputSegments->begin(); iseg != isegEnd; ++ iseg) {
184 
185  segmentCounter++;
186 
187 
188  if((*iseg)->numberOfMeasurementBases()<10) continue; //only convert segments that are large enough
189 
190  Trk::MeasurementSet myset;
191  for(unsigned int i=0;i<(*iseg)->numberOfMeasurementBases();++i){
192  const Amg::VectorX& LocalParameters = (*iseg)->measurement(i)->localParameters();
193  const Amg::MatrixX& LocalErrorMatrix = (*iseg)->measurement(i)->localCovariance();
194  double z=(*iseg)->measurement(i)->globalPosition().z();
195  ATH_MSG_DEBUG("Segment "<<segmentCounter<<" rioOnTrack "<<i<<" (z="<<z<<") : "<<LocalParameters[0]
196  <<" ; "<<std::sqrt(LocalErrorMatrix(Trk::locR,Trk::locR)));
197  myset.push_back((*iseg)->measurement(i));
198  } //end of loop over measurements
199 
200  if((*iseg)->numberOfMeasurementBases()>0){
201  ATH_MSG_DEBUG("numberOfContainedRots: " << (*iseg)->numberOfMeasurementBases());
202 
203  const Trk::StraightLineSurface* testSf
204  = dynamic_cast<const Trk::StraightLineSurface*>(&((*iseg)->associatedSurface()));
205 
206 
207  const Trk::AtaStraightLine* inputMatchLine =nullptr;
208  const Trk::Perigee* inputMatchPerigee =nullptr;
209  const Amg::VectorX &p = dynamic_cast<const Amg::VectorX&>((**iseg).localParameters());
210 
211  if(!testSf){
212  ATH_MSG_DEBUG("No straightLineSurface !! Trying Perigee ...");
213  const Trk::PerigeeSurface *testPSf=dynamic_cast<const Trk::PerigeeSurface*>(&((*iseg)->associatedSurface()));
214 
215  if(!testPSf){
216  ATH_MSG_DEBUG("Associated surface dynamic_cast into PerigeeSurface failed: "<<(*iseg)->associatedSurface());
217  ATH_MSG_DEBUG("Leaving input matching perigee as nullptr, will not get a fittedTrack");
218  }else{
219  ATH_MSG_DEBUG("Ok, it seems to be a PerigeeSurface");
220  inputMatchPerigee = new Trk::Perigee(p(0),p(1),p(2),p(3),p(4), *testPSf);
221  }
222  }else{
223  inputMatchLine = new Trk::AtaStraightLine(p(0),p(1),p(2),p(3),p(4),*testSf);
224 
225  ATH_MSG_DEBUG("Created testSf : " << (*inputMatchLine));
226  int nmeas=(*iseg)->numberOfMeasurementBases();
227  Amg::Vector3D surfpos(.5*((*iseg)->measurement(nmeas/2)->globalPosition()+(*iseg)->measurement(nmeas/2+1)->globalPosition()));
228  Trk::PerigeeSurface persurf(surfpos);
229  std::unique_ptr<const Trk::TrackParameters> tmp =
230  m_extrapolator->extrapolateDirectly(ctx, *inputMatchLine, persurf);
231  if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
232  inputMatchPerigee = static_cast<const Trk::Perigee*>(tmp.release());
233  }
234  }
235  ATH_MSG_DEBUG("Created inputMatchLine");
236 
237  std::unique_ptr<Trk::Track> fittedTrack;
238  const Trk::TrackParameters *inputpar=nullptr;
239  if (inputMatchPerigee) inputpar=inputMatchPerigee;
240  else if (inputMatchLine) inputpar=inputMatchLine;
241 
242  if (inputpar) {
243  fittedTrack = m_trackFitter->fit(ctx,
244  myset,
245  *inputpar,
248  }
249  if(fittedTrack){
251  Trk::TrackStates::const_iterator itSetEnd = fittedTrack->trackStateOnSurfaces()->end();
252  const Trk::TrackParameters *measpar=nullptr;
253  double mindist=9999;
254  for ( ; itSet!=itSetEnd; ++itSet) {
255  if ((**itSet).type(Trk::TrackStateOnSurface::Measurement) && (**itSet).trackParameters()->position().perp()<mindist) {
256  mindist=(**itSet).trackParameters()->position().perp();
257  measpar=(**itSet).trackParameters();
258  }
259  }
260  std::unique_ptr<Trk::TrackParameters> myper;
261  if (measpar){
263  }
264  if (!myper){
265  fittedTrack.reset();
266  }
267  else {
268  auto trajectory = std::make_unique<Trk::TrackStates>();
269  itSet = fittedTrack->trackStateOnSurfaces()->begin();
270  for ( ; itSet!=itSetEnd; ++itSet) {
271  if (!(**itSet).type(Trk::TrackStateOnSurface::Perigee)) {
272  auto trackpar=(**itSet).trackParameters() ? (**itSet).trackParameters()->uniqueClone() : nullptr;
273  auto measurement=(**itSet).measurementOnTrack() ? (**itSet).measurementOnTrack()->uniqueClone() : nullptr;
274  auto fitQual=(**itSet).fitQualityOnSurface() ;
275  auto mateff=(**itSet).materialEffectsOnTrack() ? (**itSet).materialEffectsOnTrack()->uniqueClone() : nullptr;
276  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
278  else if ((**itSet).type(Trk::TrackStateOnSurface::Outlier)) typePattern.set(Trk::TrackStateOnSurface::Outlier);
279  else if ((**itSet).type(Trk::TrackStateOnSurface::Scatterer)) typePattern.set(Trk::TrackStateOnSurface::Scatterer);
280  else if ((**itSet).type(Trk::TrackStateOnSurface::BremPoint)) typePattern.set(Trk::TrackStateOnSurface::BremPoint);
281  trajectory->push_back(
282  new Trk::TrackStateOnSurface(fitQual,
283  std::move(measurement),
284  std::move(trackpar),
285  std::move(mateff),
286  typePattern));
287  }
288  }
289  bool peradded=false;
290  itSet = trajectory->begin()+1;
291  itSetEnd = trajectory->end();
292  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
293  typePattern.set(Trk::TrackStateOnSurface::Perigee);
294  const auto myPosition {myper->position()};
295  const auto myMomentum {myper->momentum()};
296  const Trk::TrackStateOnSurface* pertsos =
297  new Trk::TrackStateOnSurface(nullptr,
298  std::move(myper),
299  nullptr,
300  typePattern);
301 
302  int index=1;
303  for ( ; itSet!=itSetEnd; ++itSet) {
304  double inprod1=((**itSet).trackParameters()->position()-myPosition).dot(myMomentum);
305  --itSet;
306  double inprod2=((**itSet).trackParameters()->position()-myPosition).dot(myMomentum);
307  ++itSet;
308  if (inprod1>0 && inprod2<0) {
309  trajectory->insert(trajectory->begin()+index,pertsos);
310  peradded=true;
311  break;
312  }
313  index++;
314  }
315  if (!peradded){
316  itSet = trajectory->begin();
317  double inprod=((**itSet).trackParameters()->position()-myPosition).dot(myMomentum);
318  if (inprod>0) trajectory->insert(trajectory->begin(),pertsos);
319  else trajectory->push_back(pertsos);
320  }
321  std::unique_ptr<Trk::Track> track =
322  std::make_unique<Trk::Track>(fittedTrack->info(),
323  std::move(trajectory),
324  fittedTrack->fitQuality()->uniqueClone());
325  fittedTrack = std::move(track);
326  }
327  }
328  if(fittedTrack){
329 
330  int nHT=nHTHits(fittedTrack.get());
331  ATH_MSG_DEBUG("Number of HT hits: "<<nHT);
332  ATH_MSG_DEBUG(" Successful fit of track.");
333  if ((*iseg)->fitQuality()) ATH_MSG_DEBUG("Quality of Segment: chi^2 /ndof "<<(*iseg)->fitQuality()->chiSquared()<<" / "<<(*iseg)->fitQuality()->numberDoF());
334  ATH_MSG_DEBUG("Quality of Track: chi^2 /ndof "<<fittedTrack->fitQuality()->chiSquared()<<" / "<<fittedTrack->fitQuality()->numberDoF());
335  ATH_MSG_DEBUG("Noise probability: "<<getNoiseProbability(fittedTrack.get()));
336  ATH_MSG_DEBUG((*fittedTrack));
337 
338  if( nTRTHits(fittedTrack.get())>=m_minTRTHits){
339  if(getNoiseProbability(fittedTrack.get())>m_noiseCut){
340  double truefraction=getRealFractionTRT(fittedTrack.get(),ctx);
341 
342  int nhits=(*iseg)->numberOfMeasurementBases();
343  ATH_MSG_DEBUG("Real/Noise : "<< truefraction << " chi2="<<fittedTrack->fitQuality()->chiSquared()/double(fittedTrack->fitQuality()->numberDoF()));
344  if(truefraction>0.5){
345  ATH_MSG_DEBUG("==> Real Track");
346 
347  if(m_MapReal.find(nhits)==m_MapReal.end()){
348  m_MapReal[nhits]=1;
349  }else{
350  m_MapReal[nhits]++;
351  }
352 
353  m_nTracksReal++;
354  m_noiseratio+=(1-truefraction);
355  }else{
356  ATH_MSG_DEBUG(" ==> Fake Track");
357 
358  if(m_MapFake.find(nhits)==m_MapFake.end()){
359  m_MapFake[nhits]=1;
360  }else{
361  m_MapFake[nhits]++;
362  }
363 
364  m_nTracksFake++;
365  }
366  }
367  output_track_collection.push_back(std::move(fittedTrack));
368  }else{
369  ATH_MSG_DEBUG("This tracks has only "<<nTRTHits(fittedTrack.get())<<" Hits! Will reject it!");
370  }
371 
372  }else{
373  ATH_MSG_DEBUG("Fit did not converge!");
374  } //end of if(fittedTrack)
375 
376  delete inputMatchLine;
377  delete inputMatchPerigee;
378 
379  } //end of if: (*iseg)->numberOfMeasurementBases()>0
380  } //end of loop over segments
381 
382  std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map;
383  if (m_assoTool.isEnabled()) {
384  // create internal PRD-to-track map
385  prd_to_track_map = m_assoTool->createPRDtoTrackMap();
386  if (!m_inputAssoMapName.key().empty()) {
388  if (!input_asso_map.isValid()) {
389  ATH_MSG_FATAL("No valid input PRT-to-track map with key " << m_inputAssoMapName.key());
390  }
391  *prd_to_track_map = *input_asso_map;
392  ATH_MSG_INFO("PRD to track map input " << m_inputAssoMapName.key() );
393  }
394  for (const std::unique_ptr<Trk::Track> &track : output_track_collection) {
395  ATH_CHECK( m_assoTool->addPRDs(*prd_to_track_map, *track) );
396  }
397  }
398  // @TODO sort output track collection ?
399  final_outputTrackCollection->reserve(output_track_collection.size());
400  if (m_trkSummaryTool.isEnabled()) {
401  for (std::unique_ptr<Trk::Track> &track : output_track_collection) {
402  m_trkSummaryTool->computeAndReplaceTrackSummary(*track,prd_to_track_map.get());
403  final_outputTrackCollection->push_back(std::move(track));
404  }
405  }
406  else {
407  for (std::unique_ptr<Trk::Track> &track : output_track_collection) {
408  final_outputTrackCollection->push_back(std::move(track));
409  }
410  }
411  if (!m_assoMapName.key().empty()) {
412  ATH_CHECK(SG::WriteHandle<Trk::PRDtoTrackMap>(m_assoMapName,ctx).record(std::move(prd_to_track_map)));
413  }
414 
415  if (!final_outputTrackCollection.isValid()) {
416  // @TODO never reached (?)
417  ATH_MSG_ERROR("Could not write track collection " << m_outputTrackCollectionName.key());
418  return StatusCode::FAILURE;
419  //return sc;
420  }
421 
422  return sc;
423 }
424 
425 int InDet::TRT_SegmentsToTrack::getNumberReal(const InDet::TRT_DriftCircle* driftcircle,const EventContext& ctx) const
426 {
427  int numBarcodes = 0;
428  using iter = PRD_MultiTruthCollection::const_iterator;
429 
430  if(m_multiTruthCollectionTRTName.empty()) return 0;
431 
432  else{
434  if(truthCollectionTRT.isValid()){
435  std::pair<iter,iter> range = truthCollectionTRT->equal_range(driftcircle->identify());
436  numBarcodes+=std::distance(range.first,range.second);
437  }
438  }
439  return numBarcodes;
440 }
441 
442 
443 
444 double InDet::TRT_SegmentsToTrack::getRealFractionTRT(const Trk::Track *track,const EventContext& ctx) const
445 {
446  double fraction=0.;
447  int nDriftReal=0;
448  int nDriftNoise=0;
449 
450  //loop over the hits
451  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
452 
453  const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
454  if (hitOnTrack) {
455  const Identifier& surfaceID = hitOnTrack->identify();
456 
457  //take only TRT hits
458  if(m_idHelper->is_trt(surfaceID)){
459 
460  const InDet::TRT_DriftCircleOnTrack *dcot= dynamic_cast <const InDet::TRT_DriftCircleOnTrack*>(hitOnTrack);
461  if(dcot) {
462  const InDet::TRT_DriftCircle *dc=dcot->prepRawData();
463 
464  if(dc){
465  int nreal=getNumberReal(dc,ctx);
466 
467  if(nreal>0) nDriftReal++;
468  else nDriftNoise++;
469 
470  }
471  }
472  }
473  }
474  }
475 
476  if(nDriftReal>0)
477  fraction=double(nDriftReal)/double(nDriftNoise+nDriftReal);
478 
479  return fraction;
480 }
481 
482 
484 {
485 
486  int nHT=0;
487 
488  //loop over the hits
489  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
490 
491  const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
492  if (hitOnTrack != nullptr) {
493  const Identifier& surfaceID = hitOnTrack->identify();
494 
495  //take only TRT hits
496  if(m_idHelper->is_trt(surfaceID) && !tsos->type(Trk::TrackStateOnSurface::Outlier)){
497  const InDet::TRT_DriftCircleOnTrack* trtcirc = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(hitOnTrack);
498  if(trtcirc) {
499  if(trtcirc->highLevel()){
500  nHT++;
501  }
502  }
503  }
504  }
505  }
506 
507  return nHT;
508 }
509 
510 
511 
513 {
514  int nhits=0;
515 
516  //loop over the hits
517  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
518 
519  const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
520  if (hitOnTrack != nullptr) {
521  const Identifier& surfaceID = hitOnTrack->identify();
522 
523  //take only TRT hits
524  if(m_idHelper->is_trt(surfaceID) && !tsos->type(Trk::TrackStateOnSurface::Outlier)){
525  nhits++;
526  }
527  }
528  }
529 
530  return nhits;
531 }
532 
533 
535 {
536  double fraction=0.;
537  int nDriftReal=0;
538  int nDriftNoise=0;
539 
540  //loop over the hits
541  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
542  const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
543  if (hitOnTrack) {
544  const Identifier& surfaceID = hitOnTrack->identify();
545 
546  //take only TRT hits
547  if(m_idHelper->is_trt(surfaceID)){
548 
549  const InDet::TRT_DriftCircleOnTrack *dcot= dynamic_cast <const InDet::TRT_DriftCircleOnTrack*>(hitOnTrack);
550  if (dcot) {
551  const InDet::TRT_DriftCircle *dc=dcot->prepRawData();
552 
553  if(dc){
554 
555  if(dc->isNoise())
556  nDriftNoise++;
557  else
558  nDriftReal++;
559  }
560  }
561  }
562  }
563  }
564 
565  if(nDriftReal>0)
566  fraction=double(nDriftReal)/double(nDriftNoise+nDriftReal);
567 
568  return fraction;
569 }
570 
571 
572 
573 void InDet::TRT_SegmentsToTrack::combineSegments(const EventContext& ctx) const
574 {
575  //Idea:
576  // - get from endcap segment z-phi dependence
577  // - get from barrel segment r-phi dependence and z dependence from endcap segment fit
578 
579  int n_combined_fit=0;
582 
583  StatusCode sc;
584 
585  SG::WriteHandle<TrackCollection> outputCombiCollection(m_BECCollectionName,ctx);
586  sc = outputCombiCollection.record(std::make_unique<TrackCollection>());
587  if (sc.isFailure()) return;
588 
589  if (!BarrelSegments.isValid()){
590  ATH_MSG_FATAL("Could not open barrel segments collection : " << m_barrelSegments.key());
591  return;
592  }
593 
594  if (!EndcapSegments.isValid()) {
595  ATH_MSG_FATAL("Could not open endcap segments collection : " << m_endcapSegments.key());
596  return;
597  }
598 
599  ATH_MSG_VERBOSE("Got both barrel and endcap segment collections of size "<<BarrelSegments->size()<<" "<<EndcapSegments->size());
600 
601  Trk::SegmentCollection::const_iterator iseg = BarrelSegments->begin();
602  Trk::SegmentCollection::const_iterator isegE = BarrelSegments->end();
603 
604  int scount=0;
605  for(;iseg!=isegE;++iseg,scount++){
606  ATH_MSG_VERBOSE("Barrel Segment "<<scount<<" : phi="<<(*iseg)->localParameters()[Trk::phi]);
607  }
608 
609  iseg = EndcapSegments->begin();
610  isegE = EndcapSegments->end();
611 
612  scount=0;
613  for(;iseg!=isegE;++iseg,scount++){
614  ATH_MSG_VERBOSE("Endcap Segment "<<scount<<" : phi="<<(*iseg)->localParameters()[Trk::phi]);
615  }
616 
617  if(BarrelSegments->size()==1 && EndcapSegments->size()==1){
618  ATH_MSG_VERBOSE("Here we go: one barrel segment and one endcap segment!");
619 
620  Trk::SegmentCollection::const_iterator isegBarrel = BarrelSegments->begin();
621  Trk::SegmentCollection::const_iterator isegBarrelE = BarrelSegments->end();
622 
623  Trk::SegmentCollection::const_iterator isegEndcap = EndcapSegments->begin();
624  Trk::SegmentCollection::const_iterator isegEndcapE = EndcapSegments->end();
625 
626  //loop over all Barrel Segments
627  for(;isegBarrel!=isegBarrelE;++isegBarrel){
628  for(;isegEndcap!=isegEndcapE;++isegEndcap){
629 
630  std::vector< Trk::PseudoMeasurementOnTrack*> tobedeleted;
631 
632  ATH_MSG_VERBOSE("Barrel Segment : phi="<<(*isegBarrel)->localParameters()[Trk::phi]<<" with "<<(*isegBarrel)->numberOfMeasurementBases()<<" hits");
633  ATH_MSG_VERBOSE("Endcap Segment : phi="<<(*isegEndcap)->localParameters()[Trk::phi]<<" with "<<(*isegEndcap)->numberOfMeasurementBases()<<" hits");
634 
635  int count=0;
636  Trk::MeasurementSet myset,myset2,echits=(*isegEndcap)->containedMeasurements();
637 
638  bool barreldown=((*isegBarrel)->measurement((*isegBarrel)->numberOfMeasurementBases()/2)->globalPosition().y()<0);
639  double theta=0;
640  if((*isegEndcap)->localParameters().contains(Trk::theta)){
641  theta = (*isegEndcap)->localParameters()[Trk::theta];
642  }
643 
644  //correct theta to point towards the barrel
645  if(( (*isegEndcap)->globalPosition().y()>0 && (*isegEndcap)->globalPosition().z()>0) ||
646  ((*isegEndcap)->globalPosition().y()<0 && (*isegEndcap)->globalPosition().z()<0)
647  ){
648  //endcap A top pointing to barrel A bottom or Barrel C top pointing to Endcap C bottom
649  //--> Theta between 90 and 180 degrees
650  if(theta<M_PI/2.) {
651  theta=M_PI-theta;
652  std::reverse(echits.begin(),echits.end());
653  }
654  }else{
655  //Theta between 0 and 90 degrees
656  if(theta>M_PI/2.) {
657  theta=M_PI-theta;
658  std::reverse(echits.begin(),echits.end());
659  }
660  }
661 
662  //decide if barrel or endcap hits come first depending on global position of segments
663 
664  if(!barreldown && (*isegEndcap)->globalPosition().y()>0){
665  ATH_MSG_VERBOSE("Both barrel and endcap segments in top sectors, won't fit");
666  continue;
667  }
668 
669  if(barreldown && (*isegEndcap)->globalPosition().y()<0){
670  ATH_MSG_VERBOSE("Both barrel and endcap segments in lower sectors, won't fit");
671  continue;
672  }
673  int firstechit=0,lastechit=0;
674  if((*isegEndcap)->globalPosition().y()>0){
675  //first endcap then barrel
676  for(int i=0;i<(int)echits.size();++i){
677  const Trk::MeasurementBase *meas=echits[i];
678  const Amg::VectorX LocalParameters = meas->localParameters();
679  const Amg::MatrixX LocalErrorMatrix = meas->localCovariance();
680  double z=meas->globalPosition().z();
681  double phi=meas->globalPosition().phi();
682  double r=meas->globalPosition().perp();
683 
684  const InDet::TRT_DriftCircleOnTrack* trtcirc = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(meas);
685  if(trtcirc){
686  myset.push_back(meas);
687  ATH_MSG_VERBOSE("Endcap : (phi,r,z) = ( "<<phi<<" , "<<r<<" , "<<z<<" ) ");
688  count++;
689  }
690  }
691  firstechit=0;
692  lastechit=count-1;
693 
694  for(unsigned int i=0;i<(*isegBarrel)->numberOfMeasurementBases();++i){
695  const Amg::VectorX LocalParameters = (*isegBarrel)->measurement(i)->localParameters();
696  const Amg::MatrixX LocalErrorMatrix = (*isegBarrel)->measurement(i)->localCovariance();
697  double z=(*isegBarrel)->measurement(i)->globalPosition().z();
698  double phi=(*isegBarrel)->measurement(i)->globalPosition().phi();
699  double r=(*isegBarrel)->measurement(i)->globalPosition().perp();
700 
701  const Trk::MeasurementBase *mesb=(*isegBarrel)->measurement(i);
702  const InDet::TRT_DriftCircleOnTrack* trtcirc = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(mesb);
703  if(trtcirc){
704  myset.push_back((*isegBarrel)->measurement(i));
705  ATH_MSG_VERBOSE("Barrel : (phi,r,z) = ( "<<phi<<" , "<<r<<" , "<<z<<" ) ");
706  count++;
707  }
708 
709  }
710  }else{
711  //first barrel then endcap
712  for(unsigned int i=0;i<(*isegBarrel)->numberOfMeasurementBases();++i){
713  const Amg::VectorX LocalParameters = (*isegBarrel)->measurement(i)->localParameters();
714  const Amg::MatrixX LocalErrorMatrix = (*isegBarrel)->measurement(i)->localCovariance();
715  double z=(*isegBarrel)->measurement(i)->globalPosition().z();
716  double phi=(*isegBarrel)->measurement(i)->globalPosition().phi();
717  double r=(*isegBarrel)->measurement(i)->globalPosition().perp();
718 
719  const Trk::MeasurementBase *mesb=(*isegBarrel)->measurement(i);
720  const InDet::TRT_DriftCircleOnTrack* trtcirc = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(mesb);
721  if(trtcirc){
722  myset.push_back((*isegBarrel)->measurement(i));
723  ATH_MSG_VERBOSE("Barrel : (phi,r,z) = ( "<<phi<<" , "<<r<<" , "<<z<<" ) ");
724  count++;
725  }
726 
727  }
728  firstechit=count;
729 
730  for(int i=0;i<(int)echits.size();++i){
731  const Trk::MeasurementBase *meas=echits[i];
732  const Amg::VectorX LocalParameters = meas->localParameters();
733  const Amg::MatrixX LocalErrorMatrix = meas->localCovariance();
734  double z=meas->globalPosition().z();
735  double phi=meas->globalPosition().phi();
736  double r=meas->globalPosition().perp();
737 
738  const InDet::TRT_DriftCircleOnTrack* trtcirc = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(meas);
739  if(trtcirc){
740  myset.push_back(meas);
741  ATH_MSG_VERBOSE("Endcap : (phi,r,z) = ( "<<phi<<" , "<<r<<" , "<<z<<" ) ");
742  count++;
743  }
744 
745  }
746  lastechit=count-1;
747  }
748 
749 
750 
751  Amg::Vector3D inputMatchingPos((*isegBarrel)->globalPosition());
752 
753  if((*isegEndcap)->globalPosition().y()>0)
754  inputMatchingPos=(*isegEndcap)->globalPosition();
755 
756  Amg::Vector3D inputMatchingMom;
757  double p = 10e7;
758 
759  if((*isegBarrel)->localParameters().contains(Trk::qOverP)){
760  p = ((*isegBarrel)->localParameters()[Trk::qOverP]!=0.) ? fabs(1./((*isegBarrel)->localParameters()[Trk::qOverP])) : 10e7;
761  }
762 
763  double phi=0.;
764  if((*isegBarrel)->localParameters().contains(Trk::phi)){
765  phi = (*isegBarrel)->localParameters()[Trk::phi];
766  }
767 
768 
769  inputMatchingMom[Trk::px] = p * cos(phi) * sin(theta);
770  inputMatchingMom[Trk::py] = p * sin(phi) * sin(theta);
771  inputMatchingMom[Trk::pz] = p * cos(theta);
772 
773 
774  ATH_MSG_VERBOSE("Global position: "<<inputMatchingPos<<" Globalmomentum: "<<inputMatchingMom);
775 
776 
777 
778  //add two pseudomeasurements at the beginning and at the end of the track
779  Trk::MeasurementSet::const_iterator mit;
780  Trk::MeasurementSet::const_iterator mitE=myset.end();
781 
782  int count2=0;
783  for(mit=myset.begin();mit!=mitE;++mit){
784  myset2.push_back(*mit);
785  if(count2==firstechit || count2==lastechit){
786  const InDet::TRT_DriftCircleOnTrack* trtcirc = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(*mit);
787  if(trtcirc){
788  const Trk::StraightLineSurface *line=dynamic_cast<const
790  if (line) {
791  //add pseudomeasurement
792  double locz=-200.;
793  if ((count2==firstechit && firstechit!=0) || (count2==lastechit && firstechit==0)) locz=200;
796 
797  Amg::MatrixX cov(1,1);
798  cov(0,0) = 16./12. ; // take actual length of straw instead !!!!!
799 
800  //create new surface
801  Amg::Vector3D C = line->transform().translation();
802 
803  //decide on movement
804 
805  const Amg::Vector3D& gpos=(*mit)->globalPosition();
806 
807  if(fabs(gpos.z())>800){
808  if(theta>M_PI/2.){
809  C[2]-=1.;
810  }else{
811  C[2]+=1.;
812  }
813  }else{
814  C[1]-=1.;
815  }
816 
817 
819  T = line->transform().rotation();
820  T *= Amg::Translation3D(C.x(),C.y(),C.z());
822 
824  std::move(cov),
825  *surface);
826 
827  tobedeleted.push_back(pseudo);
828 
829  delete surface;
830 
831  myset2.push_back(pseudo);
832  }
833  }
834  }
835  count2++;
836  }
837 
838 
839 
840  const Trk::StraightLineSurface* testSf;
841  if((*isegEndcap)->globalPosition().y()>0){
842  testSf= dynamic_cast<const Trk::StraightLineSurface*>(&((*isegEndcap)->associatedSurface()));
843  }else{
844  testSf= dynamic_cast<const Trk::StraightLineSurface*>(&((*isegBarrel)->associatedSurface()));
845  }
846 
847  const Trk::AtaStraightLine* inputMatchLine = nullptr;
848  const Trk::Perigee* inputMatchPerigee = nullptr;
849 
850  if(!testSf){
851  ATH_MSG_VERBOSE("No straightLineSurface !! Trying Perigee ...");
852 
853  const Trk::PerigeeSurface *testPSf=dynamic_cast<const Trk::PerigeeSurface*>(&((*isegBarrel)->associatedSurface()));
854 
855  if(!testPSf){
856  ATH_MSG_VERBOSE("Associated surface dynamic_cast into PerigeeSurface failed. "<<(*isegBarrel)->associatedSurface());
857  ATH_MSG_VERBOSE("Leaving input matching perigee as nullptr, will not get a fittedTrack");
858  }else{
859  ATH_MSG_VERBOSE("Ok, it seems to be a PerigeeSurface");
860  inputMatchPerigee = new Trk::Perigee(inputMatchingPos,inputMatchingMom, 1., *testPSf);
861  }
862 
863  }else{
864  inputMatchLine = new Trk::AtaStraightLine(inputMatchingPos,inputMatchingMom, 1., *testSf);
865  ATH_MSG_VERBOSE("Created testSf : " << (*inputMatchLine));
866  }
867 
868  Amg::Vector3D startMomentum( 0., 0., 1.);
869  std::unique_ptr<Trk::Track> fittedTrack;
870  if(m_materialEffects){
871  if(inputMatchLine){
872  fittedTrack=m_trackFitter->fit(ctx,
873  myset2,
874  *inputMatchLine,
875  false,
876  Trk::muon
877  );
878  }else if (inputMatchPerigee){
879  fittedTrack=m_trackFitter->fit(ctx,
880  myset2,
881  *inputMatchPerigee,
882  false,
883  Trk::muon
884  );
885  }
886  }else{
887  if(inputMatchLine){
888  fittedTrack=m_trackFitter->fit(ctx,
889  myset2,
890  *inputMatchLine,
891  false,
893  );
894  }else if (inputMatchPerigee){
895  fittedTrack=m_trackFitter->fit(ctx,
896  myset2,
897  *inputMatchPerigee,
898  false,
899  Trk::muon
900  );
901  }
902  }
903 
904  if(fittedTrack){
905  n_combined_fit++;
906  ATH_MSG_DEBUG("Successful Barrel+Endcap fit of segment. ");
907  ATH_MSG_DEBUG("Quality of Track: "<<fittedTrack->fitQuality()->chiSquared()<<" / "<<fittedTrack->fitQuality()->numberDoF());
908  ATH_MSG_VERBOSE(*fittedTrack);
909  outputCombiCollection->push_back(std::move(fittedTrack));
910 }
911 
912  delete inputMatchPerigee;
913  delete inputMatchLine;
914 
915  for(size_t i=0;i<tobedeleted.size();i++)
916  delete tobedeleted[i];
917  tobedeleted.clear();
918  }
919  }
920  }
921  m_n_combined_fit += n_combined_fit;
922 
923  if (!outputCombiCollection.isValid()) {
924  ATH_MSG_ERROR("Could not write track Barrel+EC collection TRT_Barrel_EC");
925  }
926 }
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
calibdata.scount
int scount
Definition: calibdata.py:355
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDet::TRT_SegmentsToTrack::m_nTracksFake
int m_nTracksFake
Counter for fake reconstructed Track.
Definition: TRT_SegmentsToTrack.h:110
InDet::TRT_SegmentsToTrack::getNumberReal
int getNumberReal(const InDet::TRT_DriftCircle *, const EventContext &ctx) const
Get the number of truth particles associated with this hit.
Definition: TRT_SegmentsToTrack.cxx:425
Trk::anyDirection
@ anyDirection
Definition: PropDirection.h:22
beamspotman.r
def r
Definition: beamspotman.py:676
Trk::LocalParameters
Definition: LocalParameters.h:98
Trk::py
@ py
Definition: ParamDefs.h:66
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
Trk::TrackStateOnSurface::Perigee
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
Definition: TrackStateOnSurface.h:117
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
checkFileSG.line
line
Definition: checkFileSG.py:75
Trk::Track::fitQuality
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
InDet::TRT_DriftCircleOnTrack::prepRawData
virtual const TRT_DriftCircle * prepRawData() const override final
returns the PrepRawData - is a TRT_DriftCircle in this scope
Definition: TRT_DriftCircleOnTrack.h:202
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:32
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
StraightLineSurface.h
TrackParameters.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PerigeeSurface.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
InDet::TRT_SegmentsToTrack::m_assoTool
ToolHandle< Trk::IPRDtoTrackMapTool > m_assoTool
Definition: TRT_SegmentsToTrack.h:91
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
InDet::TRT_SegmentsToTrack::nHTHits
int nHTHits(const Trk::Track *track) const
Count number of TRT HT Hits on track.
Definition: TRT_SegmentsToTrack.cxx:483
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
InDet::TRT_SegmentsToTrack::m_MapReal
std::map< int, int > m_MapReal
Map of hits and real tracks.
Definition: TRT_SegmentsToTrack.h:115
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::Track::trackStateOnSurfaces
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
InDet::TRT_SegmentsToTrack::finalize
StatusCode finalize()
Definition: TRT_SegmentsToTrack.cxx:111
Trk::Track::info
const TrackInfo & info() const
Returns a const ref to info of a const tracks.
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
InDet::TRT_SegmentsToTrack::getRealFractionTRT
double getRealFractionTRT(const Trk::Track *track, const EventContext &ctx) const
Get the fraction of truth TRT hits on this Track.
Definition: TRT_SegmentsToTrack.cxx:444
DMTest::C
C_v1 C
Definition: C.h:26
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
M_PI
#define M_PI
Definition: ActiveFraction.h:11
ParticleGun_SamplingFraction.myMomentum
myMomentum
Definition: ParticleGun_SamplingFraction.py:64
InDet::TRT_DriftCircleOnTrack::associatedSurface
virtual const Trk::Surface & associatedSurface() const override final
returns the surface for the local to global transformation
Definition: TRT_DriftCircleOnTrack.cxx:154
Trk::Perigee
ParametersT< 5, Charged, PerigeeSurface > Perigee
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:29
TrackStateOnSurfaceComparisonFunction.h
InDet::TRT_SegmentsToTrack::m_outputTrackCollectionName
SG::WriteHandleKey< TrackCollection > m_outputTrackCollectionName
Name of the TrackCollection to write out.
Definition: TRT_SegmentsToTrack.h:80
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
InDet::TRT_DriftCircleOnTrack::highLevel
bool highLevel() const
returns true if the high level threshold was passed
Definition: TRT_DriftCircleOnTrack.h:234
InDet::TRT_SegmentsToTrack::m_trtid
const TRT_ID * m_trtid
Definition: TRT_SegmentsToTrack.h:104
Trk::locR
@ locR
Definition: ParamDefs.h:50
AtlasDetectorID::is_trt
bool is_trt(Identifier id) const
Definition: AtlasDetectorID.h:782
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
Trk::pz
@ pz
global momentum (cartesian)
Definition: ParamDefs.h:67
InDet::TRT_DriftCircleOnTrack
Definition: TRT_DriftCircleOnTrack.h:53
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
InDet::TRT_SegmentsToTrack::m_barrelSegments
SG::ReadHandleKey< Trk::SegmentCollection > m_barrelSegments
Name of Barrel segment collection.
Definition: TRT_SegmentsToTrack.h:124
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TrackSegment.h
Trk::DefinedParameter
std::pair< double, ParamDefs > DefinedParameter
Definition: DefinedParameter.h:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
Trk::TrackStateOnSurface::Outlier
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Definition: TrackStateOnSurface.h:122
Track.h
InDet::TRT_SegmentsToTrack::m_materialEffects
bool m_materialEffects
Flag to switch on Material Effects in the Fitter.
Definition: TRT_SegmentsToTrack.h:118
Trk::PseudoMeasurementOnTrack
Class to handle pseudo-measurements in fitters and on track objects.
Definition: PseudoMeasurementOnTrack.h:44
InDet::TRT_SegmentsToTrack::m_multiTruthCollectionTRTName
SG::ReadHandleKey< PRD_MultiTruthCollection > m_multiTruthCollectionTRTName
Name of the TRT MultiTruthCollection.
Definition: TRT_SegmentsToTrack.h:107
InDet::TRT_SegmentsToTrack::m_noiseCut
double m_noiseCut
All tracks with a TRT Noise fraction larger than this variable will be thrown away.
Definition: TRT_SegmentsToTrack.h:99
GeoPrimitives.h
InDet::TRT_SegmentsToTrack::m_endcapSegments
SG::ReadHandleKey< Trk::SegmentCollection > m_endcapSegments
Name of Endcap segment collection.
Definition: TRT_SegmentsToTrack.h:125
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
WriteHandle.h
Handle class for recording to StoreGate.
InDet::TRT_SegmentsToTrack::m_trackFitter
ToolHandle< Trk::ITrackFitter > m_trackFitter
The TrackFitter.
Definition: TRT_SegmentsToTrack.h:83
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:48
InDet::TRT_DriftCircle::isNoise
bool isNoise() const
returns true if the hit is caused by noise with a high probability.
InDet::TRT_SegmentsToTrack::~TRT_SegmentsToTrack
~TRT_SegmentsToTrack()
Definition: TRT_SegmentsToTrack.cxx:72
lumiFormat.i
int i
Definition: lumiFormat.py:92
z
#define z
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Trk::theta
@ theta
Definition: ParamDefs.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::TRT_SegmentsToTrack::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
The Extrapolator.
Definition: TRT_SegmentsToTrack.h:86
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
TrackCollection.h
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PseudoMeasurementOnTrack.h
Trk::px
@ px
Definition: ParamDefs.h:65
InDet::TRT_SegmentsToTrack::TRT_SegmentsToTrack
TRT_SegmentsToTrack(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TRT_SegmentsToTrack.cxx:55
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
InDet::TRT_SegmentsToTrack::nTRTHits
int nTRTHits(const Trk::Track *track) const
Count number of TRT Hits on track.
Definition: TRT_SegmentsToTrack.cxx:512
Trk::ParametersBase
Definition: ParametersBase.h:55
TRT_DriftCircleOnTrack.h
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
InDet::TRT_SegmentsToTrack::m_idHelper
const AtlasDetectorID * m_idHelper
Definition: TRT_SegmentsToTrack.h:102
dot.dot
def dot(G, fn, nodesToHighlight=[])
Definition: dot.py:5
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TRT_DriftCircle.h
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
Trk::TrackStateOnSurface::BremPoint
@ BremPoint
This represents a brem point on the track, and so will contain TrackParameters and MaterialEffectsBas...
Definition: TrackStateOnSurface.h:109
Trk::MeasurementSet
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
Definition: FitterTypes.h:30
InDet::TRT_SegmentsToTrack::m_combineSegments
bool m_combineSegments
Try to combine segments from Barrel and Endcap.
Definition: TRT_SegmentsToTrack.h:122
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
EventPrimitives.h
Trk::SurfaceType::Perigee
@ Perigee
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
Trk::FitQuality::uniqueClone
std::unique_ptr< FitQuality > uniqueClone() const
NVI uniqueClone.
RIO_OnTrack.h
Trk::nonInteracting
@ nonInteracting
Definition: ParticleHypothesis.h:25
InDet::TRT_SegmentsToTrack::m_minTRTHits
int m_minTRTHits
All tracks with less Hits (after the track fit) will be thrown away.
Definition: TRT_SegmentsToTrack.h:100
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Trk::MeasurementBase::globalPosition
virtual const Amg::Vector3D & globalPosition() const =0
Interface method to get the global Position.
InDet::TRT_SegmentsToTrack::getNoiseProbability
double getNoiseProbability(const Trk::Track *track) const
Get the fraction of noise TRT hits on this Track.
Definition: TRT_SegmentsToTrack.cxx:534
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InDet::TRT_SegmentsToTrack::m_noiseratio
double m_noiseratio
average percentage of noise in real tracks
Definition: TRT_SegmentsToTrack.h:112
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
InDet::TRT_SegmentsToTrack::m_events
std::atomic< int > m_events
Event counter.
Definition: TRT_SegmentsToTrack.h:114
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
InDet::TRT_SegmentsToTrack::m_n_combined_fit
std::atomic< int > m_n_combined_fit
Definition: TRT_SegmentsToTrack.h:129
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
DeMoScan.index
string index
Definition: DeMoScan.py:362
InDet::TRT_SegmentsToTrack::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
Definition: TRT_SegmentsToTrack.h:89
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
InDet::TRT_SegmentsToTrack::execute
StatusCode execute()
Definition: TRT_SegmentsToTrack.cxx:137
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
Trk::RIO_OnTrack::identify
virtual Identifier identify() const final
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:155
Trk::TrackStateOnSurface::Scatterer
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
Definition: TrackStateOnSurface.h:113
InDet::TRT_SegmentsToTrack::m_inputAssoMapName
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_inputAssoMapName
key to be set to optionally store PRD to track association map
Definition: TRT_SegmentsToTrack.h:96
PRD_MultiTruthCollection.h
Trk::MeasurementBaseType::PseudoMeasurementOnTrack
@ PseudoMeasurementOnTrack
Definition: MeasurementBase.h:51
Trk::FitQuality::chiSquared
double chiSquared() const
returns the of the overall track fit
Definition: FitQuality.h:56
InDet::TRT_SegmentsToTrack::combineSegments
void combineSegments(const EventContext &ctx) const
Definition: TRT_SegmentsToTrack.cxx:573
Trk::phi
@ phi
Definition: ParamDefs.h:81
Trk::FitQuality::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
InDet::TRT_SegmentsToTrack::initialize
StatusCode initialize()
Definition: TRT_SegmentsToTrack.cxx:76
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
ReadHandle.h
Handle class for reading from StoreGate.
InDet::TRT_SegmentsToTrack::m_BECCollectionName
SG::WriteHandleKey< TrackCollection > m_BECCollectionName
Name of the combined (TRT Barrel+EC) TrackCollection to write out.
Definition: TRT_SegmentsToTrack.h:127
TRT_SegmentsToTrack.h
InDet::TRT_SegmentsToTrack::m_MapFake
std::map< int, int > m_MapFake
Map of hits and fake tracks.
Definition: TRT_SegmentsToTrack.h:116
InDet::TRT_SegmentsToTrack::m_assoMapName
SG::WriteHandleKey< Trk::PRDtoTrackMap > m_assoMapName
key for the PRDtoTrackMap to filled by the ambiguity score processor.
Definition: TRT_SegmentsToTrack.h:94
InDet::TRT_SegmentsToTrack::m_inputSegmentCollectionName
SG::ReadHandleKey< Trk::SegmentCollection > m_inputSegmentCollectionName
Name of the TrackSegment Collection to read in.
Definition: TRT_SegmentsToTrack.h:78
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
SegmentCollection.h
TrackStateOnSurface.h
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
Trk::StraightLineSurface
Definition: StraightLineSurface.h:51
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
InDet::TRT_SegmentsToTrack::m_outlierRemoval
bool m_outlierRemoval
Flag to switch on the outlier removal in the track fitter.
Definition: TRT_SegmentsToTrack.h:119
InDet::TRT_SegmentsToTrack::m_nTracksReal
int m_nTracksReal
Counter for real reconstructed Tracks.
Definition: TRT_SegmentsToTrack.h:109
Trk::AtaStraightLine
ParametersT< 5, Charged, StraightLineSurface > AtaStraightLine
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:31