ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Prompt::VertexMergingTool Class Reference

#include <VertexMergingTool.h>

Inheritance diagram for Prompt::VertexMergingTool:
Collaboration diagram for Prompt::VertexMergingTool:

Public Member Functions

 VertexMergingTool (const std::string &name, const std::string &type, const IInterface *parent)
 
virtual StatusCode initialize () override
 
virtual MergeResultNotOwner mergeInitVertices (const FittingInput &input, const xAOD::TrackParticle *tracklep, std::vector< std::unique_ptr< xAOD::Vertex >> &init_vtxs, const std::vector< const xAOD::TrackParticle * > &selected_tracks) override
 
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
 
 DeclareInterfaceID (Prompt::IVertexMergingTool, 1, 0)
 

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

bool passVertexSelection (const xAOD::Vertex *vtx) const
 
bool makeClusters (std::vector< std::unique_ptr< VtxCluster >> &clusters, std::vector< xAOD::Vertex * > &init_vtxs)
 
bool matchVtxToCluster (const VtxCluster &cluster, const xAOD::Vertex *vtx) const
 
bool addInitVtxToCluster (VtxCluster &cluster, xAOD::Vertex *vtx) const
 
bool fitVertexCluster (const FittingInput &input, const xAOD::TrackParticle *tracklep, VtxCluster &cluster)
 
double getMinNormDistVtx (const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2) const
 
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

ServiceHandle< Prompt::IVertexFittingToolm_vertexFitterTool
 
Gaudi::Property< bool > m_useMinNormDist {this, "useMinNormDist", false}
 
Gaudi::Property< double > m_minFitProb {this, "minFitProb", 0.01}
 
Gaudi::Property< double > m_minDistanceClusterVtx {this, "minDistanceClusterVtx", 1.00}
 
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 50 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/LeptonTaggers/VertexMergingTool.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

◆ VertexMergingTool()

Prompt::VertexMergingTool::VertexMergingTool ( const std::string &  name,
const std::string &  type,
const IInterface *  parent 
)

Definition at line 18 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

20  :
22 {
23  declareInterface<Prompt::IVertexMergingTool>(this);
24 }

Member Function Documentation

◆ addInitVtxToCluster()

bool Prompt::VertexMergingTool::addInitVtxToCluster ( VtxCluster cluster,
xAOD::Vertex vtx 
) const
private

Definition at line 249 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

252 {
253  //
254  // Add vertex to cluster - always add vertex to empty cluster
255  //
256  if(!vtx) {
257  ATH_MSG_WARNING("AddVtxToCluster - input vertex is null pointer");
258  return false;
259  }
260 
261  if(vtx->nTrackParticles() != 2) {
262  ATH_MSG_WARNING("AddVtxToCluster - wrong number of tracks: " << vtx->nTrackParticles());
263  }
264 
265  for(unsigned k = 0; k < vtx->nTrackParticles(); ++k) {
266  const xAOD::TrackParticle *track = vtx->trackParticle(k);
267 
268  if(track) {
269  cluster.trksInit.push_back(track);
270  }
271  else {
272  ATH_MSG_WARNING("passVertexSelection - vertex contains TrackParticle null pointer");
273  }
274  }
275 
276  cluster.vtxsInit.push_back(vtx);
277 
278  return true;
279 }

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

◆ DeclareInterfaceID()

Prompt::IVertexMergingTool::DeclareInterfaceID ( Prompt::IVertexMergingTool  ,
,
 
)
inherited

◆ 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

◆ fitVertexCluster()

bool Prompt::VertexMergingTool::fitVertexCluster ( const FittingInput input,
const xAOD::TrackParticle tracklep,
VtxCluster cluster 
)
private

Definition at line 282 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

287 {
288  //
289  // Fit recursively merged vertex until:
290  // -- good quality vertex is obtained OR;
291  // -- number of tracks is less than 3.
292  //
293  if(cluster.trksCurr.size() < 2) {
294  ATH_MSG_WARNING("fitVertexCluster - number of input tracks is " << cluster.trksCurr.size() << " - nothing to do");
295  return false;
296  }
297 
298  ATH_MSG_DEBUG("fitVertexCluster - trksCurr.size()=" << cluster.trksCurr.size() << endl
299  << " lepton: " << trkAsStr(tracklep));
300 
301  for(const xAOD::TrackParticle *trk: cluster.trksCurr) {
302  ATH_MSG_DEBUG(" track: " << trkAsStr(trk));
303  }
304 
305  std::unique_ptr<xAOD::Vertex> secVtx = m_vertexFitterTool->fitVertexWithPrimarySeed(
306  input, cluster.trksCurr, kDeepMergedVtx
307  );
308 
309  if(!secVtx) {
310  ATH_MSG_WARNING("fitVertexCluster - failed to fit vertex");
311  return false;
312  }
313 
314  if(passVertexSelection(secVtx.get())) {
315  //
316  // Obtained good vertex fit - stop iterations
317  //
318  cluster.vtxMerged = std::move(secVtx);
319 
320  return true;
321  }
322 
323  return false;
324 }

◆ getMinNormDistVtx()

double Prompt::VertexMergingTool::getMinNormDistVtx ( const xAOD::Vertex vtx1,
const xAOD::Vertex vtx2 
) const
private

Definition at line 327 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

331 {
332  double mini_normDist = 9999.0;
333 
334  if((!vtx1) || (!vtx2)) {
335  return mini_normDist;
336  }
337 
338  const Amg::Vector3D psvtx1 = vtx1->position();
339  const Amg::Vector3D psvtx2 = vtx2->position();
340 
341  double svtx12_normDist1 = Prompt::getNormDist(psvtx1, psvtx2, vtx1->covariance(), msg(MSG::WARNING));
342  double svtx12_normDist2 = Prompt::getNormDist(psvtx1, psvtx2, vtx2->covariance(), msg(MSG::WARNING));
343 
344  if (svtx12_normDist2 < svtx12_normDist1) { mini_normDist = svtx12_normDist2; }
345  else { mini_normDist = svtx12_normDist1; }
346 
347  return mini_normDist;
348 }

◆ initialize()

StatusCode Prompt::VertexMergingTool::initialize ( )
overridevirtual

Definition at line 27 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

28 {
29  ATH_CHECK(m_vertexFitterTool.retrieve());
30 
31  return StatusCode::SUCCESS;
32 }

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

◆ makeClusters()

bool Prompt::VertexMergingTool::makeClusters ( std::vector< std::unique_ptr< VtxCluster >> &  clusters,
std::vector< xAOD::Vertex * > &  init_vtxs 
)
private

Definition at line 171 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

175 {
176  //
177  // Make clusters from initial vertexes
178  //
179  std::vector<xAOD::Vertex*>::iterator icurr_vtx = init_vtxs.begin();
180 
181  //
182  // Seed initial cluster with the first vertex on the list
183  //
184  while(icurr_vtx != init_vtxs.end()) {
185  bool match_curr = false;
186 
187  //
188  // First check whether this vertex can be included with existing clusters
189  //
190  for(std::unique_ptr<VtxCluster> &cluster: clusters) {
191  if(matchVtxToCluster(*cluster, *icurr_vtx)) {
192  addInitVtxToCluster(*cluster, *icurr_vtx);
193  match_curr = true;
194  break;
195  }
196  }
197 
198 
199  if(!match_curr) {
200  //
201  // Start new cluster with current vertex
202  //
203  clusters.push_back(std::make_unique<VtxCluster>());
204  addInitVtxToCluster(*(clusters.back()), std::move(*icurr_vtx));
205  }
206 
207  //
208  // Erase current vertex and start at the beginning
209  //
210  init_vtxs.erase(icurr_vtx);
211  icurr_vtx = init_vtxs.begin();
212  }
213 
214  return !clusters.empty();
215 }

◆ matchVtxToCluster()

bool Prompt::VertexMergingTool::matchVtxToCluster ( const VtxCluster cluster,
const xAOD::Vertex vtx 
) const
private

Definition at line 218 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

219 {
220  //
221  // Add vertex to cluster - always add vertex to empty cluster
222  //
223  if(!vtx) {
224  ATH_MSG_WARNING("matchVtxToCluster - input vertex is null pointer");
225  return false;
226  }
227 
228  //
229  // Empty cluster does not match any vertex
230  //
231  bool match_vtx = false;
232 
233  for(const xAOD::Vertex *cluster_vtx: cluster.vtxsInit) {
234  double dist = Prompt::getDistance(cluster_vtx, vtx);
235 
236  if(m_useMinNormDist) { dist = getMinNormDistVtx (cluster_vtx, vtx); }
237  else { dist = Prompt::getDistance(cluster_vtx, vtx); }
238 
239  if(dist < m_minDistanceClusterVtx) {
240  match_vtx = true;
241  break;
242  }
243  }
244 
245  return match_vtx;
246 }

◆ mergeInitVertices()

Prompt::MergeResultNotOwner Prompt::VertexMergingTool::mergeInitVertices ( const FittingInput input,
const xAOD::TrackParticle tracklep,
std::vector< std::unique_ptr< xAOD::Vertex >> &  init_vtxs,
const std::vector< const xAOD::TrackParticle * > &  selected_tracks 
)
overridevirtual

Implements Prompt::IVertexMergingTool.

Definition at line 35 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

41 {
42  //
43  // Merge initial (2-track) vertices into new merged vertices with three tracks or more
44  //
45  MergeResultNotOwner result;
46 
47  for(std::unique_ptr<xAOD::Vertex> &vtx: init_vtxs) {
48  if(passVertexSelection(vtx.get())) {
49  result.vtxsInitPassed.push_back(vtx.get());
50  }
51  }
52 
53  ATH_MSG_DEBUG(name() << "::mergeInitVertices - start processing" << endl
54  << " number of initial 2-track vertices: " << init_vtxs.size() << endl
55  << " number of selected 2-track vertices: " << result.vtxsInitPassed.size() << endl
56  << " number of selected ID tracks: " << selected_tracks.size() );
57 
58  const unsigned nvtx_init = init_vtxs.size();
59  const unsigned nvtx_pass = result.vtxsInitPassed.size();
60 
61  //
62  // Make vertex clusters
63  //
64  std::vector<std::unique_ptr<VtxCluster>> clusters;
65  std::vector<std::unique_ptr<VtxCluster>> clusters_cand, clusters_1vtx;
66 
67  makeClusters(clusters, result.vtxsInitPassed);
68 
69  for(std::unique_ptr<VtxCluster> &cluster: clusters) {
70  ATH_MSG_DEBUG(" cluster candidate with nvertex=" << cluster->vtxsInit.size());
71 
72  if(cluster->vtxsInit.size() < 1) {
73  ATH_MSG_DEBUG("VertexMergingTool::mergeInitVertices - logic error: cluster with zero vertexes!!");
74  }
75  else if(cluster->vtxsInit.size() == 1) {
76  clusters_1vtx.push_back(std::move(cluster));
77  }
78  else {
79  clusters_cand.push_back(std::move(cluster));
80  }
81  }
82 
83  ATH_MSG_DEBUG(" # init vertexes: " << nvtx_init << endl
84  << " # pass vertexes: " << nvtx_pass << endl
85  << " cluster_1vtx size: " << clusters_1vtx.size() << endl
86  << " cluster_cand size: " << clusters_cand.size() );
87 
88  //
89  // Found zero clusters with two or more vertices - nothing nore to do
90  //
91  if(clusters_cand.empty()) {
92  return result;
93  }
94 
95  for(std::unique_ptr<VtxCluster> &cluster: clusters_cand) {
96  //
97  // Initiliase ID tracks
98  //
99  cluster->trksCurr = cluster->trksInit;
100 
101  //
102  // Remove lepton tracks from list of tracks for fitting - the lepton track is added by VertexFittingSvc
103  //
104  cluster->trksCurr.erase(std::remove(cluster->trksCurr.begin(), cluster->trksCurr.end(), tracklep), cluster->trksCurr.end());
105 
106  ATH_MSG_DEBUG("Cluster vtxsInit size=" << cluster->vtxsInit.size() << endl
107  << " trksInit size=" << cluster->trksInit.size() << endl
108  << " trksCurr size=" << cluster->trksCurr.size() );
109 
110  for(const xAOD::Vertex *vtx: cluster->vtxsInit) {
111  ATH_MSG_DEBUG(" init vtx: " << vtxAsStr(vtx, true));
112  }
113  for(const xAOD::TrackParticle *trk: cluster->trksInit) {
114  ATH_MSG_DEBUG(" init trk: " << trkAsStr(trk));
115  }
116  for(const xAOD::TrackParticle *trk: cluster->trksCurr) {
117  ATH_MSG_DEBUG(" curr trk: " << trkAsStr(trk));
118  }
119 
120  if(cluster->trksCurr.size() != cluster->vtxsInit.size()) {
121  ATH_MSG_WARNING("mergeInitVertices - input vertices are not all 2-track: nvtx != ntrk: " << cluster->trksCurr.size() << "!=" << cluster->vtxsInit.size());
122  }
123  }
124 
125  ATH_MSG_DEBUG("Process " << clusters_cand.size() << " candidate clusters");
126 
127  for(std::unique_ptr<VtxCluster> &cluster: clusters_cand) {
128  //
129  // Fit cluster of vertices to obtain one merged vertex
130  //
131  fitVertexCluster(input, tracklep, *cluster);
132 
133  if(cluster->vtxMerged) {
134  result.vtxsNewMerged.push_back(std::move(cluster->vtxMerged));
135  }
136  else {
137  ATH_MSG_INFO("FAILED TO MERGE VERTEX");
138  }
139 
140  cluster->vtxsFittedBad.clear();
141  }
142 
143  ATH_MSG_DEBUG(name() << "::mergeInitVertices - result size=" << result.vtxsNewMerged.size());
144 
145  return result;
146 }

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

◆ passVertexSelection()

bool Prompt::VertexMergingTool::passVertexSelection ( const xAOD::Vertex vtx) const
private

Definition at line 149 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx.

150 {
151  //
152  // Check whether vertex passes quality cuts
153  //
154  if(!vtx) {
155  ATH_MSG_WARNING("passVertexSelection - input vertex is null pointer");
156  return false;
157  }
158 
159  if(!(vtx->numberDoF() > 0 && vtx->chiSquared() > 0)) {
160  return false;
161  }
162 
163  const double fit_prob = Prompt::getVertexFitProb(vtx);
164 
165  ATH_MSG_DEBUG("passVertexSelection - vertex pointer=" << vtx << " chi2/ndof=" << vtx->chiSquared() << "/" << vtx->numberDoF() << ", prob=" << fit_prob);
166 
167  return fit_prob > m_minFitProb;
168 }

◆ 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_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_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_minDistanceClusterVtx

Gaudi::Property<double> Prompt::VertexMergingTool::m_minDistanceClusterVtx {this, "minDistanceClusterVtx", 1.00}
private

◆ m_minFitProb

Gaudi::Property<double> Prompt::VertexMergingTool::m_minFitProb {this, "minFitProb", 0.01}
private

◆ m_useMinNormDist

Gaudi::Property<bool> Prompt::VertexMergingTool::m_useMinNormDist {this, "useMinNormDist", false}
private

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexFitterTool

ServiceHandle<Prompt::IVertexFittingTool> Prompt::VertexMergingTool::m_vertexFitterTool
private
Initial value:
{
this, "VertexFittingTool", "Prompt::VertexFittingSvc/PromptVertexFittingSvc"
}

Definition at line 103 of file PhysicsAnalysis/AnalysisCommon/LeptonTaggers/LeptonTaggers/VertexMergingTool.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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
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
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Prompt::VertexMergingTool::addInitVtxToCluster
bool addInitVtxToCluster(VtxCluster &cluster, xAOD::Vertex *vtx) const
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx:249
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Prompt::VertexMergingTool::matchVtxToCluster
bool matchVtxToCluster(const VtxCluster &cluster, const xAOD::Vertex *vtx) const
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx:218
Prompt::getVertexFitProb
double getVertexFitProb(const xAOD::Vertex *vtx)
Definition: PromptUtils.cxx:21
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Prompt::trkAsStr
std::string trkAsStr(const xAOD::TrackParticle *trk)
Definition: PromptUtils.cxx:228
Prompt::kDeepMergedVtx
@ kDeepMergedVtx
Definition: IVertexFittingTool.h:61
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::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
Prompt::vtxAsStr
std::string vtxAsStr(const xAOD::Vertex *vtx, bool print_tracks=false)
Definition: PromptUtils.cxx:172
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Prompt::VertexMergingTool::fitVertexCluster
bool fitVertexCluster(const FittingInput &input, const xAOD::TrackParticle *tracklep, VtxCluster &cluster)
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx:282
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Prompt::VertexMergingTool::makeClusters
bool makeClusters(std::vector< std::unique_ptr< VtxCluster >> &clusters, std::vector< xAOD::Vertex * > &init_vtxs)
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx:171
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
Prompt::getNormDist
double getNormDist(const Amg::Vector3D &PrimVtx, const Amg::Vector3D &SecVtx, const std::vector< float > &ErrorMatrix, MsgStream &msg)
Definition: PromptUtils.cxx:57
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Prompt::getDistance
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
Definition: PromptUtils.cxx:41
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Prompt::VertexMergingTool::m_useMinNormDist
Gaudi::Property< bool > m_useMinNormDist
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/LeptonTaggers/VertexMergingTool.h:107
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
Prompt::VertexMergingTool::m_minDistanceClusterVtx
Gaudi::Property< double > m_minDistanceClusterVtx
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/LeptonTaggers/VertexMergingTool.h:110
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
Prompt::VertexMergingTool::m_vertexFitterTool
ServiceHandle< Prompt::IVertexFittingTool > m_vertexFitterTool
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/LeptonTaggers/VertexMergingTool.h:103
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Prompt::VertexMergingTool::passVertexSelection
bool passVertexSelection(const xAOD::Vertex *vtx) const
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx:149
xAOD::Vertex_v1::numberDoF
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
xAOD::Vertex_v1::covariance
const std::vector< float > & covariance() const
Returns the covariance matrix as a simple vector of values.
a
TList * a
Definition: liststreamerinfos.cxx:10
xAOD::Vertex_v1::chiSquared
float chiSquared() const
Returns the of the vertex fit as float.
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Prompt::VertexMergingTool::getMinNormDistVtx
double getMinNormDistVtx(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2) const
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/src/VertexMergingTool.cxx:327
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Prompt::VertexMergingTool::m_minFitProb
Gaudi::Property< double > m_minFitProb
Definition: PhysicsAnalysis/AnalysisCommon/LeptonTaggers/LeptonTaggers/VertexMergingTool.h:109
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