ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
DerivationFramework::VertexTrackIsolation Class Reference

#include <VertexTrackIsolation.h>

Inheritance diagram for DerivationFramework::VertexTrackIsolation:
Collaboration diagram for DerivationFramework::VertexTrackIsolation:

Public Member Functions

 VertexTrackIsolation (const std::string &t, const std::string &n, const IInterface *p)
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode addBranches () const
 Pass the thinning service
More...
 
bool isSame (const xAOD::Vertex *theVtx1, const xAOD::Vertex *theVtx2) const
 
bool isContainedIn (const xAOD::Vertex *theVtx, const std::vector< const xAOD::Vertex * > &theColl) const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface methods. More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandle< xAOD::ITrackIsolationToolm_trackIsoTool
 
std::string m_trackContainerName
 
std::string m_vertexContainerName
 
std::vector< unsigned int > m_cones
 
std::vector< std::string > m_passFlags
 
int m_vertexType
 
bool m_doIsoPerTrk
 
int m_removeDuplicate
 
bool m_fixElecExclusion
 
bool m_includeV0
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 24 of file VertexTrackIsolation.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ VertexTrackIsolation()

DerivationFramework::VertexTrackIsolation::VertexTrackIsolation ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 21 of file VertexTrackIsolation.cxx.

22  : AthAlgTool(t, n, p),
23  m_trackIsoTool("xAOD::TrackIsolationTool"),
24  m_trackContainerName("InDetTrackParticles"),
25  m_vertexContainerName("NONE"),
26  m_cones(),
27  m_vertexType(7),
28  m_doIsoPerTrk(false),
30  m_fixElecExclusion(false),
31  m_includeV0(false) {
32  ATH_MSG_DEBUG("in constructor");
33  declareInterface<DerivationFramework::IAugmentationTool>(this);
34 
35  // Declare tools
36  declareProperty("TrackIsoTool", m_trackIsoTool);
37  declareProperty("TrackContainer", m_trackContainerName);
38  declareProperty("InputVertexContainer", m_vertexContainerName);
39  declareProperty("PassFlags", m_passFlags);
40  declareProperty("IsolationTypes", m_cones);
41  declareProperty("DoVertexTypes", m_vertexType);
42 
43  declareProperty("DoIsoPerTrk", m_doIsoPerTrk,
44  "New property to deal with track isolation per track, the default option "
45  "(m_doIsoPerTrk=false) preserves the old behavior");
46  declareProperty("RemoveDuplicate", m_removeDuplicate, "Used with DoIsoPerTrk");
47  declareProperty("FixElecExclusion", m_fixElecExclusion);
48  declareProperty("IncludeV0", m_includeV0);
49 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::VertexTrackIsolation::addBranches ( ) const
virtual

Pass the thinning service

Implements DerivationFramework::IAugmentationTool.

Definition at line 125 of file VertexTrackIsolation.cxx.

125  {
126 
127  const xAOD::TrackParticleContainer* idTrackParticleContainer = NULL;
128  const xAOD::VertexContainer* vertexContainer = NULL;
129 
130  if (evtStore()->contains<xAOD::TrackParticleContainer>(m_trackContainerName)) {
131  CHECK(evtStore()->retrieve(idTrackParticleContainer, m_trackContainerName));
132  } else {
133  ATH_MSG_ERROR("Failed loading IdTrackparticleContainer container");
134  return StatusCode::FAILURE;
135  }
136 
137  // load vertices
138  if (evtStore()->contains<xAOD::VertexContainer>(m_vertexContainerName)) {
139  CHECK(evtStore()->retrieve(vertexContainer, m_vertexContainerName));
140  } else {
141  ATH_MSG_ERROR("Failed loading vertex container");
142  return StatusCode::FAILURE;
143  }
144 
145  std::vector<const xAOD::Vertex*> outVtxContainer;
146 
147  // Convert m_cones (done per-event to avoid needing extra public dependency)
148 
149  std::vector<xAOD::Iso::IsolationType> cones(m_cones.size());
150 
151  for (unsigned int i = 0; i < m_cones.size(); i++)
152  cones[i] = xAOD::Iso::IsolationType(m_cones[i]);
153 
154  // The provided IsolationTypes are re-ordered internally
155  std::sort(cones.begin(), cones.end(), [](xAOD::Iso::IsolationType i, xAOD::Iso::IsolationType j) {
156  return xAOD::Iso::coneSize(i) > xAOD::Iso::coneSize(j);
157  });
158 
159  // loop over vertices
160  for (auto vertex : *vertexContainer) {
161 
162  bool passed = false;
163  for (std::vector<std::string>::const_iterator flagItr = m_passFlags.begin(); flagItr != m_passFlags.end();
164  ++flagItr) {
165  SG::Accessor<Char_t> flagAcc(*flagItr);
166  if (flagAcc.isAvailable(*vertex) && flagAcc(*vertex) != 0) {
167  passed = true;
168  break;
169  }
170  } // end of loop over flags
171  // if no passFlags given, decorate everything
172  if (passed || m_passFlags.empty()) {
173  if (!m_doIsoPerTrk) { // for legacy
174  // Removed warning was here
175  } else {
176  if (m_removeDuplicate) {
177  if (isContainedIn(vertex, outVtxContainer))
178  continue;
179  outVtxContainer.push_back(vertex);
180  }
181  }
182 
183  TLorentzVector candidate;
184 
185  std::set<const xAOD::TrackParticle*> exclusionset;
186 
187  for (auto part : vertex->trackParticleLinks()) { // Loop over tracks linked to vertex
188 
189  candidate += (*part)->p4();
190 
191  // if you have electron tracks that are GSF, need to get original ID
192  // trackparticle for excluding this particle
193  if (m_fixElecExclusion) {
195  exclusionset.insert(partID);
196  } else
197  exclusionset.insert(*part); // If it crashes use the direct TP from the vertex
198  }
199  // No! the above candidate will fail acceptance of isolation() because
200  // it's neither a muon nor a TrackParticle
201 
202  // Add in V0->XX particles
203  if (m_includeV0) {
205  V0VertexLinksAcc("V0VertexLinks");
206  auto V0VertLink = V0VertexLinksAcc(*vertex);
207  const xAOD::Vertex* V0Vert = V0VertLink.at(0).getDataPtr()->at(0);
208  for (auto part : V0Vert->trackParticleLinks()) {
209  candidate += (*part)->p4();
210  exclusionset.insert(*part);
211  }
212  }
213 
214  // Make a dummy TrackParticle, otherwise TrackIsolationTool cannot deal
215  // with it
216  xAOD::TrackParticle candidate_slyTrack;
217  candidate_slyTrack.makePrivateStore();
218  candidate_slyTrack.setDefiningParameters(0, 0., candidate.Phi(), candidate.Theta(), 0. /*1./candidate.P()*/);
219  // The precision goes down a bit, but it's a matter of 10e-7 with our
220  // values of interest
221 
222  // Make a correctionlist such that the given exclusionset will be removed
223  // from the used tracks There is no danger that the input particle will be
224  // excluded, as it is not part of inDetTrackContainer
225  xAOD::TrackCorrection corrlist;
226  corrlist.trackbitset.set(static_cast<unsigned int>(xAOD::Iso::coreTrackPtr));
227 
228  const string vtxType_name[3] = {"SumPt", "A0", "Z0"};
229 
230  xAOD::BPhysHelper vertex_h(vertex); // Use the BPhysHelper to access vertex quantities
231 
232  // Loop over refitted primary vertex choice
233  for (unsigned int vertex_type = 0; vertex_type <= xAOD::BPhysHelper::PV_MIN_Z0; vertex_type++) {
234 
235  if ((m_vertexType & (1 << vertex_type)) == 0)
236  continue; // Stop if the type of vertex is not required
237 
238  ATH_MSG_DEBUG("List of cone types");
239  for (unsigned int i = 0; i < cones.size(); i++) {
240  ATH_MSG_DEBUG("cone type = " << xAOD::Iso::toString(xAOD::Iso::IsolationType(cones[i])));
241  }
242 
243  const xAOD::Vertex* refVtx = vertex_h.pv(static_cast<xAOD::BPhysHelper::pv_type>(vertex_type)); // Fix the cast
244  if(refVtx == nullptr){
245  ATH_MSG_WARNING("Could not retrieve Vertex type " << vertex_type << ", check vertex type setting. Comes from container " << m_vertexContainerName);
246  continue;
247  }
249 
250  if (!m_doIsoPerTrk) {
251  m_trackIsoTool->trackIsolation(result, candidate_slyTrack, cones, corrlist, refVtx, &exclusionset,
252  idTrackParticleContainer);
253 
254  // Decorate the vertex with all the isolation values
255  for (unsigned int i = 0; i < cones.size(); i++) {
256 
257  string variableName = xAOD::Iso::toString(xAOD::Iso::IsolationType(cones[i]));
258  variableName += vtxType_name[vertex_type];
259 
260  SG::Decorator<float> isolation(variableName);
261  isolation(*vertex) = result.ptcones[i];
262  }
263  } else {
264  for (size_t i = 0; i < vertex->nTrackParticles(); i++) {
265  m_trackIsoTool->trackIsolation(result, *vertex->trackParticle(i), cones, corrlist, refVtx, &exclusionset,
266  idTrackParticleContainer);
267 
268  for (unsigned int j = 0; j < cones.size(); j++) {
269  string variableName = xAOD::Iso::toString(xAOD::Iso::IsolationType(cones[j]));
270  variableName += vtxType_name[vertex_type];
271  variableName += "_trk";
272  variableName += std::to_string(i + 1);
273  SG::Decorator<float> isolation(variableName);
274  isolation(*vertex) = result.ptcones[j];
275  }
276  }
277  }
278  }
279 
280  } // End of if passed
281  } // end of loop over vertices
282 
283  return StatusCode::SUCCESS;
284 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode DerivationFramework::VertexTrackIsolation::finalize ( )

Definition at line 76 of file VertexTrackIsolation.cxx.

76  {
77  // everything all right
78  return StatusCode::SUCCESS;
79 }

◆ initialize()

StatusCode DerivationFramework::VertexTrackIsolation::initialize ( )

Definition at line 53 of file VertexTrackIsolation.cxx.

53  {
54 
55  ATH_MSG_DEBUG("in initialize()");
56 
57  CHECK(m_trackIsoTool.retrieve());
58  // Check that flags were given to tag the correct vertices
59 
60  // Control the IsolationType sequence
61  if (m_cones.empty()) {
62  ATH_MSG_INFO("Setting ptcones to default");
63 
64  if (m_doIsoPerTrk)
65  m_cones.push_back(xAOD::Iso::ptcone50);
66  m_cones.push_back(xAOD::Iso::ptcone40);
67  m_cones.push_back(xAOD::Iso::ptcone30);
68  m_cones.push_back(xAOD::Iso::ptcone20);
69  }
70 
71  return StatusCode::SUCCESS;
72 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& DerivationFramework::IAugmentationTool::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 31 of file IAugmentationTool.h.

31 { return IID_IAugmentationTool; }

◆ isContainedIn()

bool DerivationFramework::VertexTrackIsolation::isContainedIn ( const xAOD::Vertex theVtx,
const std::vector< const xAOD::Vertex * > &  theColl 
) const

Definition at line 114 of file VertexTrackIsolation.cxx.

115  {
116  for (const auto vtxPtr : theColl) {
117  if (isSame(vtxPtr, theVtx))
118  return true;
119  }
120  return false;
121 }

◆ isSame()

bool DerivationFramework::VertexTrackIsolation::isSame ( const xAOD::Vertex theVtx1,
const xAOD::Vertex theVtx2 
) const

Definition at line 82 of file VertexTrackIsolation.cxx.

82  {
83  assert(theVtx1);
84  assert(theVtx2);
85  if (theVtx1 == theVtx2)
86  return true;
87  if (theVtx1->nTrackParticles() != theVtx2->nTrackParticles())
88  return false;
89 
90  if (m_removeDuplicate == 2 && theVtx1->nTrackParticles() == 4) { // a special case with sub-structure
91  bool firstTwoAreSame =
92  std::set<const xAOD::TrackParticle*>({theVtx1->trackParticle(0), theVtx1->trackParticle(1)}) ==
93  std::set<const xAOD::TrackParticle*>(
94  {theVtx2->trackParticle(0), theVtx2->trackParticle(1)}); // the 1st pair of tracks
95  bool lastTwoAreSame =
96  std::set<const xAOD::TrackParticle*>({theVtx1->trackParticle(2), theVtx1->trackParticle(3)}) ==
97  std::set<const xAOD::TrackParticle*>(
98  {theVtx2->trackParticle(2), theVtx2->trackParticle(3)}); // the 2nd pair of tracks
99  if (firstTwoAreSame && lastTwoAreSame)
100  return true;
101  else
102  return false;
103  } else { // the general case
104  std::set<const xAOD::TrackParticle*> vtxset1;
105  std::set<const xAOD::TrackParticle*> vtxset2;
106  for (size_t i = 0; i < theVtx1->nTrackParticles(); i++)
107  vtxset1.insert(theVtx1->trackParticle(i));
108  for (size_t i = 0; i < theVtx2->nTrackParticles(); i++)
109  vtxset2.insert(theVtx2->trackParticle(i));
110  return vtxset1 == vtxset2;
111  }
112 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_cones

std::vector<unsigned int> DerivationFramework::VertexTrackIsolation::m_cones
private

Definition at line 42 of file VertexTrackIsolation.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doIsoPerTrk

bool DerivationFramework::VertexTrackIsolation::m_doIsoPerTrk
private

Definition at line 46 of file VertexTrackIsolation.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fixElecExclusion

bool DerivationFramework::VertexTrackIsolation::m_fixElecExclusion
private

Definition at line 49 of file VertexTrackIsolation.h.

◆ m_includeV0

bool DerivationFramework::VertexTrackIsolation::m_includeV0
private

Definition at line 50 of file VertexTrackIsolation.h.

◆ m_passFlags

std::vector<std::string> DerivationFramework::VertexTrackIsolation::m_passFlags
private

Definition at line 43 of file VertexTrackIsolation.h.

◆ m_removeDuplicate

int DerivationFramework::VertexTrackIsolation::m_removeDuplicate
private

Definition at line 47 of file VertexTrackIsolation.h.

◆ m_trackContainerName

std::string DerivationFramework::VertexTrackIsolation::m_trackContainerName
private

Definition at line 40 of file VertexTrackIsolation.h.

◆ m_trackIsoTool

ToolHandle<xAOD::ITrackIsolationTool> DerivationFramework::VertexTrackIsolation::m_trackIsoTool
private

Definition at line 38 of file VertexTrackIsolation.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexContainerName

std::string DerivationFramework::VertexTrackIsolation::m_vertexContainerName
private

Definition at line 41 of file VertexTrackIsolation.h.

◆ m_vertexType

int DerivationFramework::VertexTrackIsolation::m_vertexType
private

Definition at line 44 of file VertexTrackIsolation.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DerivationFramework::VertexTrackIsolation::m_trackContainerName
std::string m_trackContainerName
Definition: VertexTrackIsolation.h:40
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::Vertex_v1::nTrackParticles
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
Definition: Vertex_v1.cxx:270
xAOD::BPhysHelper
Definition: BPhysHelper.h:71
xAOD::TrackCorrection
Definition: IsolationCommon.h:18
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
python.CreateTierZeroArgdict.partID
partID
Definition: CreateTierZeroArgdict.py:135
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::Iso::toString
std::string toString(const IsoType &iso)
Definition: IsolationHelpers.h:59
xAOD::Iso::coreTrackPtr
@ coreTrackPtr
tracks pointer
Definition: Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:66
xAOD::Vertex_v1::trackParticleLinks
const TrackParticleLinks_t & trackParticleLinks() const
Get all the particles associated with the vertex.
DerivationFramework::VertexTrackIsolation::isContainedIn
bool isContainedIn(const xAOD::Vertex *theVtx, const std::vector< const xAOD::Vertex * > &theColl) const
Definition: VertexTrackIsolation.cxx:114
xAOD::TrackCorrection::trackbitset
Iso::IsolationTrackCorrectionBitset trackbitset
Definition: IsolationCommon.h:19
xAOD::Iso::ptcone30
@ ptcone30
Definition: IsolationType.h:41
xAOD::Iso::ptcone20
@ ptcone20
Track isolation.
Definition: IsolationType.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
xAOD::TrackParticle_v1::setDefiningParameters
void setDefiningParameters(float d0, float z0, float phi0, float theta, float qOverP)
Set the defining parameters.
Definition: TrackParticle_v1.cxx:177
DerivationFramework::VertexTrackIsolation::m_cones
std::vector< unsigned int > m_cones
Definition: VertexTrackIsolation.h:42
xAOD::BPhysHelper::PV_MIN_Z0
@ PV_MIN_Z0
Definition: BPhysHelper.h:475
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
DerivationFramework::VertexTrackIsolation::m_vertexType
int m_vertexType
Definition: VertexTrackIsolation.h:44
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
DerivationFramework::VertexTrackIsolation::m_trackIsoTool
ToolHandle< xAOD::ITrackIsolationTool > m_trackIsoTool
Definition: VertexTrackIsolation.h:38
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
xAOD::BPhysHelper::pv_type
pv_type
: Enum type of the PV
Definition: BPhysHelper.h:475
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::Decorator< float >
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::Iso::IsolationType
IsolationType
Overall enumeration for isolation types in xAOD files.
Definition: IsolationType.h:26
xAOD::Iso::ptcone50
@ ptcone50
Definition: IsolationType.h:43
DerivationFramework::VertexTrackIsolation::m_removeDuplicate
int m_removeDuplicate
Definition: VertexTrackIsolation.h:47
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAOD::Vertex_v1::trackParticle
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
Definition: Vertex_v1.cxx:249
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DerivationFramework::VertexTrackIsolation::m_fixElecExclusion
bool m_fixElecExclusion
Definition: VertexTrackIsolation.h:49
DerivationFramework::VertexTrackIsolation::m_includeV0
bool m_includeV0
Definition: VertexTrackIsolation.h:50
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
DerivationFramework::VertexTrackIsolation::m_passFlags
std::vector< std::string > m_passFlags
Definition: VertexTrackIsolation.h:43
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
DerivationFramework::VertexTrackIsolation::m_doIsoPerTrk
bool m_doIsoPerTrk
Definition: VertexTrackIsolation.h:46
xAOD::TrackIsolation
Definition: IsolationCommon.h:33
DerivationFramework::VertexTrackIsolation::isSame
bool isSame(const xAOD::Vertex *theVtx1, const xAOD::Vertex *theVtx2) const
Definition: VertexTrackIsolation.cxx:82
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF
const xAOD::TrackParticle * getOriginalTrackParticleFromGSF(const xAOD::TrackParticle *trkPar)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle...
Definition: ElectronxAODHelpers.cxx:22
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
DerivationFramework::VertexTrackIsolation::m_vertexContainerName
std::string m_vertexContainerName
Definition: VertexTrackIsolation.h:41
xAOD::Iso::ptcone40
@ ptcone40
Definition: IsolationType.h:42
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528