ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PRDTrackSegmentHelper::Imp Class Reference
Collaboration diagram for PRDTrackSegmentHelper::Imp:

Public Member Functions

void addTrackToPRDs (const Trk::Track *, bool outliers)
 
void removeTrackFromPRDs (const Trk::Track *, bool outliers)
 
void updateMaterialOfPRDs (const Trk::Track *, bool outliers)
 
void addSegmentToPRDs (const Trk::Segment *)
 
void removeSegmentFromPRDs (const Trk::Segment *)
 
void updateMaterialOfPRDs (const Trk::Segment *)
 
template<class T >
void removeEntryFromVector (std::vector< T * > &v, T *t)
 

Static Public Member Functions

static std::vector< const Trk::PrepRawData * > measurementToPRDs (const Trk::MeasurementBase *)
 

Public Attributes

PRDTrackSegmentHelpertheclass = nullptr
 
std::map< const Trk::PrepRawData *, QList< PRDHandleBase * > > * prd2handles = nullptr
 
std::map< const Trk::Track *, const SoMaterial * > tracks2mat
 
std::map< const Trk::Segment *, const SoMaterial * > segments2mat
 
std::map< const Trk::PrepRawData *, TracksAndSegmentsprdsOnTracksAndSegments
 

Detailed Description

Definition at line 29 of file PRDTrackSegmentHelper.cxx.

Member Function Documentation

◆ addSegmentToPRDs()

void PRDTrackSegmentHelper::Imp::addSegmentToPRDs ( const Trk::Segment seg)

Definition at line 254 of file PRDTrackSegmentHelper.cxx.

255 {
256  // if (verbose())
257  // theclass->messageVerbose("addSegmentToPRDs start");
258  if (!seg) {
259  theclass->message("ERROR: Received null segment pointer!");
260  return;
261  }
263  std::map< const Trk::PrepRawData *, QList<PRDHandleBase *> >::const_iterator itHandle, itHandleEnd(prd2handles->end());
264  std::vector<const Trk::MeasurementBase*>::const_iterator
265  it (seg->containedMeasurements().begin()), itE(seg->containedMeasurements().end());
266  const Trk::PrepRawData * prd;
267  for (;it!=itE;++it) {
268  std::vector<const Trk::PrepRawData*> prds = Imp::measurementToPRDs(*it); // need to handle compound measurements too.
269  std::vector<const Trk::PrepRawData*>::const_iterator itPrd = prds.begin(), itEnd=prds.end();
270  for (;itPrd!=itEnd;++itPrd){
271  prd = *itPrd;
272  itInfo = prdsOnTracksAndSegments.find(prd);
273  if (itInfo==prdsOnTracksAndSegments.end()) {
274  prdsOnTracksAndSegments.insert(std::pair<const Trk::PrepRawData*,TracksAndSegments>(prd,
275  TracksAndSegments(std::vector<const Trk::Track*>(),
276  std::vector<const Trk::Track*>(),
277  std::vector< const Trk::Segment* >(1,seg))));
278 
279  } else {
280  itInfo->second.segments.push_back(seg);
281  }
282  itHandle = prd2handles->find(prd);
283  if (itHandle!=itHandleEnd) {
284  QList<PRDHandleBase*> handles = itHandle->second;
285  for (PRDHandleBase*handle : handles)
286  if (handle->collHandle()->colourBySegments())
287  handle->updateMaterial();
288  }
289 
290  }
291  }
292  // theclass->messageVerbose("addSegmentToPRDs end");
293 }

◆ addTrackToPRDs()

void PRDTrackSegmentHelper::Imp::addTrackToPRDs ( const Trk::Track trk,
bool  outliers 
)

Definition at line 365 of file PRDTrackSegmentHelper.cxx.

366 {
367  // if (verbose())
368  // theclass->messageVerbose("addTrackToPRDs start");
369  if (!trk) {
370  theclass->message("ERROR: Received null track pointer!");
371  return;
372  }
374  std::map< const Trk::PrepRawData *, QList<PRDHandleBase *> >::const_iterator itHandle, itHandleEnd(prd2handles->end());
376  it ( outliers ? trk->outliersOnTrack()->begin() : trk->measurementsOnTrack()->begin() ),
377  itE( outliers ? trk->outliersOnTrack()->end() : trk->measurementsOnTrack()->end() );
378  const Trk::PrepRawData * prd;
379  for (;it!=itE;++it) {
380  std::vector<const Trk::PrepRawData*> prds = Imp::measurementToPRDs(*it); // need to handle compound measurements too.
381  std::vector<const Trk::PrepRawData*>::const_iterator itPrd = prds.begin(), itEnd=prds.end();
382  for (;itPrd!=itEnd;++itPrd){
383  prd = *itPrd;
384  if (prd) {
385  itInfo = prdsOnTracksAndSegments.find(prd);
386  if (itInfo==prdsOnTracksAndSegments.end()) {
387  prdsOnTracksAndSegments.insert(std::pair<const Trk::PrepRawData*,TracksAndSegments>(prd,
388  TracksAndSegments((outliers?std::vector<const Trk::Track*>():std::vector<const Trk::Track*>(1,trk)),
389  (outliers?std::vector<const Trk::Track*>(1,trk):std::vector<const Trk::Track*>()),
390  std::vector< const Trk::Segment* >())));
391  } else {
392  if (outliers)
393  itInfo->second.tracks_outliers.push_back(trk);
394  else
395  itInfo->second.tracks.push_back(trk);
396  }
397  itHandle = prd2handles->find(prd);
398  if (itHandle!=itHandleEnd) {
399  QList<PRDHandleBase*> handles = itHandle->second;
400  for (PRDHandleBase*handle : handles)
401  if (handle->collHandle()->colourByTracks())
402  handle->updateMaterial();
403  }
404  }
405  }
406  }
407  // if (verbose())
408  // theclass->messageVerbose("addTrackToPRDs end");
409 }

◆ measurementToPRDs()

std::vector< const Trk::PrepRawData * > PRDTrackSegmentHelper::Imp::measurementToPRDs ( const Trk::MeasurementBase measbase)
inlinestatic

Definition at line 491 of file PRDTrackSegmentHelper.cxx.

492 {
493  std::vector<const Trk::PrepRawData *>prds;
494  const Trk::RIO_OnTrack * rio = dynamic_cast<const Trk::RIO_OnTrack *>(measbase);
495  if (rio) prds.push_back( rio->prepRawData() );
496  const Trk::CompetingRIOsOnTrack * crot = dynamic_cast<const Trk::CompetingRIOsOnTrack *>(measbase);
497  if (crot) {
498 
499  // for (unsigned int i=0; i< crot->numberOfContainedROTs (); ++i) prds.push_back( crot->rioOnTrack(i) ? crot->rioOnTrack(i)->prepRawData() : 0 );
500  for (unsigned int i=0; i< crot->numberOfContainedROTs (); ++i) {
501  if (crot->rioOnTrack(i).identify().getString() != "") { // FIXME: search for a better way to see if the rioOnTrack is present
502  prds.push_back(crot->rioOnTrack(i).prepRawData());
503  }
504  else {
505  prds.push_back(0);
506  }
507  }
508  }
509  return prds;
510 }

◆ removeEntryFromVector()

template<class T >
void PRDTrackSegmentHelper::Imp::removeEntryFromVector ( std::vector< T * > &  v,
T *  t 
)

Definition at line 65 of file PRDTrackSegmentHelper.cxx.

66 {
67  const unsigned n(v.size());
68  for (unsigned i(0); i<n;++i) {
69  if (v[i]==t) {
70  if (i==n-1) {
71  v.resize(n-1);
72  return;
73  } else {
74  v[i]=v[n-1];
75  v.resize(n-1);
76  return;
77  }
78  }
79  }
80 }

◆ removeSegmentFromPRDs()

void PRDTrackSegmentHelper::Imp::removeSegmentFromPRDs ( const Trk::Segment seg)

Definition at line 296 of file PRDTrackSegmentHelper.cxx.

297 {
298  // if (verbose())
299  // theclass->messageVerbose("removeSegmentFromPRDs start");
300  if (!seg) {
301  theclass->message("ERROR: Received null segment pointer!");
302  return;
303  }
305  std::map< const Trk::PrepRawData *, QList<PRDHandleBase *> >::const_iterator itHandle, itHandleEnd(prd2handles->end());
306  std::vector<const Trk::MeasurementBase*>::const_iterator
307  it (seg->containedMeasurements().begin()), itE(seg->containedMeasurements().end());
308  const Trk::PrepRawData * prd;
309  for (;it!=itE;++it) {
310  std::vector<const Trk::PrepRawData*> prds = Imp::measurementToPRDs(*it); // need to handle compound measurements too.
311  std::vector<const Trk::PrepRawData*>::const_iterator itPrd = prds.begin(), itEnd=prds.end();
312  for (;itPrd!=itEnd;++itPrd){
313  prd = *itPrd;
314  itInfo = prdsOnTracksAndSegments.find(prd);
315  if (itInfo!=prdsOnTracksAndSegments.end()) {
316  removeEntryFromVector(itInfo->second.segments,seg);
317  itHandle = prd2handles->find(prd);
318  if (itHandle!=itHandleEnd) {
319  QList<PRDHandleBase*> handles = itHandle->second;
320  for (PRDHandleBase*handle : handles)
321  if (handle->collHandle()->colourBySegments())
322  handle->updateMaterial();
323  }
324  }
325  }
326  }
327 
328  // if (verbose())
329  // theclass->messageVerbose("removeSegmentToPRDs end");
330 }

◆ removeTrackFromPRDs()

void PRDTrackSegmentHelper::Imp::removeTrackFromPRDs ( const Trk::Track trk,
bool  outliers 
)

Definition at line 412 of file PRDTrackSegmentHelper.cxx.

413 {
414  // if (verbose())
415  // theclass->messageVerbose("removeTrackFromPRDs start");
416  if (!trk) {
417  theclass->message("ERROR: Received null track pointer!");
418  return;
419  }
421  std::map< const Trk::PrepRawData *, QList<PRDHandleBase *> >::const_iterator itHandle, itHandleEnd(prd2handles->end());
423  it ( outliers ? trk->outliersOnTrack()->begin() : trk->measurementsOnTrack()->begin() ),
424  itE( outliers ? trk->outliersOnTrack()->end() : trk->measurementsOnTrack()->end() );
425  const Trk::PrepRawData * prd;
426  for (;it!=itE;++it) {
427  std::vector<const Trk::PrepRawData*> prds = Imp::measurementToPRDs(*it); // need to handle compound measurements too.
428  std::vector<const Trk::PrepRawData*>::const_iterator itPrd = prds.begin(), itEnd=prds.end();
429  for (;itPrd!=itEnd;++itPrd){
430  prd = *itPrd;
431  itInfo = prdsOnTracksAndSegments.find(prd);
432  if (itInfo!=prdsOnTracksAndSegments.end()) {
433  removeEntryFromVector((outliers?itInfo->second.tracks_outliers:itInfo->second.tracks),trk);
434  itHandle = prd2handles->find(prd);
435  if (itHandle!=itHandleEnd) {
436  QList<PRDHandleBase*> handles = itHandle->second;
437  for (PRDHandleBase*handle : handles)
438  if (handle->collHandle()->colourByTracks())
439  handle->updateMaterial();
440  }
441  }
442  }
443  }
444 
445  // if (verbose())
446  // theclass->messageVerbose("removeTrackToPRDs end");
447 }

◆ updateMaterialOfPRDs() [1/2]

void PRDTrackSegmentHelper::Imp::updateMaterialOfPRDs ( const Trk::Segment seg)

Definition at line 333 of file PRDTrackSegmentHelper.cxx.

334 {
335  // if (verbose())
336  // theclass->messageVerbose("updateMaterialOfPRDs(segment) start");
337  if (!seg) {
338  theclass->message("ERROR: Received null segment pointer!");
339  return;
340  }
341  std::map< const Trk::PrepRawData *, QList<PRDHandleBase *> >::const_iterator itHandle, itHandleEnd(prd2handles->end());
342  std::vector<const Trk::MeasurementBase*>::const_iterator
343  it (seg->containedMeasurements().begin()), itE(seg->containedMeasurements().end());
344  const Trk::PrepRawData * prd;
345  for (;it!=itE;++it) {
346  std::vector<const Trk::PrepRawData*> prds = Imp::measurementToPRDs(*it); // need to handle compound measurements too.
347  std::vector<const Trk::PrepRawData*>::const_iterator itPrd = prds.begin(), itEnd=prds.end();
348  for (;itPrd!=itEnd;++itPrd){
349  prd = *itPrd;
350  itHandle = prd2handles->find(prd);
351  if (itHandle!=itHandleEnd) {
352  QList<PRDHandleBase*> handles = itHandle->second;
353  for (PRDHandleBase*handle : handles)
354  if (handle->collHandle()->colourByTracks())
355  handle->updateMaterial();
356  }
357  }
358  }
359 
360  // if (verbose())
361  // theclass->messageVerbose("updateMaterialOfPRDs(segment) end");
362 }

◆ updateMaterialOfPRDs() [2/2]

void PRDTrackSegmentHelper::Imp::updateMaterialOfPRDs ( const Trk::Track trk,
bool  outliers 
)

Definition at line 450 of file PRDTrackSegmentHelper.cxx.

451 {
452  // if (verbose())
453  // theclass->messageVerbose("updateMaterialOfPRDs(track) start");
454  if (!trk) {
455  theclass->message("ERROR: Received null track pointer!");
456  return;
457  }
458  std::map< const Trk::PrepRawData *, QList<PRDHandleBase *> >::const_iterator itHandle, itHandleEnd(prd2handles->end());
460  it ( outliers ? trk->outliersOnTrack()->begin() : trk->measurementsOnTrack()->begin() ),
461  itE( outliers ? trk->outliersOnTrack()->end() : trk->measurementsOnTrack()->end() );
462  const Trk::PrepRawData * prd;
463  for (;it!=itE;++it) {
464  std::vector<const Trk::PrepRawData*> prds = Imp::measurementToPRDs(*it); // need to handle compound measurements too.
465  std::vector<const Trk::PrepRawData*>::const_iterator itPrd = prds.begin(), itEnd=prds.end();
466  for (;itPrd!=itEnd;++itPrd){
467  prd = *itPrd;
468  itHandle = prd2handles->find(prd);
469  if (itHandle!=itHandleEnd) {
470  QList<PRDHandleBase*> handles = itHandle->second;
471  for (PRDHandleBase*handle : handles)
472  if (handle->collHandle()->colourByTracks())
473  handle->updateMaterial();
474  }
475  }
476  }
477 
478  // if (verbose())
479  // theclass->messageVerbose("updateMaterialOfPRDs(track) end");
480 }

Member Data Documentation

◆ prd2handles

std::map< const Trk::PrepRawData *, QList<PRDHandleBase *> >* PRDTrackSegmentHelper::Imp::prd2handles = nullptr

Definition at line 32 of file PRDTrackSegmentHelper.cxx.

◆ prdsOnTracksAndSegments

std::map< const Trk::PrepRawData*,TracksAndSegments > PRDTrackSegmentHelper::Imp::prdsOnTracksAndSegments

Definition at line 59 of file PRDTrackSegmentHelper.cxx.

◆ segments2mat

std::map< const Trk::Segment*, const SoMaterial* > PRDTrackSegmentHelper::Imp::segments2mat

Definition at line 35 of file PRDTrackSegmentHelper.cxx.

◆ theclass

PRDTrackSegmentHelper* PRDTrackSegmentHelper::Imp::theclass = nullptr

Definition at line 31 of file PRDTrackSegmentHelper.cxx.

◆ tracks2mat

std::map< const Trk::Track*, const SoMaterial* > PRDTrackSegmentHelper::Imp::tracks2mat

Definition at line 34 of file PRDTrackSegmentHelper.cxx.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TruthTest.itE
itE
Definition: TruthTest.py:25
Trk::CompetingRIOsOnTrack::rioOnTrack
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
Trk::CompetingRIOsOnTrack::numberOfContainedROTs
virtual unsigned int numberOfContainedROTs() const =0
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
Trk::Segment::containedMeasurements
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
Definition: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:166
Trk::CompetingRIOsOnTrack
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
Definition: CompetingRIOsOnTrack.h:64
PRDTrackSegmentHelper::Imp::theclass
PRDTrackSegmentHelper * theclass
Definition: PRDTrackSegmentHelper.cxx:31
PRDTrackSegmentHelper::Imp::prd2handles
std::map< const Trk::PrepRawData *, QList< PRDHandleBase * > > * prd2handles
Definition: PRDTrackSegmentHelper.cxx:32
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Trk::Track::outliersOnTrack
const DataVector< const MeasurementBase > * outliersOnTrack() const
return a pointer to a vector of MeasurementBase, which represent outliers (i.e.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:210
Trk::PrepRawData
Definition: PrepRawData.h:62
PRDTrackSegmentHelper::Imp::prdsOnTracksAndSegments
std::map< const Trk::PrepRawData *, TracksAndSegments > prdsOnTracksAndSegments
Definition: PRDTrackSegmentHelper.cxx:59
Trk::RIO_OnTrack::prepRawData
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
Trk::Track::measurementsOnTrack
const DataVector< const MeasurementBase > * measurementsOnTrack() const
return a pointer to a vector of MeasurementBase (NOT including any that come from outliers).
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:178
python.PyAthena.v
v
Definition: PyAthena.py:154
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
PRDTrackSegmentHelper::Imp::removeEntryFromVector
void removeEntryFromVector(std::vector< T * > &v, T *t)
Definition: PRDTrackSegmentHelper.cxx:65
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
PRDHandleBase
Definition: PRDHandleBase.h:35
PRDTrackSegmentHelper::Imp::measurementToPRDs
static std::vector< const Trk::PrepRawData * > measurementToPRDs(const Trk::MeasurementBase *)
Definition: PRDTrackSegmentHelper.cxx:491