ATLAS Offline Software
Loading...
Searching...
No Matches
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.
MsgStream & operator<< (MsgStream &m, const TrigMuonEFInfo &d)
 Helper operator for printing the object.
bool operator== (const TrigMuonEFInfo &a, const TrigMuonEFInfo &b)
 Operator comparing two TrigMuonEFInfo objects for equality.
bool operator!= (const TrigMuonEFInfo &a, const TrigMuonEFInfo &b)
 Operator comparing two TrigMuonEFInfo objects for inequality.
void diff (const TrigMuonEFInfo &a, const TrigMuonEFInfo &b, std::map< std::string, double > &variableChange)
 Comparison with feedback.

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}
static Double_t a
void diff(const TrigMuonEFInfo &a, const TrigMuonEFInfo &b, std::map< std::string, double > &variableChange)
Comparison with feedback.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
iterator erase(iterator position)
Remove element at a given position.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts

◆ 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}
bool empty() const noexcept
Returns true if the collection is empty.

◆ 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}
static Double_t ss