ATLAS Offline Software
Typedefs | Enumerations | Functions
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

Definition at line 17 of file InDetVertexTruthMatchUtils.h.

Enumeration Type Documentation

◆ HardScatterType

Enumerator
CLEAN 
LOWPU 
HIGHPU 
HSSPLIT 
NONE 
NHSTYPES 

Definition at line 30 of file InDetVertexTruthMatchUtils.h.

30  {
31  CLEAN, // matched
32  LOWPU, // merged, but dominant contributor
33  HIGHPU, // merged and dominated by pile-up or fakes
34  HSSPLIT, // split
35  NONE, // not found
36  NHSTYPES
37  };

◆ 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 }

◆ 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 }

◆ 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 }
grepfile.info
info
Definition: grepfile.py:38
InDetVertexTruthMatchUtils::DUMMY
@ DUMMY
Definition: InDetVertexTruthMatchUtils.h:25
NONE
@ NONE
Definition: sTGCenumeration.h:13
InDetVertexTruthMatchUtils::LOWPU
@ LOWPU
Definition: InDetVertexTruthMatchUtils.h:32
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
InDetSecVtxTruthMatchUtils::VertexMatchType
VertexMatchType
Definition: InDetSecVtxTruthMatchTool.h:30
get_generator_info.result
result
Definition: get_generator_info.py:21
skel.it
it
Definition: skel.GENtoEVGEN.py:423
InDetVertexTruthMatchUtils::MATCHED
@ MATCHED
Definition: InDetVertexTruthMatchUtils.h:21
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
InDetVertexTruthMatchUtils::NHSTYPES
@ NHSTYPES
Definition: InDetVertexTruthMatchUtils.h:36
InDetVertexTruthMatchUtils::CLEAN
@ CLEAN
Definition: InDetVertexTruthMatchUtils.h:31
InDetVertexTruthMatchUtils::HSSPLIT
@ HSSPLIT
Definition: InDetVertexTruthMatchUtils.h:34
SG::ExcBadAuxVar
Exception — Attempt to retrieve nonexistent aux data item.
Definition: Control/AthContainers/AthContainers/exceptions.h:59
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
lumiFormat.i
int i
Definition: lumiFormat.py:92
InDetVertexTruthMatchUtils::HIGHPU
@ HIGHPU
Definition: InDetVertexTruthMatchUtils.h:33
InDetVertexTruthMatchUtils::NTYPES
@ NTYPES
Definition: InDetVertexTruthMatchUtils.h:26
python.utils.best
def best(iterable, priorities=[3, 2, 1, -1, 0])
Definition: DataQuality/DQUtils/python/utils.py:50
InDetVertexTruthMatchUtils::MERGED
@ MERGED
Definition: InDetVertexTruthMatchUtils.h:22
InDetVertexTruthMatchUtils::SPLIT
@ SPLIT
Definition: InDetVertexTruthMatchUtils.h:23
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:534
InDetVertexTruthMatchUtils::FAKE
@ FAKE
Definition: InDetVertexTruthMatchUtils.h:24
InDetVertexTruthMatchUtils::hardScatterMatches
const std::vector< std::pair< const xAOD::Vertex *, size_t > > hardScatterMatches(const xAOD::VertexContainer &vxContainer)
Definition: InDetVertexTruthMatchUtils.cxx:41