ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | List of all members
Muon::CompareMuonSegmentKeys Struct Reference

#include <CompareMuonSegmentKeys.h>

Collaboration diagram for Muon::CompareMuonSegmentKeys:

Public Types

enum  OverlapResult {
  Identical = 0, SubSet = 1, SuperSet = 2, PartialOverlap = 3,
  NoOverlap = 4, Unknown = 5
}
 enum for the overlap result More...
 

Public Member Functions

OverlapResult operator() (const MuonSegmentKey &sk1, const MuonSegmentKey &sk2, bool ignoreTriggerHits=false)
 calculate overlap between two SegmentKey2s, if ignoreTriggerHits == true trigger hits will not be included in the comparison, returns an OverlapResult More...
 
std::string print (const OverlapResult &result) const
 print result to string More...
 

Public Attributes

unsigned int intersectionSize
 
unsigned int segment1Size
 
unsigned int segment2Size
 
unsigned int segment1SizeTrigger
 
unsigned int segment2SizeTrigger
 
unsigned int intersectionSizeTrigger
 

Detailed Description

Definition at line 14 of file CompareMuonSegmentKeys.h.

Member Enumeration Documentation

◆ OverlapResult

enum for the overlap result

Enumerator
Identical 
SubSet 
SuperSet 
PartialOverlap 
NoOverlap 
Unknown 

Definition at line 16 of file CompareMuonSegmentKeys.h.

16  {
17  Identical = 0, //<! segments are identical
18  SubSet = 1, //<! the first segment is a subset of the second
19  SuperSet = 2, //<! the first segment is a superset of the second
20  PartialOverlap = 3, //<! some hits of the segment overlap
21  NoOverlap = 4, //<! there is no overlap between the segments
22  Unknown = 5 //<! unknown overlap tyep, this should not happen
23  };

Member Function Documentation

◆ operator()()

Muon::CompareMuonSegmentKeys::OverlapResult Muon::CompareMuonSegmentKeys::operator() ( const MuonSegmentKey sk1,
const MuonSegmentKey sk2,
bool  ignoreTriggerHits = false 
)

calculate overlap between two SegmentKey2s, if ignoreTriggerHits == true trigger hits will not be included in the comparison, returns an OverlapResult

Definition at line 14 of file CompareMuonSegmentKeys.cxx.

16  {
17  std::vector<std::pair<unsigned int, int> > intersection;
18  std::set_intersection(sk1.keys().begin(), sk1.keys().end(), sk2.keys().begin(), sk2.keys().end(), std::back_inserter(intersection));
20  segment1Size = sk1.keys().size();
21  segment2Size = sk2.keys().size();
22 
23  segment1SizeTrigger = sk1.keysTrigger().size();
24  segment2SizeTrigger = sk2.keysTrigger().size();
25  std::vector<std::pair<unsigned int, int> > intersectionTrig;
26  std::set_intersection(sk1.keysTrigger().begin(), sk1.keysTrigger().end(), sk2.keysTrigger().begin(), sk2.keysTrigger().end(),
27  std::back_inserter(intersectionTrig));
28  intersectionSizeTrigger = intersectionTrig.size();
29 
30  if (intersectionSize == 0) {
31  if (segment1Size == 0 && segment2Size == 0) {
33  // overlap between second segment and the intersection also includes all hits
34  // the two segments share all hits
36  return Identical;
38  return SuperSet;
39  } else {
40  return SubSet;
41  }
44  } else {
45  return PartialOverlap;
46  }
47  }
48  return NoOverlap;
49  } else {
50  // overlap between first segment and the intersection includes all hits
52  // overlap between second segment and the intersection also includes all hits
53  // the two segments share all hits
55  if (ignoreTriggerHits) return Identical;
56 
58  // overlap between second segment and the intersection also includes all hits
59  // the two segments share all hits
61  return Identical;
63  return SuperSet;
64  } else {
65  return SubSet;
66  }
69  } else {
70  return PartialOverlap;
71  }
72  } else if (segment2Size > intersectionSize) {
73  return SubSet;
74  }
75  } else if (segment2Size == intersectionSize) {
77  // the first segment has more hits and is better
78  return SuperSet;
79  }
80  } else {
81  return PartialOverlap;
82  }
83  }
85 }

◆ print()

std::string Muon::CompareMuonSegmentKeys::print ( const OverlapResult result) const

print result to string

Definition at line 87 of file CompareMuonSegmentKeys.cxx.

87  {
88  std::ostringstream sout;
89 
90  if (result == Identical)
91  sout << "Identical";
92  else if (result == SubSet)
93  sout << "SubSet";
94  else if (result == SuperSet)
95  sout << "SuperSet";
96  else if (result == PartialOverlap)
97  sout << "PartialOverlap";
98  else if (result == NoOverlap)
99  sout << "NoOverlap";
100  else if (result == Unknown)
101  sout << "Unknown";
102  else
103  sout << "UnknownType";
104  sout << " intersects (" << intersectionSize << "," << intersectionSizeTrigger << ") seg1 (" << segment1Size << ","
105  << segment1SizeTrigger << ") "
106  << " seg2 (" << segment2Size << "," << segment2SizeTrigger << ") ";
107  return sout.str();
108 }

Member Data Documentation

◆ intersectionSize

unsigned int Muon::CompareMuonSegmentKeys::intersectionSize

Definition at line 32 of file CompareMuonSegmentKeys.h.

◆ intersectionSizeTrigger

unsigned int Muon::CompareMuonSegmentKeys::intersectionSizeTrigger

Definition at line 38 of file CompareMuonSegmentKeys.h.

◆ segment1Size

unsigned int Muon::CompareMuonSegmentKeys::segment1Size

Definition at line 33 of file CompareMuonSegmentKeys.h.

◆ segment1SizeTrigger

unsigned int Muon::CompareMuonSegmentKeys::segment1SizeTrigger

Definition at line 36 of file CompareMuonSegmentKeys.h.

◆ segment2Size

unsigned int Muon::CompareMuonSegmentKeys::segment2Size

Definition at line 34 of file CompareMuonSegmentKeys.h.

◆ segment2SizeTrigger

unsigned int Muon::CompareMuonSegmentKeys::segment2SizeTrigger

Definition at line 37 of file CompareMuonSegmentKeys.h.


The documentation for this struct was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
Muon::CompareMuonSegmentKeys::PartialOverlap
@ PartialOverlap
Definition: CompareMuonSegmentKeys.h:20
Muon::CompareMuonSegmentKeys::SubSet
@ SubSet
Definition: CompareMuonSegmentKeys.h:18
Muon::CompareMuonSegmentKeys::segment1SizeTrigger
unsigned int segment1SizeTrigger
Definition: CompareMuonSegmentKeys.h:36
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition: compareFlatTrees.cxx:25
Muon::CompareMuonSegmentKeys::segment1Size
unsigned int segment1Size
Definition: CompareMuonSegmentKeys.h:33
Muon::CompareMuonSegmentKeys::intersectionSizeTrigger
unsigned int intersectionSizeTrigger
Definition: CompareMuonSegmentKeys.h:38
Muon::CompareMuonSegmentKeys::segment2SizeTrigger
unsigned int segment2SizeTrigger
Definition: CompareMuonSegmentKeys.h:37
Muon::CompareMuonSegmentKeys::Identical
@ Identical
Definition: CompareMuonSegmentKeys.h:17
Muon::CompareMuonSegmentKeys::segment2Size
unsigned int segment2Size
Definition: CompareMuonSegmentKeys.h:34
Muon::CompareMuonSegmentKeys::Unknown
@ Unknown
Definition: CompareMuonSegmentKeys.h:22
Muon::CompareMuonSegmentKeys::NoOverlap
@ NoOverlap
Definition: CompareMuonSegmentKeys.h:21
Muon::CompareMuonSegmentKeys::intersectionSize
unsigned int intersectionSize
Definition: CompareMuonSegmentKeys.h:32
Muon::CompareMuonSegmentKeys::SuperSet
@ SuperSet
Definition: CompareMuonSegmentKeys.h:19
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.