ATLAS Offline Software
Loading...
Searching...
No Matches
Prompt::VertexIterativeFitMergingTool Class Reference

#include <VertexIterativeFitMergingTool.h>

Inheritance diagram for Prompt::VertexIterativeFitMergingTool:
Collaboration diagram for Prompt::VertexIterativeFitMergingTool:

Public Member Functions

 VertexIterativeFitMergingTool (const std::string &name, const std::string &type, const IInterface *parent)
virtual StatusCode initialize () override
virtual MergeResultNotOwner mergeInitVertices (const EventContext &ctx, const FittingInput &input, const xAOD::TrackParticle *tracklep, std::vector< std::unique_ptr< xAOD::Vertex > > &initVtxs, const std::vector< const xAOD::TrackParticle * > &selectedTracks) override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () 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
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.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

bool mergeIteratively2TrackVtxs (const EventContext &ctx, const FittingInput &input, std::vector< std::unique_ptr< xAOD::Vertex > > &initVtxs, MergeResultNotOwner &result, const VtxType vtxType)
void getNewMergedVertex (const EventContext &ctx, xAOD::Vertex *seedVtx, std::unique_ptr< xAOD::Vertex > &newMergedVtx, const FittingInput &input, std::vector< TwoTrackVtx >::iterator &currVit, std::vector< TwoTrackVtx > &vtxs2Track, const VtxType vtxType)
xAOD::Vertex * fitSeedVertexCluster (const EventContext &ctx, const FittingInput &input, xAOD::Vertex *seedVtx, const VtxType vtxType, std::vector< TwoTrackVtx > &others)
xAOD::Vertex * fitSeedVertexCluster (const EventContext &ctx, const FittingInput &input, std::unique_ptr< xAOD::Vertex > &seedVtx, const VtxType vtxType, std::vector< TwoTrackVtx > &others)
std::unique_ptr< xAOD::Vertex > fitSeedPlusOtherVertex (const EventContext &ctx, const FittingInput &input, const xAOD::Vertex *seedVtx, const xAOD::Vertex *otherVtx, const VtxType vtxType)
bool passVertexSelection (const xAOD::Vertex *vtx) const
unsigned removeMerged2TrackVertexes (const xAOD::Vertex *mergedVtx, std::vector< TwoTrackVtx > &vtxs) const
void plotVertexDistances (const std::vector< TwoTrackVtx > &others)
std::vector< const xAOD::TrackParticle * > getTracksWithoutVertex (const std::vector< xAOD::Vertex * > &passVtxs, const std::vector< const xAOD::TrackParticle * > &selectedTracks)
std::vector< std::unique_ptr< xAOD::Vertex > > fit2TrackVertexes (const EventContext &ctx, const FittingInput &input, std::vector< const xAOD::TrackParticle * > &selectedTracks, const VtxType vtxType)
StatusCode makeHist (TH1 *&h, const std::string &key, int nbin, double xmin, double xmax)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Prompt::IVertexFittingTool > m_vertexFitterTool
ServiceHandle< ITHistSvc > m_histSvc
Gaudi::Property< double > m_minFitProb
Gaudi::Property< double > m_minCandOverSeedFitProbRatio
Gaudi::Property< unsigned > m_maxExtraTracks
Gaudi::Property< std::string > m_outputStream
TH1 * m_histNvtx2TrkInit {}
TH1 * m_histNvtx2TrkPass {}
TH1 * m_histNvtx2TrkUnmerged {}
TH1 * m_histNvtxMerged {}
TH1 * m_histNewVtxFitChi2 {}
TH1 * m_histNewVtxFitProb {}
TH1 * m_histNewVtxFitDistToCurr {}
TH1 * m_histNewVtxFitDistToSeed {}
TH1 * m_histNewVtxFitDistToSeedPass {}
TH1 * m_histNewVtxFitDistToSeedFail {}
TH1 * m_histNewVtxFitProbCandOverSeed {}
TH1 * m_histNewVtxFitProbCandOverSeedPass {}
TH1 * m_histNewVtxFitProbCandOverSeedFail {}
TH1 * m_histNewVtxFitProbCandOverSeed3Trk {}
TH1 * m_histNewVtxFitProbCandOverSeed3TrkPass {}
TH1 * m_histVtx2TrkPairDist {}
TH1 * m_histVtx2trkPairDistZoom {}
TH1 * m_histVtx2TrkPairSig1 {}
TH1 * m_histVtx2TrkPairSig2 {}
TH1 * m_histSelectedTrackCountAll {}
TH1 * m_histSelectedTrackCountMatch2Vtx {}
TH1 * m_histSelectedTrackCountWithout2Vtx {}
TH1 * m_histVtxWithoutLepton2TrkNTrack {}
TH1 * m_histVtxWithoutLepton2TrkNPass {}
TH1 * m_histVtxWithoutLepton2TrkNPassUnmerged {}
TH1 * m_histVtxWithoutLepton2TrkNMerged {}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 89 of file VertexIterativeFitMergingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ VertexIterativeFitMergingTool()

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

Definition at line 16 of file VertexIterativeFitMergingTool.cxx.

20 :
21 AthAlgTool (name, type, parent)
22{
23 declareInterface<Prompt::IVertexMergingTool>(this);
24}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

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

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

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

◆ evtStore()

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.

◆ 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

◆ fit2TrackVertexes()

std::vector< std::unique_ptr< xAOD::Vertex > > Prompt::VertexIterativeFitMergingTool::fit2TrackVertexes ( const EventContext & ctx,
const FittingInput & input,
std::vector< const xAOD::TrackParticle * > & selectedTracks,
const VtxType vtxType )
private

Definition at line 782 of file VertexIterativeFitMergingTool.cxx.

788{
789 //
790 // Fit all possible combinations of two 2-track vertexes
791 //
792 std::vector<std::unique_ptr<xAOD::Vertex>> passVtxs;
793
794 if(selectedTracks.size() < 2) {
795 ATH_MSG_DEBUG("fit2TrackVertexeses - 0 or 1 input tracks - nothing to do");
796 return passVtxs;
797 }
798
799 ATH_MSG_DEBUG(name() << "::fit2TrackVertexes - start with " << selectedTracks.size() << " tracks");
800
801 //
802 // Sort tracks by decreasing pT
803 //
804 std::sort(selectedTracks.begin(), selectedTracks.end(), SortTracksByPt());
805
806 unsigned icount = 0;
807
808 for(std::vector<const xAOD::TrackParticle *>::const_iterator it1 = selectedTracks.begin(); it1 != selectedTracks.end(); ++it1) {
809 for(std::vector<const xAOD::TrackParticle *>::const_iterator it2 = it1 + 1; it2 != selectedTracks.end(); ++it2) {
810 const xAOD::TrackParticle *track1 = *it1;
811 const xAOD::TrackParticle *track2 = *it2;
812
813 if(!track1 || !track2) {
814 ATH_MSG_WARNING("fit2TrackVertexeses - logic error: TrackParticle null pointer");
815 continue;
816 }
817
818 std::vector<const xAOD::TrackParticle *> fit_tracks = {track1, track2};
819
820 //
821 // Fit new vertex
822 //
823 std::unique_ptr<xAOD::Vertex> vtx = m_vertexFitterTool->fitVertexWithPrimarySeed(
824 ctx, input, fit_tracks, vtxType
825 );
826
827 icount++;
828
829 if(!vtx) {
830 ATH_MSG_WARNING("fit2TrackVertexeses - failed to fit vertex");
831 continue;
832 }
833
834 if(passVertexSelection(vtx.get())) {
835 ATH_MSG_DEBUG("fit2TrackVertexeses - pass vertex: " << vtxAsStr(vtx.get(), true));
836 passVtxs.push_back(std::move(vtx));
837 }
838 }
839 }
840
841 ATH_MSG_DEBUG(name() << "::fit2TrackVertexes - finished processing: " << std::endl
842 << " number of input tracks: " << selectedTracks.size() << std::endl
843 << " number of 2-track combinations: " << icount << std::endl
844 << " number of passed 2-track vertexes: " << passVtxs .size() << std::endl
845 << name() << "::fit2TrackVertexes - all is done" );
846
847 return passVtxs;
848}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
ToolHandle< Prompt::IVertexFittingTool > m_vertexFitterTool
bool passVertexSelection(const xAOD::Vertex *vtx) const
std::string vtxAsStr(const xAOD::Vertex *vtx, bool print_tracks=false)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ fitSeedPlusOtherVertex()

std::unique_ptr< xAOD::Vertex > Prompt::VertexIterativeFitMergingTool::fitSeedPlusOtherVertex ( const EventContext & ctx,
const FittingInput & input,
const xAOD::Vertex * seedVtx,
const xAOD::Vertex * otherVtx,
const VtxType vtxType )
private

Definition at line 711 of file VertexIterativeFitMergingTool.cxx.

718{
719 //
720 // Fit two 2-track vertexes
721 //
722 if(!seedVtx) {
723 ATH_MSG_WARNING("fitSeedPlusOtherVertex - null seed Vertex pointer");
724 return 0;
725 }
726
727 if(!otherVtx) {
728 ATH_MSG_WARNING("fitSeedPlusOtherVertex - null other Vertex pointer");
729 return 0;
730 }
731
732 if(otherVtx->nTrackParticles() != 2) {
733 ATH_MSG_WARNING("fitSeedPlusOtherVertex - other Vertex does not have 2 tracks: ntrack=" << otherVtx->nTrackParticles());
734 return 0;
735 }
736
737 //
738 // Collect tracks from the seed vertex
739 //
740 std::vector<const xAOD::TrackParticle *> tracks;
741
742 for(unsigned k = 0; k < seedVtx->nTrackParticles(); ++k) {
743 const xAOD::TrackParticle *track = seedVtx->trackParticle(k);
744
745 if(track) {
746 tracks.push_back(track);
747 }
748 else {
749 ATH_MSG_WARNING("fitSeedPlusOtherVertex - seed vertex contains TrackParticle null pointer");
750 }
751 }
752
753 //
754 // Collect tracks from other vertices
755 //
756 for(unsigned k = 0; k < otherVtx->nTrackParticles(); ++k) {
757 const xAOD::TrackParticle *track = otherVtx->trackParticle(k);
758
759 if(track) {
760 tracks.push_back(track);
761 }
762 else {
763 ATH_MSG_WARNING("fitSeedPlusOtherVertex - other vertex contains TrackParticle null pointer");
764 }
765 }
766
767 //
768 // Fit new vertex
769 //
770 std::unique_ptr<xAOD::Vertex> secVtx = m_vertexFitterTool->fitVertexWithSeed(
771 ctx, input, tracks, seedVtx->position(), vtxType
772 );
773
774 if(!secVtx) {
775 ATH_MSG_WARNING("fitSeedPlusOtherVertex - failed to fit vertex");
776 return 0;
777 }
778
779 return secVtx;
780}
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
const Amg::Vector3D & position() const
Returns the 3-pos.

◆ fitSeedVertexCluster() [1/2]

xAOD::Vertex * Prompt::VertexIterativeFitMergingTool::fitSeedVertexCluster ( const EventContext & ctx,
const FittingInput & input,
std::unique_ptr< xAOD::Vertex > & seedVtx,
const VtxType vtxType,
std::vector< TwoTrackVtx > & others )
private

Definition at line 558 of file VertexIterativeFitMergingTool.cxx.

564 {
565 // remember the seed vertex before the call
566 xAOD::Vertex* originalSeed = seedVtx.get();
567 // call the original signature
568 xAOD::Vertex* iterationResult = fitSeedVertexCluster(ctx, input,seedVtx.get(), vtxType,others);
569 // if the iteration has finished (it is returning the seed), release the seed vertex.
570 // This will be re-captured by the top level caller after exiting the recursion stack.
571 if (iterationResult == originalSeed) return seedVtx.release();
572 // otherwise, return the iteration result. The seed vertex will be deleted
573 // when the call stack unwinds.
574 else return iterationResult;
575}
xAOD::Vertex * fitSeedVertexCluster(const EventContext &ctx, const FittingInput &input, xAOD::Vertex *seedVtx, const VtxType vtxType, std::vector< TwoTrackVtx > &others)
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ fitSeedVertexCluster() [2/2]

xAOD::Vertex * Prompt::VertexIterativeFitMergingTool::fitSeedVertexCluster ( const EventContext & ctx,
const FittingInput & input,
xAOD::Vertex * seedVtx,
const VtxType vtxType,
std::vector< TwoTrackVtx > & others )
private

Definition at line 435 of file VertexIterativeFitMergingTool.cxx.

442{
443 //
444 // Reached end of the recursive loop
445 //
446 if(others.empty()) {
447 return seedVtx;
448 }
449
450 //
451 // Re-sort other vertices by distance to the seed vertex - needed because seed position changes when vertices are merged
452 //
453 std::sort(others.begin(), others.end(), Prompt::SortTwoTrackVtxByDistToSeed(seedVtx));
454
455 // Take closest vertex
456 xAOD::Vertex* currVtx = others.front().vertex;
457
458 if(!currVtx) {
459 ATH_MSG_WARNING("VertexIterativeFitMergingTool::fitSeedVertexCluster - current vertex is null pointer");
460 return seedVtx;
461 }
462
463 //
464 // Remove closest vertex from the list
465 //
466 others.erase(others.begin());
467
468 /*
469 Found nearby vertex - fit merged vertex
470 */
471 std::unique_ptr<xAOD::Vertex> candVtx =fitSeedPlusOtherVertex(
472 ctx, input, seedVtx, currVtx, vtxType
473 );
474
475 if(!candVtx) {
476 //
477 // Failed to fit new vertex - continue with current seed vertex
478 //
479
480 ATH_MSG_DEBUG("fitSeedVertexCluster - NEW MERGED VERTEX FIT FAILED" << std::endl
481 << "---------------------------------------------------------------------------");
482
483 return fitSeedVertexCluster(ctx, input, std::move(seedVtx), vtxType, others);
484 }
485
486 const double probCand = getVertexFitProb(candVtx.get());
487 const double probSeed = getVertexFitProb(seedVtx);
488
489 double probCandOverSeed = -1.0;
490
491 if(probSeed > 0.0) {
492 probCandOverSeed = probCand/probSeed;
493 }
494
495 const double distToSeed = getDistance(seedVtx, candVtx.get());
496 const double distToCurr = getDistance(currVtx, candVtx.get());
497
498 fillTH1(m_histNewVtxFitChi2, candVtx->chiSquared());
499 fillTH1(m_histNewVtxFitProb, probCand);
500
503 fillTH1(m_histNewVtxFitProbCandOverSeed, probCandOverSeed);
504
505 if(seedVtx->nTrackParticles() > 2) {
507 }
508
509 std::stringstream str;
510
511
512 str << " dist to seed=" << distToSeed << ", probCandOverSeed=" << probCandOverSeed << std::endl
513 << " seed: " << vtxAsStr(seedVtx, false) << std::endl
514 << " curr: " << vtxAsStr(currVtx, true)
515 << " cand: " << vtxAsStr(candVtx.get(), true)
516 << "fitSeedVertexCluster - finished" << std::endl
517 << "---------------------------------------------------------------------------" << std::endl;
518
519
520
521 if(!(passVertexSelection(candVtx.get()) && probCandOverSeed > m_minCandOverSeedFitProbRatio)) {
522 //
523 // New fitted merged vertex failed selection
524 //
525
526 ATH_MSG_DEBUG("fitSeedVertexCluster - FAIL NEW MERGED VERTEX\n" << str.str());
527
528
531
532 //
533 // Continue with current seed vertex
534 //
535 return fitSeedVertexCluster(ctx, input, seedVtx, vtxType, others);
536 }
537
540
541 if(seedVtx->nTrackParticles() > 2) {
543 }
544
545 //
546 // Succesfully fitted new vertex
547 //
548
549 ATH_MSG_DEBUG("fitSeedVertexCluster - PASS NEW MERGED VERTEX" << str.str());
550
551
552 return fitSeedVertexCluster(ctx, input, candVtx, vtxType, others);
553}
std::unique_ptr< xAOD::Vertex > fitSeedPlusOtherVertex(const EventContext &ctx, const FittingInput &input, const xAOD::Vertex *seedVtx, const xAOD::Vertex *otherVtx, const VtxType vtxType)
void fillTH1(TH1 *h, double val, double weight=1.0)
double getVertexFitProb(const xAOD::Vertex *vtx)
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)

◆ getNewMergedVertex()

void Prompt::VertexIterativeFitMergingTool::getNewMergedVertex ( const EventContext & ctx,
xAOD::Vertex * seedVtx,
std::unique_ptr< xAOD::Vertex > & newMergedVtx,
const FittingInput & input,
std::vector< TwoTrackVtx >::iterator & currVit,
std::vector< TwoTrackVtx > & vtxs2Track,
const VtxType vtxType )
private

Definition at line 392 of file VertexIterativeFitMergingTool.cxx.

400 {
401 // Generate a list of 2-track vertices other than the seed vertex
402 std::vector<TwoTrackVtx> others;
403
404 for(std::vector<TwoTrackVtx>::iterator vit = vtxs2Track.begin(); vit != vtxs2Track.end(); ++vit) {
405 if(vit != currVit) {
406 others.push_back(*vit);
407 }
408 }
409
410 // Sort other vertices by distance to the seed vertex
411 std::sort(others.begin(), others.end(), Prompt::SortTwoTrackVtxByDistToSeed(seedVtx));
412
413 // Call recursive function to fit seed+closest vertex pairs
415 ctx, input, seedVtx, vtxType, others
416 );
417
418 /*
419 If the returned vertex is the seed vertex, that means that the
420 vertex could not be merged. We do not want to return it because
421 then we would assign two unique_ptrs to the same underlying
422 vertex object. Instead, we leave newMergedVtx as a nullptr
423
424 If they are different, then we do in fact have a new vertex,
425 and we are safe to encapsulate it in a unique_ptr.
426 */
427 if (mergedVtx == seedVtx){
428 newMergedVtx.reset(nullptr);
429 } else {
430 newMergedVtx.reset(mergedVtx);
431 }
432}

◆ getTracksWithoutVertex()

std::vector< const xAOD::TrackParticle * > Prompt::VertexIterativeFitMergingTool::getTracksWithoutVertex ( const std::vector< xAOD::Vertex * > & passVtxs,
const std::vector< const xAOD::TrackParticle * > & selectedTracks )
private

Definition at line 647 of file VertexIterativeFitMergingTool.cxx.

651{
652 //
653 // Plot unmatched tracks
654 //
655 std::vector<const xAOD::TrackParticle *> tracksWithoutVertex;
656
657 unsigned iCountDoMatch = 0;
658
659 for(const xAOD::TrackParticle *track: selectedTracks) {
660 bool match = false;
661
662 for(const xAOD::Vertex *vtx: passVtxs) {
663 for(unsigned k = 0; k < vtx->nTrackParticles(); ++k) {
664 const xAOD::TrackParticle *vtxTrack = vtx->trackParticle(k);
665
666 if(vtxTrack == track) {
667 match = true;
668 break;
669 }
670 }
671 }
672
673 if(match) {
674 iCountDoMatch++;
675 }
676 else {
677 tracksWithoutVertex.push_back(track);
678 }
679 }
680
681 fillTH1(m_histSelectedTrackCountAll, selectedTracks.size());
683 fillTH1(m_histSelectedTrackCountWithout2Vtx, tracksWithoutVertex.size());
684
685 return tracksWithoutVertex;
686}
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:359

◆ initialize()

StatusCode Prompt::VertexIterativeFitMergingTool::initialize ( )
overridevirtual

Definition at line 27 of file VertexIterativeFitMergingTool.cxx.

28{
29 ATH_CHECK(m_vertexFitterTool.retrieve());
30 ATH_CHECK(m_histSvc.retrieve());
31
32 ATH_CHECK(makeHist(m_histNvtx2TrkInit, "nvtx_2trk_init", 25, -0.5, 24.5));
33 ATH_CHECK(makeHist(m_histNvtx2TrkPass, "nvtx_2trk_pass", 25, -0.5, 24.5));
34 ATH_CHECK(makeHist(m_histNvtx2TrkUnmerged, "nvtx_2trk_unmerged", 25, -0.5, 24.5));
35 ATH_CHECK(makeHist(m_histNvtxMerged, "nvtx_merged", 25, -0.5, 24.5));
36
37 ATH_CHECK(makeHist(m_histNewVtxFitChi2, "newVtxFit_chi2", 100, 0.0, 50.0));
38 ATH_CHECK(makeHist(m_histNewVtxFitProb, "newVtxFit_prob", 100, 0.0, 1.0));
39
40 ATH_CHECK(makeHist(m_histNewVtxFitDistToCurr, "newVtxFit_dist_toCurr", 100, 0.0, 10.0));
41 ATH_CHECK(makeHist(m_histNewVtxFitDistToSeed, "newVtxFit_dist_toSeed", 100, 0.0, 10.0));
42 ATH_CHECK(makeHist(m_histNewVtxFitDistToSeedPass, "newVtxFit_dist_toSeed_pass", 100, 0.0, 10.0));
43 ATH_CHECK(makeHist(m_histNewVtxFitDistToSeedFail, "newVtxFit_dist_toSeed_fail", 100, 0.0, 10.0));
44
45 ATH_CHECK(makeHist(m_histNewVtxFitProbCandOverSeed, "newVtxFit_prob_candOverSeed", 100, 0.0, 4.0));
46 ATH_CHECK(makeHist(m_histNewVtxFitProbCandOverSeedPass, "newVtxFit_prob_candOverSeed_pass", 100, 0.0, 4.0));
47 ATH_CHECK(makeHist(m_histNewVtxFitProbCandOverSeedFail, "newVtxFit_prob_candOverSeed_fail", 100, 0.0, 4.0));
48 ATH_CHECK(makeHist(m_histNewVtxFitProbCandOverSeed3Trk, "newVtxFit_prob_candOverSeed_3trk", 100, 0.0, 4.0));
49 ATH_CHECK(makeHist(m_histNewVtxFitProbCandOverSeed3TrkPass, "newVtxFit_prob_candOverSeed_3trk_pass", 100, 0.0, 4.0));
50
51 ATH_CHECK(makeHist(m_histVtx2TrkPairDist, "Vtx2trkPair_dist", 100, 0.0, 100.0));
52 ATH_CHECK(makeHist(m_histVtx2trkPairDistZoom, "Vtx2trkPair_dist_zoom", 100, 0.0, 10.0));
53 ATH_CHECK(makeHist(m_histVtx2TrkPairSig1, "Vtx2trkPair_sig1", 100, 0.0, 20.0));
54 ATH_CHECK(makeHist(m_histVtx2TrkPairSig2, "Vtx2trkPair_sig2", 100, 0.0, 20.0));
55
56 ATH_CHECK(makeHist(m_histSelectedTrackCountAll, "selectedTrack_CountAll", 25, -0.5, 24.5));
57 ATH_CHECK(makeHist(m_histSelectedTrackCountMatch2Vtx , "selectedTrack_CountMatch2Vtx", 25, -0.5, 24.5));
58 ATH_CHECK(makeHist(m_histSelectedTrackCountWithout2Vtx, "selectedTrack_CountWithout2Vtx", 25, -0.5, 24.5));
59
60 ATH_CHECK(makeHist(m_histVtxWithoutLepton2TrkNTrack, "vtxWithoutLepton2trk_NTrack", 25, -0.5, 24.5));
61 ATH_CHECK(makeHist(m_histVtxWithoutLepton2TrkNPass, "vtxWithoutLepton2trk_NPass", 25, -0.5, 24.5));
62 ATH_CHECK(makeHist(m_histVtxWithoutLepton2TrkNPassUnmerged, "vtxWithoutLepton2trk_NPassUnmerged", 25, -0.5, 24.5));
63 ATH_CHECK(makeHist(m_histVtxWithoutLepton2TrkNMerged, "vtxWithoutLepton2trk_NMerged", 25, -0.5, 24.5));
64
65 return StatusCode::SUCCESS;
66}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode makeHist(TH1 *&h, const std::string &key, int nbin, double xmin, double xmax)

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

◆ makeHist()

StatusCode Prompt::VertexIterativeFitMergingTool::makeHist ( TH1 *& h,
const std::string & key,
int nbin,
double xmin,
double xmax )
private

Definition at line 851 of file VertexIterativeFitMergingTool.cxx.

852{
853 //
854 // Initiliase histogram pointer. If configured to run in validation mode, then create and register histogram
855 //
856 h = 0;
857
858 if(m_outputStream.empty() || key.empty()) {
859 return StatusCode::SUCCESS;
860 }
861
862 const std::string hname = name() + "_" + key;
863 const std::string hist_key = "/"+m_outputStream+"/"+hname;
864
865 h = new TH1D(hname.c_str(), hname.c_str(), nbin, xmin, xmax);
866 h->SetDirectory(0);
867
868 return m_histSvc->regHist(hist_key, h);
869}
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60

◆ mergeInitVertices()

Prompt::MergeResultNotOwner Prompt::VertexIterativeFitMergingTool::mergeInitVertices ( const EventContext & ctx,
const FittingInput & input,
const xAOD::TrackParticle * tracklep,
std::vector< std::unique_ptr< xAOD::Vertex > > & initVtxs,
const std::vector< const xAOD::TrackParticle * > & selectedTracks )
overridevirtual

Implements Prompt::IVertexMergingTool.

Definition at line 68 of file VertexIterativeFitMergingTool.cxx.

75{
76 //
77 // Merge initial (2-track) vertices into new merged vertices with three tracks or more
78 //
79
80 ATH_MSG_DEBUG("===========================================================================" << std::endl
81 << name() << "::mergeInitVertices - start processing");
82
83
84 /*
85 We store the initial vertices that pass selection in their own list
86 with ownership, as this needs to be passed later to the MergeResults.
87 */
88 MergeResultNotOwner result;
89 std::vector<std::unique_ptr<xAOD::Vertex>> vtxsInitPassed;
90
91 for(std::unique_ptr<xAOD::Vertex> &vtx: initVtxs) {
92 if(passVertexSelection(vtx.get())) {
93 ATH_MSG_DEBUG("pushing vertex into result.vtxInitPassed");
94 result.vtxsInitPassed.push_back(vtx.get());
95 vtxsInitPassed.push_back(std::move(vtx));
96 }
97 }
98
99 const unsigned nvtxInit = initVtxs.size();
100 const unsigned nvtxPass = result.vtxsInitPassed.size();
101
102 fillTH1(m_histNvtx2TrkInit, nvtxInit);
103
104 //
105 // Find tracks that do not form 2-track vertex with lepton track
106 //
107 ATH_MSG_DEBUG(name() << "::mergeInitVertices - processes vertexes without lepton");
108
109 std::vector<const xAOD::TrackParticle *> tracksWithoutVertex = getTracksWithoutVertex(
110 result.vtxsInitPassed, selectedTracks
111 );
112
113 // Rank the tracks by pT, will keep the top `m_maxExtraTracks` tracks
114 // for fitting vertexes without lepton
115 if(tracksWithoutVertex.size() > m_maxExtraTracks) {
116 ATH_MSG_DEBUG(" number of tracks without good lepton+track vertex: " << tracksWithoutVertex.size() << std::endl
117 << " will only keep the top " << m_maxExtraTracks << " tracks");
118
119 std::sort(tracksWithoutVertex.begin(), tracksWithoutVertex.end(), Prompt::SortByIDTrackPt());
120
121 tracksWithoutVertex.erase(tracksWithoutVertex.begin() + m_maxExtraTracks, tracksWithoutVertex.end());
122 }
123
124
125 MergeResultNotOwner resultExtra;
126 std::vector<std::unique_ptr<xAOD::Vertex>> twoTrackVtxInit = fit2TrackVertexes(ctx, input, tracksWithoutVertex, Prompt::kTwoTrackVtxWithoutLepton);
127
129 name() << "::mergeInitVertices - will merge vertexes without lepton" << std::endl
130 << " number of selected tracks without good lepton+track vertex: "
131 << tracksWithoutVertex .size() << std::endl
132 << " number of 2-track vertexes without lepton: "
133 << resultExtra.vtxsInitPassed.size()
134 );
135
136 //
137 // Merge 2-track vertex without lepton only when there are two or more vertices
138 //
139 mergeIteratively2TrackVtxs(ctx, input, twoTrackVtxInit, resultExtra, Prompt::kIterativeFitVtxWithoutLepton);
140
141 if(resultExtra.vtxsInitPassed.size() > 1) {
142 //
143 // Fill histograms only when there are two or more vertices
144 //
145 fillTH1(m_histVtxWithoutLepton2TrkNTrack, tracksWithoutVertex.size());
146 fillTH1(m_histVtxWithoutLepton2TrkNPass, resultExtra.vtxsInitPassed.size());
147 fillTH1(m_histVtxWithoutLepton2TrkNPassUnmerged, resultExtra.vtxsInitPassedNotMerged.size());
148 fillTH1(m_histVtxWithoutLepton2TrkNMerged, resultExtra.vtxsNewMerged.size());
149 }
150
151 ATH_MSG_DEBUG(name() << "::mergeInitVertices - finished merging vertexes without lepton" << std::endl
152 << " number of tracks without good lepton+track vertex: " << tracksWithoutVertex.size() << std::endl
153 << " number of 2-track vertexes without lepton: " << resultExtra.vtxsInitPassed.size() << std::endl
154 << " number of unmerged 2-track vertexes without lepton: " << resultExtra.vtxsInitPassedNotMerged.size() << std::endl
155 << " number of merged vertexes without lepton: " << resultExtra.vtxsNewMerged.size());
156
157 //
158 // Next, processes 2-track vertexes that contain lepton track
159 //
160 ATH_MSG_DEBUG("===========================================================================" << std::endl
161 << name() << "::mergeInitVertices - process 2-track vertexes with lepton" << std::endl
162 << " lepton track pT=" << tracklep->pt() << std::endl
163 << " number of initial 2-track vertices: " << initVtxs.size() << std::endl
164 << " number of selected 2-track vertices: " << result.vtxsInitPassed.size() << std::endl
165 << " number of selected ID tracks: " << selectedTracks.size() );
166
167 //
168 // Merge 2-track vertexes that contain lepton track
169 //
170 mergeIteratively2TrackVtxs(ctx, input, vtxsInitPassed, result, Prompt::kIterativeFitVtx);
171
172 if(result.vtxsInitPassed.size() > 1) {
173 //
174 // Fill histograms only when there are at least two vertexes to merge
175 //
176 fillTH1(m_histNvtx2TrkPass, nvtxPass);
177 fillTH1(m_histNvtx2TrkUnmerged, result.vtxsInitPassedNotMerged.size());
178 fillTH1(m_histNvtxMerged, result.vtxsNewMerged .size());
179 }
180
181 //
182 // Erase vector of 2-track vertices without lepton that were merged
183 //
184 resultExtra.vtxsInitPassed.clear();
185
186 //
187 // Add vertices without lepton track to result
188 //
189 result.vtxsInitPassedNotMerged.insert(
190 result.vtxsInitPassedNotMerged.end(),
191 std::make_move_iterator(resultExtra.vtxsInitPassedNotMerged.begin()),
192 std::make_move_iterator(resultExtra.vtxsInitPassedNotMerged.end())
193 );
194
195 result.vtxsNewMerged.insert(
196 result.vtxsNewMerged.end(),
197 std::make_move_iterator(resultExtra.vtxsNewMerged.begin()),
198 std::make_move_iterator(resultExtra.vtxsNewMerged.end())
199 );
200
201 ATH_MSG_DEBUG("==========================================" << std::endl
202 << "mergeInitVertices report" << std::endl
203 << " \tnumber of initial 2-track vertices: "
204 << initVtxs.size() << std::endl
205 << "\tnumber of passed 2-track vertices: "
206 << result.vtxsInitPassed.size() << std::endl
207 << "\tnumber of unmerged 2-track vertices: "
208 << result.vtxsInitPassedNotMerged.size() << std::endl
209 << "\tnumber of merged vertices: "
210 << result.vtxsNewMerged.size() << std::endl
211 << std::endl
212 << "\tnumber of tracks without good lepton+track vertex: "
213 << tracksWithoutVertex.size() << std::endl
214 << "\tnumber of 2-track vertexes without lepton: "
215 << resultExtra.vtxsInitPassed.size() << std::endl
216 << "\tnumber of unmerged 2-track vertexes without lepton: "
217 << resultExtra.vtxsInitPassedNotMerged.size() << std::endl
218 << "\tnumber of merged vertexes without lepton: "
219 << resultExtra.vtxsNewMerged.size() << std::endl
220 << name() << "::mergeInitVertices - ALL DONE" << std::endl
221 << "=========================================="
222 );
223
224
225 return result;
226}
size_t size() const
Number of registered mappings.
std::vector< const xAOD::TrackParticle * > getTracksWithoutVertex(const std::vector< xAOD::Vertex * > &passVtxs, const std::vector< const xAOD::TrackParticle * > &selectedTracks)
std::vector< std::unique_ptr< xAOD::Vertex > > fit2TrackVertexes(const EventContext &ctx, const FittingInput &input, std::vector< const xAOD::TrackParticle * > &selectedTracks, const VtxType vtxType)
bool mergeIteratively2TrackVtxs(const EventContext &ctx, const FittingInput &input, std::vector< std::unique_ptr< xAOD::Vertex > > &initVtxs, MergeResultNotOwner &result, const VtxType vtxType)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
@ kTwoTrackVtxWithoutLepton
@ kIterativeFitVtxWithoutLepton

◆ mergeIteratively2TrackVtxs()

bool Prompt::VertexIterativeFitMergingTool::mergeIteratively2TrackVtxs ( const EventContext & ctx,
const FittingInput & input,
std::vector< std::unique_ptr< xAOD::Vertex > > & initVtxs,
MergeResultNotOwner & result,
const VtxType vtxType )
private

Definition at line 228 of file VertexIterativeFitMergingTool.cxx.

235{
236 /*
237 This function merges iteratively vertexes with this algorithm:
238 o) Sort 2-track vertexes by sum of track pT
239 o) Select the vertex with the highest sum of track pT as the seed vertex
240 - Sort all other vertexes by the distance to the seed vertex
241 - Add tracks from the closest vertex to the selected vertex
242 - Fit new vertex:
243 -- if the new vertex passes cuts, select as the new seed vertex
244 -- if the new vertex fails cuts, continue with the original seed vertex
245 -- Remove this closest vertex from the list
246 - Resort remaining tracks by the distance to the seed vertex and repeat
247 o) Remove the 2-track vertexes that were merged from the global list and repeat
248 */
249 /*
250 fit2TrackVertexes() only returns a vector of owning pointers. It does
251 not populate resultExtra.vtxsInitPassed, so a call to this function the first time
252 (without lepton) has empty resultExtra.vtxsInitPassed; testing vtxsInitPassed.size() means
253 that vertices without the lepton would never be merged.
254 */
255 // Only 0 or 1 2-track vertices - add the vertex to not merged list and return
256 if(initVtxs.size() < 2) {
257 for (auto & vtx: initVtxs){
258 result.vtxsInitPassedNotMerged.push_back(std::move(vtx));
259 }
260 initVtxs.clear();
261
262 ATH_MSG_DEBUG(name() << "::mergeIteratively2TrackVtxs - too few vertexes: nothing more to do");
263
264 return false;
265 }
266
267 //
268 // Make 2-track vertex data structures
269 //
270 std::vector<TwoTrackVtx> vtxs2Track;
271
272 for(std::unique_ptr<xAOD::Vertex> &vtx: initVtxs) {
273
274 if(vtx->nTrackParticles() !=2 ) {
275 ATH_MSG_WARNING("mergeIteratively2TrackVtxs - vertex does not contain 2 TrackParticles: ntrack=" << vtx->nTrackParticles());
276 continue;
277 }
278
279 TwoTrackVtx vtx2track;
280 vtx2track.trackId0 = vtx->trackParticle(0);
281 vtx2track.trackId1 = vtx->trackParticle(1);
282
283 if(!vtx2track.trackId0 || !vtx2track.trackId1) {
284 ATH_MSG_WARNING("mergeIteratively2TrackVtxs - failed to find TrackParticles for 2-track vertex");
285 continue;
286 }
287
288 vtx2track.vertex = vtx.get();
289 vtx2track.vertexFitProb = Prompt::getVertexFitProb(vtx.get());
290 vtx2track.sumTrackPt = vtx2track.trackId0->pt() + vtx2track.trackId1->pt();
291
292 vtxs2Track.push_back(vtx2track);
293 }
294
295 ATH_MSG_DEBUG(name() << "::mergeIteratively2TrackVtxs - start processing with " << vtxs2Track.size() << " input vertexes ");
296
297 if(vtxs2Track.size() < 2) {
298 ATH_MSG_WARNING("mergeIteratively2TrackVtxs - logic error: found only " << vtxs2Track.size() << " 2-track vertex");
299 return false;
300 }
301
302 //
303 // Sort 2-track vertexes by ID track pT
304 //
305 std::sort(vtxs2Track.begin(), vtxs2Track.end(), Prompt::SortTwoTrackVtxBySumTrackPt());
306
307 ATH_MSG_DEBUG(name() << "::mergeIteratively2TrackVtxs - number of 2 track passed vertexes=" << vtxs2Track.size());
308
309 for(const TwoTrackVtx &vtx: vtxs2Track) {
310 ATH_MSG_DEBUG("Input vertex with 2 tracks sum pT=" << vtx.sumTrackPt << "\n " << vtxAsStr(vtx.vertex, true));
311 }
312
313 //
314 // Plot distances between all unique pairs of 2-track vertexes
315 //
316 plotVertexDistances(vtxs2Track);
317
318 //
319 // Iterative fit vertices for merging:
320 //
321 std::vector<TwoTrackVtx>::iterator currVit = vtxs2Track.begin();
322
323 /*
324 Seed new vertex with 2-track vertex containing
325 highest pT ID track (non-lepton track)
326 */
327 while(currVit != vtxs2Track.end()) {
328 xAOD::Vertex* seedVtx = currVit->vertex;
329
330 /*
331 We potentially generate a new vertex here,
332 so it has to be a unique_ptr. If the vertex could not be merged,
333 then the newMergedVtx will remain a nullptr.
334 */
335 std::unique_ptr<xAOD::Vertex> newMergedVtx = nullptr;
337 ctx, seedVtx, newMergedVtx, input, currVit, vtxs2Track, vtxType
338 );
339
340 // Check to see if the new merged vertex is not a nullptr
341 // (i.e., if the vertex could be merged)
342 if(newMergedVtx) {
343 // Remove 2-track vertexes that were merged
344 removeMerged2TrackVertexes(newMergedVtx.get(), vtxs2Track);
345
346 // Reset current vertex iterator to beginning
347 currVit = vtxs2Track.begin();
348
349 ATH_MSG_DEBUG(name() << "::mergeIteratively2TrackVtxs - new merged vertex:\n" << vtxAsStr(newMergedVtx.get(), false));
350
351 // Save new merged vertex (it is new because it is distinct from seed vertex)
352 result.vtxsNewMerged.push_back(std::move(newMergedVtx));
353 }
354 else {
355 //
356 // This vertex could not be merged - try next one
357 //
358 ++currVit;
359
360 ATH_MSG_DEBUG(name() << "::mergeIteratively2TrackVtxs - could not merge 2-track vertex:\n" << vtxAsStr(seedVtx, false));
361 }
362 }
363
364 //
365 // Record unmerged two-track vertexes
366 //
367 for(std::unique_ptr<xAOD::Vertex> &vtxUniquePtr: initVtxs) {
368 for(TwoTrackVtx &vtx: vtxs2Track) {
369 if (vtxUniquePtr.get() == vtx.vertex){
370 result.vtxsInitPassedNotMerged.push_back(std::move(vtxUniquePtr));
371
372 ATH_MSG_DEBUG("Unmerged " << vtxAsStr(vtx.vertex, true));
373 }
374 }
375 }
376
377 ATH_MSG_DEBUG(name() << "::mergeIteratively2TrackVtxs - finished processing:" << std::endl
378 << " number of unmerged 2-track vertexes=" << vtxs2Track .size() << std::endl
379 << " number of merged vertexes=" << result.vtxsNewMerged.size() );
380
381 for(TwoTrackVtx &vtx: vtxs2Track) {
382 ATH_MSG_DEBUG("Unmerged " << vtxAsStr(vtx.vertex, true));
383 }
384
385 for(const std::unique_ptr<xAOD::Vertex>& vtx: result.vtxsNewMerged) {
386 ATH_MSG_DEBUG("Merged " << vtxAsStr(vtx.get(), true));
387 }
388
389 return true;
390}
void plotVertexDistances(const std::vector< TwoTrackVtx > &others)
void getNewMergedVertex(const EventContext &ctx, xAOD::Vertex *seedVtx, std::unique_ptr< xAOD::Vertex > &newMergedVtx, const FittingInput &input, std::vector< TwoTrackVtx >::iterator &currVit, std::vector< TwoTrackVtx > &vtxs2Track, const VtxType vtxType)
unsigned removeMerged2TrackVertexes(const xAOD::Vertex *mergedVtx, std::vector< TwoTrackVtx > &vtxs) const

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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::VertexIterativeFitMergingTool::passVertexSelection ( const xAOD::Vertex * vtx) const
private

Definition at line 689 of file VertexIterativeFitMergingTool.cxx.

690{
691 //
692 // Check whether vertex passes quality cuts
693 //
694 if(!vtx) {
695 ATH_MSG_WARNING("passVertexSelection - input vertex is null pointer");
696 return false;
697 }
698
699 if(!(vtx->numberDoF() > 0 && vtx->chiSquared() >= 0)) {
700 return false;
701 }
702
703 const double fitProb = Prompt::getVertexFitProb(vtx);
704
705 ATH_MSG_DEBUG("passVertexSelection - vertex pointer=" << vtx << " chi2/ndof=" << vtx->chiSquared() << "/" << vtx->numberDoF() << ", prob=" << fitProb);
706
707 return fitProb > m_minFitProb;
708}
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
float chiSquared() const
Returns the of the vertex fit as float.

◆ plotVertexDistances()

void Prompt::VertexIterativeFitMergingTool::plotVertexDistances ( const std::vector< TwoTrackVtx > & others)
private

Definition at line 629 of file VertexIterativeFitMergingTool.cxx.

631 {
632 for(std::vector<TwoTrackVtx>::const_iterator fit = others.begin(); fit != others.end(); ++fit) {
633 for(std::vector<TwoTrackVtx>::const_iterator sit = fit+1; sit != others.end(); ++sit) {
634 const double dist = Prompt::getDistance(fit->vertex, sit->vertex);
635 const double sig1 = Prompt::getNormDist(fit->vertex->position(), sit->vertex->position(), fit->vertex->covariance(), msg(MSG::WARNING));
636 const double sig2 = Prompt::getNormDist(fit->vertex->position(), sit->vertex->position(), sit->vertex->covariance(), msg(MSG::WARNING));
637
642 }
643 }
644}
MsgStream & msg() const
double getNormDist(const Amg::Vector3D &PrimVtx, const Amg::Vector3D &SecVtx, const std::vector< float > &ErrorMatrix, MsgStream &msg)

◆ removeMerged2TrackVertexes()

unsigned Prompt::VertexIterativeFitMergingTool::removeMerged2TrackVertexes ( const xAOD::Vertex * mergedVtx,
std::vector< TwoTrackVtx > & vtxs ) const
private

Definition at line 577 of file VertexIterativeFitMergingTool.cxx.

580 {
581 if(!mergedVtx) {
582 ATH_MSG_WARNING("VertexIterativeFitMergingTool::removeMerged2TrackVertexes - merged vertex is null pointer");
583 return 0;
584 }
585
586 unsigned icount = 0;
587 std::vector<TwoTrackVtx>::iterator vit = vtxs.begin();
588
589 while(vit != vtxs.end()) {
590 int iCountMatchedTrack = 0;
591
592 for(unsigned k = 0; k < mergedVtx->nTrackParticles(); ++k) {
593 const xAOD::TrackParticle *track = mergedVtx->trackParticle(k);
594
595 if(!track) {
596 ATH_MSG_WARNING("removeMerged2TrackVertexes - merged vertex contains null TrackParticle pointer");
597 continue;
598 }
599
600 if(vit->trackId0 == track) { iCountMatchedTrack++; }
601 if(vit->trackId1 == track) { iCountMatchedTrack++; }
602 }
603
604 if(iCountMatchedTrack == 2) {
605 //
606 // Found 2-track vertex that was merged - remove this vertex
607 //
608 vit = vtxs.erase(vit);
609 icount++;
610
611 ATH_MSG_DEBUG("removeMerged2TrackVertexes - removed merged 2-track vertex");
612 }
613 else {
614 ++vit;
615
616 ATH_MSG_DEBUG("removeMerged2TrackVertexes - skip unmerged 2-track vertex");
617 }
618 }
619
621 name() << "::removeMerged2TrackVertexes - merged vertex ntrack=" << mergedVtx->nTrackParticles()
622 << ", removed " << icount << " merged 2-track vertexes"
623 );
624
625 return icount;
626}

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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)

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ 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 asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_histNewVtxFitChi2

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitChi2 {}
private

Definition at line 247 of file VertexIterativeFitMergingTool.h.

247{};

◆ m_histNewVtxFitDistToCurr

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitDistToCurr {}
private

Definition at line 250 of file VertexIterativeFitMergingTool.h.

250{};

◆ m_histNewVtxFitDistToSeed

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitDistToSeed {}
private

Definition at line 251 of file VertexIterativeFitMergingTool.h.

251{};

◆ m_histNewVtxFitDistToSeedFail

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitDistToSeedFail {}
private

Definition at line 253 of file VertexIterativeFitMergingTool.h.

253{};

◆ m_histNewVtxFitDistToSeedPass

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitDistToSeedPass {}
private

Definition at line 252 of file VertexIterativeFitMergingTool.h.

252{};

◆ m_histNewVtxFitProb

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitProb {}
private

Definition at line 248 of file VertexIterativeFitMergingTool.h.

248{};

◆ m_histNewVtxFitProbCandOverSeed

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitProbCandOverSeed {}
private

Definition at line 255 of file VertexIterativeFitMergingTool.h.

255{};

◆ m_histNewVtxFitProbCandOverSeed3Trk

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitProbCandOverSeed3Trk {}
private

Definition at line 258 of file VertexIterativeFitMergingTool.h.

258{};

◆ m_histNewVtxFitProbCandOverSeed3TrkPass

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitProbCandOverSeed3TrkPass {}
private

Definition at line 259 of file VertexIterativeFitMergingTool.h.

259{};

◆ m_histNewVtxFitProbCandOverSeedFail

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitProbCandOverSeedFail {}
private

Definition at line 257 of file VertexIterativeFitMergingTool.h.

257{};

◆ m_histNewVtxFitProbCandOverSeedPass

TH1* Prompt::VertexIterativeFitMergingTool::m_histNewVtxFitProbCandOverSeedPass {}
private

Definition at line 256 of file VertexIterativeFitMergingTool.h.

256{};

◆ m_histNvtx2TrkInit

TH1* Prompt::VertexIterativeFitMergingTool::m_histNvtx2TrkInit {}
private

Definition at line 242 of file VertexIterativeFitMergingTool.h.

242{};

◆ m_histNvtx2TrkPass

TH1* Prompt::VertexIterativeFitMergingTool::m_histNvtx2TrkPass {}
private

Definition at line 243 of file VertexIterativeFitMergingTool.h.

243{};

◆ m_histNvtx2TrkUnmerged

TH1* Prompt::VertexIterativeFitMergingTool::m_histNvtx2TrkUnmerged {}
private

Definition at line 244 of file VertexIterativeFitMergingTool.h.

244{};

◆ m_histNvtxMerged

TH1* Prompt::VertexIterativeFitMergingTool::m_histNvtxMerged {}
private

Definition at line 245 of file VertexIterativeFitMergingTool.h.

245{};

◆ m_histSelectedTrackCountAll

TH1* Prompt::VertexIterativeFitMergingTool::m_histSelectedTrackCountAll {}
private

Definition at line 266 of file VertexIterativeFitMergingTool.h.

266{};

◆ m_histSelectedTrackCountMatch2Vtx

TH1* Prompt::VertexIterativeFitMergingTool::m_histSelectedTrackCountMatch2Vtx {}
private

Definition at line 267 of file VertexIterativeFitMergingTool.h.

267{};

◆ m_histSelectedTrackCountWithout2Vtx

TH1* Prompt::VertexIterativeFitMergingTool::m_histSelectedTrackCountWithout2Vtx {}
private

Definition at line 268 of file VertexIterativeFitMergingTool.h.

268{};

◆ m_histSvc

ServiceHandle<ITHistSvc> Prompt::VertexIterativeFitMergingTool::m_histSvc
private
Initial value:
{
this, "THistSvc", "THistSvc/THistSvc"
}

Definition at line 219 of file VertexIterativeFitMergingTool.h.

219 {
220 this, "THistSvc", "THistSvc/THistSvc"
221 };

◆ m_histVtx2TrkPairDist

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtx2TrkPairDist {}
private

Definition at line 261 of file VertexIterativeFitMergingTool.h.

261{};

◆ m_histVtx2trkPairDistZoom

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtx2trkPairDistZoom {}
private

Definition at line 262 of file VertexIterativeFitMergingTool.h.

262{};

◆ m_histVtx2TrkPairSig1

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtx2TrkPairSig1 {}
private

Definition at line 263 of file VertexIterativeFitMergingTool.h.

263{};

◆ m_histVtx2TrkPairSig2

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtx2TrkPairSig2 {}
private

Definition at line 264 of file VertexIterativeFitMergingTool.h.

264{};

◆ m_histVtxWithoutLepton2TrkNMerged

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtxWithoutLepton2TrkNMerged {}
private

Definition at line 273 of file VertexIterativeFitMergingTool.h.

273{};

◆ m_histVtxWithoutLepton2TrkNPass

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtxWithoutLepton2TrkNPass {}
private

Definition at line 271 of file VertexIterativeFitMergingTool.h.

271{};

◆ m_histVtxWithoutLepton2TrkNPassUnmerged

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtxWithoutLepton2TrkNPassUnmerged {}
private

Definition at line 272 of file VertexIterativeFitMergingTool.h.

272{};

◆ m_histVtxWithoutLepton2TrkNTrack

TH1* Prompt::VertexIterativeFitMergingTool::m_histVtxWithoutLepton2TrkNTrack {}
private

Definition at line 270 of file VertexIterativeFitMergingTool.h.

270{};

◆ m_maxExtraTracks

Gaudi::Property<unsigned> Prompt::VertexIterativeFitMergingTool::m_maxExtraTracks
private
Initial value:
{
this, "maxExtraTracks", 10,
"maximum number of tracks without good lepton+track vertex that we will used for further fitting of vertexes without lepton"
}

Definition at line 230 of file VertexIterativeFitMergingTool.h.

230 {
231 this, "maxExtraTracks", 10,
232 "maximum number of tracks without good lepton+track vertex that we will used for further fitting of vertexes without lepton"
233 };

◆ m_minCandOverSeedFitProbRatio

Gaudi::Property<double> Prompt::VertexIterativeFitMergingTool::m_minCandOverSeedFitProbRatio
private
Initial value:
{
this, "minCandOverSeedFitProbRatio", 0.2,
"minimum requirement of the fit probability of new merged vertex / fit probability of seed vertex"
}

Definition at line 226 of file VertexIterativeFitMergingTool.h.

226 {
227 this, "minCandOverSeedFitProbRatio", 0.2,
228 "minimum requirement of the fit probability of new merged vertex / fit probability of seed vertex"
229 };

◆ m_minFitProb

Gaudi::Property<double> Prompt::VertexIterativeFitMergingTool::m_minFitProb
private
Initial value:
{this, "minFitProb", 0.01,
"minimum fit probability requirement for a vertex"
}

Definition at line 223 of file VertexIterativeFitMergingTool.h.

223 {this, "minFitProb", 0.01,
224 "minimum fit probability requirement for a vertex"
225 };

◆ m_outputStream

Gaudi::Property<std::string> Prompt::VertexIterativeFitMergingTool::m_outputStream
private
Initial value:
{
this, "outputStream", ""
}

Definition at line 235 of file VertexIterativeFitMergingTool.h.

235 {
236 this, "outputStream", ""
237 };

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vertexFitterTool

ToolHandle<Prompt::IVertexFittingTool> Prompt::VertexIterativeFitMergingTool::m_vertexFitterTool
private
Initial value:
{
this, "VertexFittingTool",
"Prompt::VertexFittingTool/VertexFittingTool"
}

Definition at line 215 of file VertexIterativeFitMergingTool.h.

215 {
216 this, "VertexFittingTool",
217 "Prompt::VertexFittingTool/VertexFittingTool"
218 };

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: