ATLAS Offline Software
Classes | Functions
TrigMuonEFInfo.h File Reference
#include <map>
#include <string>
#include "AthenaKernel/CLASS_DEF.h"
Include dependency graph for TrigMuonEFInfo.h:

Go to the source code of this file.

Classes

class  TrigMuonEFInfo
 

Functions

std::string str (const TrigMuonEFInfo &d)
 Helper function for printing the object. More...
 
MsgStream & operator<< (MsgStream &m, const TrigMuonEFInfo &d)
 Helper operator for printing the object. More...
 
bool operator== (const TrigMuonEFInfo &a, const TrigMuonEFInfo &b)
 Operator comparing two TrigMuonEFInfo objects for equality. More...
 
bool operator!= (const TrigMuonEFInfo &a, const TrigMuonEFInfo &b)
 Operator comparing two TrigMuonEFInfo objects for inequality. More...
 
void diff (const TrigMuonEFInfo &a, const TrigMuonEFInfo &b, std::map< std::string, double > &variableChange)
 Comparison with feedback. More...
 

Function Documentation

◆ diff()

void diff ( const TrigMuonEFInfo a,
const TrigMuonEFInfo b,
std::map< std::string, double > &  variableChange 
)

Comparison with feedback.

Definition at line 499 of file TrigMuonEFInfo.cxx.

500  {
501 
502  if( a.RoINum() != b.RoINum() ) {
503  variableChange[ "RoINum" ] = static_cast< double >( a.RoINum() - b.RoINum() );
504  }
505  if( a.NSegments() != b.NSegments() ) {
506  variableChange[ "NSegments" ] = static_cast< double >( a.NSegments() -
507  b.NSegments() );
508  }
509  if( a.NMdtHits() != b.NMdtHits() ) {
510  variableChange[ "NMdtHits" ] = static_cast< double >( a.NMdtHits() -
511  b.NMdtHits() );
512  }
513  if( a.NRpcHits() != b.NRpcHits() ) {
514  variableChange[ "NRpcHits" ] = static_cast< double >( a.NRpcHits() -
515  b.NRpcHits() );
516  }
517  if( a.NCscHits() != b.NCscHits() ) {
518  variableChange[ "NCscHits" ] = static_cast< double >( a.NCscHits() -
519  b.NCscHits() );
520  }
521  if( a.NTgcHits() != b.NTgcHits() ) {
522  variableChange[ "NTgcHits" ] = static_cast< double >( a.NTgcHits() -
523  b.NTgcHits() );
524  }
525  if( a.EtaPreviousLevel() != b.EtaPreviousLevel() ) {
526  variableChange[ "EtaPreviousLevel" ] = static_cast< double >( a.EtaPreviousLevel() -
527  b.EtaPreviousLevel() );
528  }
529  if( a.PhiPreviousLevel() != b.PhiPreviousLevel() ) {
530  variableChange[ "PhiPreviousLevel" ] = static_cast< double >( a.PhiPreviousLevel() -
531  b.PhiPreviousLevel() );
532  }
533  // simple check on number of tracks in container
534  if (
535  (a.hasTrack() && b.hasTrack())
536  &&
537  (a.TrackContainer()->size() != b.TrackContainer()->size())
538  ) {
539  variableChange[ "NTracks" ] = static_cast< double >(a.TrackContainer()->size() -
540  b.TrackContainer()->size() );
541  }
542  // make a view copy of container B to rm later on elements which matched to
543  // elements of container A so we don't modify container B
545  *tmpContB = *(b.TrackContainer());
546 
547  for (
548  TrigMuonEFInfoTrackContainer::const_iterator TrkItrA = a.TrackContainer()->begin();
549  TrkItrA != a.TrackContainer()->end();
550  ++TrkItrA
551  )
552  {
553  // find match in containerB
554  TrigMuonEFInfoTrackContainer::iterator TrkItrB = tmpContB->begin();
555  while ( TrkItrB != tmpContB->end() ) {
556 
557  if (*(*TrkItrB)==*(*TrkItrA)) {
558  // if match rm element from tmp container, diff, and break loop
559  diff( *( (*TrkItrA)->SpectrometerTrack() ), *( (*TrkItrB)->SpectrometerTrack() ), variableChange );
560  diff( *( (*TrkItrA)->ExtrapolatedTrack() ), *( (*TrkItrB)->ExtrapolatedTrack() ), variableChange );
561  diff( *( (*TrkItrA)->CombinedTrack() ), *( (*TrkItrB)->CombinedTrack() ), variableChange );
562  tmpContB->erase(TrkItrB);
563  break;
564  }
565  ++TrkItrB;
566  }
567  }
568  // clean up
569  delete tmpContB;
570 
571  if (a.hasLegacyTrack() && b.hasLegacyTrack()) {
572  diff( *( a.legacySpectrometerTrack() ), *( b.legacySpectrometerTrack() ), variableChange );
573  diff( *( a.legacyExtrapolatedTrack() ), *( b.legacyExtrapolatedTrack() ), variableChange );
574  diff( *( a.legacyCombinedTrack() ), *( b.legacyCombinedTrack() ), variableChange );
575  }
576 
577  return;
578 }

◆ operator!=()

bool operator!= ( const TrigMuonEFInfo a,
const TrigMuonEFInfo b 
)
inline

Operator comparing two TrigMuonEFInfo objects for inequality.

Definition at line 138 of file TrigMuonEFInfo.h.

138  {
139  return !( a == b );
140 }

◆ operator<<()

MsgStream& operator<< ( MsgStream &  m,
const TrigMuonEFInfo d 
)

Helper operator for printing the object.

Definition at line 434 of file TrigMuonEFInfo.cxx.

434  {
435 
436  return ( m << str( d ) );
437 }

◆ operator==()

bool operator== ( const TrigMuonEFInfo a,
const TrigMuonEFInfo b 
)

Operator comparing two TrigMuonEFInfo objects for equality.

Definition at line 439 of file TrigMuonEFInfo.cxx.

439  {
440 
441  if ( a.RoINum() != b.RoINum() )
442  return false;
443  if ( a.hasTrack() != b.hasTrack() )
444  return false;
445  if (a.hasTrack() && b.hasTrack() ) {
446  // simple check for the number of entries in container:
447  if ( a.TrackContainer()->size() != b.TrackContainer()->size() )
448  {
449  return false;
450  }
451  // sort container?
452  // unfortunately sort() of DataVector just sorts by pointer value,
453  // so really useless here....
454  // policy: make a copy of container B (tmpContB) and loop over container A
455  // for every match rm element from tmpContB.
456  // at the end check whether tmpContB is empty -> condition for equality
457 
458  // make a view copy of container B to rm later on elements which matched to
459  // elements of container A so we don't modify container B
461  *tmpContB = *(b.TrackContainer());
462  for (
463  TrigMuonEFInfoTrackContainer::const_iterator TrkItrA = a.TrackContainer()->begin();
464  TrkItrA != a.TrackContainer()->end();
465  ++TrkItrA
466  )
467  {
468  // find match in containerB
469  TrigMuonEFInfoTrackContainer::iterator TrkItrB = tmpContB->begin();
470  while ( TrkItrB != tmpContB->end() ) {
471  if (*(*TrkItrB)==*(*TrkItrA)) {
472  // if match rm element from tmp container and break loop
473  tmpContB->erase(TrkItrB);
474  break;
475  }
476  ++TrkItrB;
477  }
478  }
479 
480  // if all elements were matched tmp container must be empty
481  bool result = tmpContB->empty();
482  // delete tmp container
483  delete tmpContB;
484  // check result
485  if(!result) return false;
486  }
487  if (a.hasLegacyTrack() && b.hasLegacyTrack()) {
488  if( !(*( a.legacySpectrometerTrack() ) == *( b.legacySpectrometerTrack() ) ) )
489  return false;
490  if( !(*( a.legacyExtrapolatedTrack() ) == *( b.legacyExtrapolatedTrack() ) ) )
491  return false;
492  if( !(*( a.legacyCombinedTrack() ) == *( b.legacyCombinedTrack() ) ) )
493  return false;
494 
495  }
496  return true;
497 }

◆ str()

std::string str ( const TrigMuonEFInfo d)

Helper function for printing the object.

Definition at line 399 of file TrigMuonEFInfo.cxx.

399  {
400  std::stringstream ss;
401  ss << "RoI index: " << d.RoINum()
402  << "; NSegments: " << d.NSegments()
403  << "; NMdtHits: " << d.NMdtHits()
404  << "; NRpcHits: " << d.NRpcHits()
405  << "; NTgcHits: " << d.NTgcHits()
406  << "; NCscHits: " << d.NCscHits()
407  << "; hasTrack: " << d.hasTrack() << std::endl;
408 
409  if (d.hasTrack()) {
410 
411  // find match in containerB
412  for (const TrigMuonEFInfoTrack* dd : *d.TrackContainer()) {
413  if (dd) {
414 
415  ss << "; muon type: " << dd->MuonType();
416 
417  if (dd->hasSpectrometerTrack())
418  ss << "; spectrometer track: " << dd->SpectrometerTrack()
419  << " : " << *(dd->SpectrometerTrack());
420 
421  if (dd->hasExtrapolatedTrack())
422  ss << "; extrapolated track: " << dd->ExtrapolatedTrack()
423  << " : " << *(dd->ExtrapolatedTrack());
424 
425  if (dd->hasCombinedTrack())
426  ss << "; combined track: " << dd->CombinedTrack()
427  << " : " << *(dd->CombinedTrack());
428  }
429  }
430  }
431  return ss.str();
432 }
str
std::string str(const TrigMuonEFInfo &d)
Helper function for printing the object.
Definition: TrigMuonEFInfo.cxx:399
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
get_generator_info.result
result
Definition: get_generator_info.py:21
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
hist_file_dump.d
d
Definition: hist_file_dump.py:137
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
diff
void diff(const TrigMuonEFInfo &a, const TrigMuonEFInfo &b, std::map< std::string, double > &variableChange)
Comparison with feedback.
Definition: TrigMuonEFInfo.cxx:499
TrigMuonEFInfoTrackContainer
Definition: TrigMuonEFInfoTrackContainer.h:27
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
library_scraper.dd
list dd
Definition: library_scraper.py:46
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TrigMuonEFInfoTrack
Definition: TrigMuonEFInfoTrack.h:22
a
TList * a
Definition: liststreamerinfos.cxx:10
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.