ATLAS Offline Software
Loading...
Searching...
No Matches
InDetVertexTruthMatchUtils Namespace Reference

Typedefs

typedef std::tuple< ElementLink< xAOD::TruthEventBaseContainer >, float, float > VertexTruthMatchInfo

Enumerations

enum  VertexMatchType {
  MATCHED , MERGED , SPLIT , FAKE ,
  DUMMY , NTYPES
}
enum  HardScatterType {
  CLEAN , LOWPU , HIGHPU , HSSPLIT ,
  NONE , NHSTYPES
}

Functions

const xAOD::VertexbestHardScatterMatch (const xAOD::VertexContainer &vxContainer)
const std::vector< std::pair< const xAOD::Vertex *, size_t > > hardScatterMatches (const xAOD::VertexContainer &vxContainer)
HardScatterType classifyHardScatter (const xAOD::VertexContainer &vxContainer)

Typedef Documentation

◆ VertexTruthMatchInfo

Enumeration Type Documentation

◆ HardScatterType

Enumerator
CLEAN 
LOWPU 
HIGHPU 
HSSPLIT 
NONE 
NHSTYPES 

Definition at line 30 of file InDetVertexTruthMatchUtils.h.

◆ VertexMatchType

Enumerator
MATCHED 
MERGED 
SPLIT 
FAKE 
DUMMY 
NTYPES 

Definition at line 20 of file InDetVertexTruthMatchUtils.h.

20 {
21 MATCHED, // > threshold (default 70%) from one truth interaction
22 MERGED, // not matched
23 SPLIT, // highest weight truth interaction contributes to >1 vtx (vtx with highest fraction of sumpT2 remains matched/merged)
24 FAKE, // highest contribution is fake (if pile-up MC info not present those tracks end up as "fakes")
25 DUMMY, // is the dummy vertex
26 NTYPES // access to number of types
27};

Function Documentation

◆ bestHardScatterMatch()

const xAOD::Vertex * InDetVertexTruthMatchUtils::bestHardScatterMatch ( const xAOD::VertexContainer & vxContainer)

Definition at line 20 of file InDetVertexTruthMatchUtils.cxx.

20 {
21 //accessors for decorations
22 xAOD::Vertex::ConstAccessor<int> nHSTrkDecor("nHSTrk");
23
24 std::vector<std::pair<const xAOD::Vertex*, size_t> > allMatches = hardScatterMatches( vxContainer );
25
26 int bestNHSTrk = 0;
27 const xAOD::Vertex * best = nullptr;
28 for ( auto it : allMatches ) {
29 int nHSTrk = nHSTrkDecor( *(it.first) );
30 if( nHSTrk > bestNHSTrk ){
31 bestNHSTrk = nHSTrk;
32 best = it.first;
33 }
34 }
35
36 //if didn't find any matches will return 0
37 return best;
38}
SG::ConstAccessor< T, ALLOC > ConstAccessor
Helper class to provide type-safe access to aux data.
Definition AuxElement.h:131
const std::vector< std::pair< const xAOD::Vertex *, size_t > > hardScatterMatches(const xAOD::VertexContainer &vxContainer)
best(iterable, priorities=[3, 2, 1, -1, 0])
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ classifyHardScatter()

HardScatterType InDetVertexTruthMatchUtils::classifyHardScatter ( const xAOD::VertexContainer & vxContainer)

Definition at line 70 of file InDetVertexTruthMatchUtils.cxx.

70 {
71
72 // return a vector of reco vertices with contributions from the hard-scatter
73 // if the second element in the pair is zero, it means tracks from the hard-scatter
74 // contribute more weight to that reco vertex than any other interaction
75 std::vector<std::pair<const xAOD::Vertex*, size_t> > matches = hardScatterMatches( vxContainer );
76
77 // information indicating whether a given reco vertex is:
78 // MATCHED, MERGED, SPLIT or FAKE
79 xAOD::Vertex::Decorator<VertexMatchType> matchTypeDecor("VertexMatchType");
80
81 if ( matches.empty() ) {
82 // No reco vertices with tracks from hard-scatter
83 return NONE;
84 } else if ( matches.size() == 1 ) {
85 // A single reco vertex has tracks from hard-scatter
86 const VertexMatchType & type = matchTypeDecor( *(matches[0].first) );
87 //check if the index in the matching info for HS is first, then can assign clean/lowpu based on match/merge
88 if ( matches[0].second == 0 && type == MATCHED ) {
89 // HS made largest contribution and vertex matched
90 return CLEAN;
91 } else if ( matches[0].second == 0 && type == MERGED ) {
92 // HS made largest contribution and vertex merged
93 return LOWPU;
94 } else {
95 // HS did not make largest contribution or vertex is fake or vertex is part of non-HS split pair
96 return HIGHPU;
97 }
98
99 } else {
100 // multiple reco vertices have tracks from hard-scatter
101 // count how many have hard-scatter tracks as largest contribution
102 int num_main = 0;
103 const xAOD::Vertex* mainVtx = nullptr;
104 for ( auto it : matches ) {
105 if ( it.second == 0 ) // is hard-scatter the largest contribution?
106 {
107 num_main++;
108 mainVtx = it.first;
109 }
110 }
111 if (num_main == 0 ) {
112 return HIGHPU;
113 } else if (num_main == 1 ) {
114 const VertexMatchType& type = matchTypeDecor(*mainVtx);
115 if (type == MATCHED)
116 return CLEAN;
117 else if (type == MERGED)
118 return LOWPU;
119 else
120 return HIGHPU;
121 } else {
122 return HSSPLIT;
123 }
124 }
125
126 return NONE;
127}
SG::Decorator< T, ALLOC > Decorator
class to provide type-safe access to aux data.
Definition AuxElement.h:135

◆ hardScatterMatches()

const std::vector< std::pair< const xAOD::Vertex *, size_t > > InDetVertexTruthMatchUtils::hardScatterMatches ( const xAOD::VertexContainer & vxContainer)

Definition at line 41 of file InDetVertexTruthMatchUtils.cxx.

41 {
42 //accessors for decorations
43 xAOD::Vertex::ConstAccessor<std::vector<VertexTruthMatchInfo> > matchInfoDecor("TruthEventMatchingInfos");
44
45 //return vector
46 std::vector<std::pair<const xAOD::Vertex*, size_t> > result;
47
48 //loop and look
49 for ( auto vxit : vxContainer ) {
50 try{
51 const std::vector<VertexTruthMatchInfo> & info = matchInfoDecor( *vxit );
52 if (!matchInfoDecor.isAvailable(*vxit)){
53 return result;
54 }
55 for ( size_t i = 0; i < info.size(); ++i ) {
56 if ( isHardScatterEvent( std::get<0>(info[i]) ) ) {
57 result.emplace_back(vxit, i );
58 break;
59 }
60 }
61 }
62 catch (SG::ExcBadAuxVar &){
63 return result;
64 }
65
66 }
67 return result;
68}