ATLAS Offline Software
Loading...
Searching...
No Matches
VKalVrtAthena::VrtSecInclusive Class Reference

#include <VrtSecInclusive.h>

Inheritance diagram for VKalVrtAthena::VrtSecInclusive:

Classes

struct  JobProperties
struct  track_summary_properties
struct  WrkVrt

Public Member Functions

 VrtSecInclusive (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor.
 ~VrtSecInclusive ()
 Default Destructor.
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode execute ()
virtual StatusCode initEvent ()
template<class TrackT>
void getIntersection (TrackT *trk, vector< IntersectionPos * > &layers, const Trk::Perigee *per)
template<class TrackT>
void setIntersection (TrackT *trk, IntersectionPos *layer, const Trk::Perigee *per)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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 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

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

enum  TrkParameter {
  k_d0 =0 , k_z0 =1 , k_theta =2 , k_phi =3 ,
  k_qOverP =4 , k_nTP =5
}
enum  TrkParameterUnc { k_d0d0 =0 , k_z0z0 =1 , k_nTPU =2 }
enum  mergeStep {
  RECONSTRUCT_NTRK , REASSEMBLE , SHUFFLE1 , SHUFFLE2 ,
  SHUFFLE3 , FINAL
}
using PatternStrategyFunc = bool (VrtSecInclusive::*) ( const xAOD::TrackParticle *trk, const Amg::Vector3D& vertex )
using IPDecoratorType = SG::AuxElement::Decorator< std::vector< std::vector<float> > >
using VertexELType = SG::AuxElement::Decorator< std::vector<ElementLink< xAOD::VertexContainer > > >
using Detector = int
using Bec = int
using Layer = int
using Flag = int
using ExtrapolatedPoint = std::tuple<const TVector3, Detector, Bec, Layer, Flag>
using ExtrapolatedPattern = std::vector< ExtrapolatedPoint >
using PatternBank = std::map<const xAOD::TrackParticle*, std::pair< std::unique_ptr<ExtrapolatedPattern>, std::unique_ptr<ExtrapolatedPattern> > >
using TrackSelectionAlg = StatusCode (VrtSecInclusive::*)()
using CutFunc = bool (VrtSecInclusive::*) ( const xAOD::TrackParticle* ) const
 track selection
using vertexingAlg = StatusCode (VrtSecInclusive::*)( std::vector<WrkVrt>* )
using AlgForVerticesPair = double (VrtSecInclusive::*)( const WrkVrt&, const WrkVrt& ) const
typedef struct VKalVrtAthena::VrtSecInclusive::track_summary_properties track_summary
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void declareProperties ()
StatusCode addEventInfo ()
StatusCode setupNtupleVariables ()
StatusCode setupNtuple ()
StatusCode clearNtupleVariables ()
StatusCode deleteNtupleVariables ()
StatusCode processPrimaryVertices ()
StatusCode fillAANT_SelectedBaseTracks ()
StatusCode fillAANT_SecondaryVertices (xAOD::VertexContainer *)
void selectTrack (const xAOD::TrackParticle *)
 Vertexing Algorithm Member Functions.
StatusCode selectTracksInDet ()
StatusCode selectTracksFromMuons ()
StatusCode selectTracksFromElectrons ()
StatusCode selectInDetAndGSFTracks ()
bool selectTrack_notPVassociated (const xAOD::TrackParticle *) const
 track-by-track selection strategies
bool selectTrack_pTCut (const xAOD::TrackParticle *) const
bool selectTrack_chi2Cut (const xAOD::TrackParticle *) const
bool selectTrack_hitPattern (const xAOD::TrackParticle *) const
bool selectTrack_hitPatternTight (const xAOD::TrackParticle *) const
bool selectTrack_d0Cut (const xAOD::TrackParticle *) const
bool selectTrack_z0Cut (const xAOD::TrackParticle *) const
bool selectTrack_d0errCut (const xAOD::TrackParticle *) const
bool selectTrack_z0errCut (const xAOD::TrackParticle *) const
bool selectTrack_LRTR3Cut (const xAOD::TrackParticle *) const
StatusCode extractIncompatibleTrackPairs (std::vector< WrkVrt > *)
 related to the graph method and verte finding
StatusCode findNtrackVertices (std::vector< WrkVrt > *)
StatusCode rearrangeTracks (std::vector< WrkVrt > *)
StatusCode reassembleVertices (std::vector< WrkVrt > *)
 attempt to merge vertices when all tracks of a vertex A is close to vertex B in terms of impact parameter
StatusCode mergeByShuffling (std::vector< WrkVrt > *)
 attempt to merge splitted vertices when they are significantly distant due to the long-tail behavior of the vertex reconstruction resolution
StatusCode mergeFinalVertices (std::vector< WrkVrt > *)
 attempt to merge vertices by lookng at the distance between two vertices
StatusCode associateNonSelectedTracks (std::vector< WrkVrt > *)
 in addition to selected tracks, associate as much tracks as possible
StatusCode refitAndSelectGoodQualityVertices (std::vector< WrkVrt > *)
 finalization of the vertex and store to xAOD::VertexContainer
bool getSVImpactParameters (const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex, std::vector< double > &impactParameters, std::vector< double > &impactParErrors)
 get secondary vertex impact parameters
void printWrkSet (const std::vector< WrkVrt > *WrkVrtSet, const std::string &name)
 print the contents of reconstructed vertices
StatusCode refitVertex (WrkVrt &)
 refit the vertex.
StatusCode refitVertex (WrkVrt &, Trk::IVKalState &istate)
StatusCode refitVertexWithSuggestion (WrkVrt &, const Amg::Vector3D &)
 refit the vertex with suggestion
StatusCode refitVertexWithSuggestion (WrkVrt &, const Amg::Vector3D &, Trk::IVKalState &istate)
double improveVertexChi2 (WrkVrt &)
 attempt to improve the vertex chi2 by removing the most-outlier track one by one until the vertex chi2 satisfies a certain condition.
StatusCode disassembleVertex (std::vector< WrkVrt > *, const unsigned &vertexIndex)
void trackClassification (std::vector< WrkVrt > *, std::map< long int, std::vector< long int > > &)
double findWorstChi2ofMaximallySharedTrack (std::vector< WrkVrt > *, std::map< long int, std::vector< long int > > &, long int &, long int &)
double significanceBetweenVertices (const WrkVrt &, const WrkVrt &) const
 calculate the significance (Mahalanobis distance) between two reconstructed vertices
double distanceBetweenVertices (const WrkVrt &, const WrkVrt &) const
 calculate the physical distance
double findMinVerticesPair (std::vector< WrkVrt > *, std::pair< unsigned, unsigned > &, const AlgForVerticesPair &)
 returns the pair of vertices that give minimum in terms of some observable (e.g.
StatusCode mergeVertices (WrkVrt &destination, WrkVrt &source)
 the 2nd vertex is merged into the 1st vertex.
ExtrapolatedPatternextrapolatedPattern (const xAOD::TrackParticle *, enum Trk::PropDirection)
bool patternCheck (const uint32_t &pattern, const Amg::Vector3D &vertex)
bool patternCheckOuterOnly (const uint32_t &pattern, const Amg::Vector3D &vertex)
bool checkTrackHitPatternToVertex (const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
 A classical method with hard-coded geometry.
bool checkTrackHitPatternToVertexOuterOnly (const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
 A classical method with hard-coded geometry.
bool checkTrackHitPatternToVertexByExtrapolation (const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
 New method with track extrapolation.
bool checkTrackHitPatternToVertexByExtrapolationAssist (const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
 New method with track extrapolation.
bool passedFakeReject (const Amg::Vector3D &FitVertex, const xAOD::TrackParticle *itrk, const xAOD::TrackParticle *jtrk)
 Flag false if the consistituent tracks are not consistent with the vertex position.
void removeInconsistentTracks (WrkVrt &)
 Remove inconsistent tracks from vertices.
template<class Track>
void getIntersection (Track *trk, std::vector< IntersectionPos * > &layers, const Trk::Perigee *per)
template<class Track>
void setIntersection (Track *trk, IntersectionPos *bec, const Trk::Perigee *per)
StatusCode monitorVertexingAlgorithmStep (std::vector< WrkVrt > *, const std::string &name, bool final=false)
 monitor the intermediate status of vertexing
StatusCode categorizeVertexTruthTopology (xAOD::Vertex *vertex)
void dumpTruthInformation ()
template<class LeptonFlavor>
StatusCode augmentDVimpactParametersToLeptons (const std::string &containerName)
void lockTrackDecorations (const xAOD::TrackParticle *trk, bool onlySelection) const
 lock decorations at the end of the algorithm
void lockLeptonDecorations (const SG::AuxVectorData *cont) const
StatusCode lockTrackDecorations (bool onlySelection) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static bool selectTrack_d0signifCut (const xAOD::TrackParticle *)
static bool selectTrack_z0signifCut (const xAOD::TrackParticle *)
static void removeTrackFromVertex (std::vector< WrkVrt > *, std::vector< std::deque< long int > > *, const long int &, const long int &)
static size_t nTrkCommon (std::vector< WrkVrt > *WrkVrtSet, const std::pair< unsigned, unsigned > &pairIndex)
 returns the number of tracks commonly present in both vertices
static double findMinVerticesNextPair (std::vector< WrkVrt > *, std::pair< unsigned, unsigned > &)
 returns the next pair of vertices that give next-to-minimum distance significance
static void fillTrackSummary (track_summary &summary, const xAOD::TrackParticle *trk)
 retrieve the track hit information
static bool patternCheckRun1 (const uint32_t &pattern, const Amg::Vector3D &vertex)
static bool patternCheckRun2 (const uint32_t &pattern, const Amg::Vector3D &vertex)
static bool patternCheckRun1OuterOnly (const uint32_t &pattern, const Amg::Vector3D &vertex)
static bool patternCheckRun2OuterOnly (const uint32_t &pattern, const Amg::Vector3D &vertex)
static const xAOD::TruthParticlegetTrkGenParticle (const xAOD::TrackParticle *)

Private Attributes

struct JobProperties m_jp
int m_vertexingStatus = 0
const xAOD::VertexContainerm_primaryVertices
const xAOD::Vertexm_thePV
std::vector< const xAOD::TrackParticle * > m_selectedTracks
std::vector< const xAOD::TrackParticle * > m_associatedTracks
std::vector< const xAOD::TrackParticle * > m_leptonicTracks
std::vector< double > m_BeamPosition
ToolHandle< Trk::ITrkVKalVrtFitterm_fitSvc
ToolHandle< Trk::ITruthToTrackm_truthToTrack
ToolHandle< Reco::ITrackToVertexm_trackToVertexTool
 get a handle on the Track to Vertex tool
ToolHandle< Trk::ITrackToVertexIPEstimatorm_trackToVertexIPEstimatorTool
ToolHandle< Trk::IExtrapolatorm_extrapolator
ToolHandle< Trk::IVertexMapperm_vertexMapper
ToolHandle< IInDetConditionsToolm_pixelCondSummaryTool {this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}
 Condition service.
ToolHandle< IInDetConditionsToolm_sctCondSummaryTool {this, "InDetSCT_ConditionsSummaryTool", "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool", "Tool to retrieve SCT conditions summary"}
const AtlasDetectorIDm_atlasId = nullptr
const PixelIDm_pixelId = nullptr
const SCT_IDm_sctId = nullptr
std::string m_checkPatternStrategy
std::map< std::string, PatternStrategyFuncm_patternStrategyFuncs
std::optional< SG::Decorator< char > > m_decor_isSelected
std::optional< SG::Decorator< char > > m_decor_isAssociated
std::optional< SG::Decorator< char > > m_decor_is_svtrk_final
std::map< unsigned, SG::Decorator< float > > m_trkDecors
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this,"EventInfoKey", "EventInfo", "EventInfo name"}
 Read/Write Handle Keys.
SG::WriteDecorHandleKey< xAOD::EventInfom_vertexingStatusKey
std::vector< IPDecoratorTypem_ipDecors
std::optional< VertexELTypem_decor_svLink
TTree * m_tree_Vert
std::unique_ptr< NtupleVarsm_ntupleVars
std::map< std::string, TH1 * > m_hists
PatternBank m_extrapolatedPatternBank
std::vector< std::pair< int, int > > m_incomp
std::map< const xAOD::TruthVertex *, bool > m_matchMap
std::vector< TrackSelectionAlgm_trackSelectionAlgs
std::vector< CutFuncm_trackSelectionFuncs
std::vector< std::pair< std::string, vertexingAlg > > m_vertexingAlgorithms
unsigned m_vertexingAlgorithmStep = 0U
std::vector< const xAOD::TruthVertex * > m_tracingTruthVertices
DataObjIDColl m_extendedExtraObjects
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 86 of file VrtSecInclusive.h.

Member Typedef Documentation

◆ AlgForVerticesPair

using VKalVrtAthena::VrtSecInclusive::AlgForVerticesPair = double (VrtSecInclusive::*)( const WrkVrt&, const WrkVrt& ) const
private

Definition at line 480 of file VrtSecInclusive.h.

◆ Bec

Definition at line 363 of file VrtSecInclusive.h.

◆ CutFunc

using VKalVrtAthena::VrtSecInclusive::CutFunc = bool (VrtSecInclusive::*) ( const xAOD::TrackParticle* ) const
private

track selection

Definition at line 393 of file VrtSecInclusive.h.

◆ Detector

Definition at line 362 of file VrtSecInclusive.h.

◆ ExtrapolatedPattern

Definition at line 367 of file VrtSecInclusive.h.

◆ ExtrapolatedPoint

using VKalVrtAthena::VrtSecInclusive::ExtrapolatedPoint = std::tuple<const TVector3, Detector, Bec, Layer, Flag>
private

Definition at line 366 of file VrtSecInclusive.h.

◆ Flag

Definition at line 365 of file VrtSecInclusive.h.

◆ IPDecoratorType

using VKalVrtAthena::VrtSecInclusive::IPDecoratorType = SG::AuxElement::Decorator< std::vector< std::vector<float> > >
private

Definition at line 303 of file VrtSecInclusive.h.

◆ Layer

Definition at line 364 of file VrtSecInclusive.h.

◆ PatternBank

using VKalVrtAthena::VrtSecInclusive::PatternBank = std::map<const xAOD::TrackParticle*, std::pair< std::unique_ptr<ExtrapolatedPattern>, std::unique_ptr<ExtrapolatedPattern> > >
private

Definition at line 368 of file VrtSecInclusive.h.

◆ PatternStrategyFunc

using VKalVrtAthena::VrtSecInclusive::PatternStrategyFunc = bool (VrtSecInclusive::*) ( const xAOD::TrackParticle *trk, const Amg::Vector3D& vertex )
private

Definition at line 290 of file VrtSecInclusive.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ track_summary

◆ TrackSelectionAlg

using VKalVrtAthena::VrtSecInclusive::TrackSelectionAlg = StatusCode (VrtSecInclusive::*)()
private

Definition at line 389 of file VrtSecInclusive.h.

◆ VertexELType

◆ vertexingAlg

using VKalVrtAthena::VrtSecInclusive::vertexingAlg = StatusCode (VrtSecInclusive::*)( std::vector<WrkVrt>* )
private

Definition at line 437 of file VrtSecInclusive.h.

Member Enumeration Documentation

◆ mergeStep

◆ TrkParameter

◆ TrkParameterUnc

Constructor & Destructor Documentation

◆ VrtSecInclusive()

VKalVrtAthena::VrtSecInclusive::VrtSecInclusive ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard Athena-Algorithm Constructor.

Definition at line 39 of file VrtSecInclusive.cxx.

39 :
40 AthAlgorithm (name,pSvcLocator),
41
42 m_primaryVertices ( nullptr ),
43 m_thePV ( nullptr ),
44
45 // ToolsHandles
46 m_fitSvc ( "Trk::TrkVKalVrtFitter", this ),
47 m_truthToTrack ( "Trk::TruthToTrack/InDetTruthToTrack" ),
48 m_trackToVertexTool ( "Reco::TrackToVertex" ),
49 m_trackToVertexIPEstimatorTool ( "Trk::TrackToVertexIPEstimator/TrackToVertexIPEstimator" ),
50 m_extrapolator ( "Trk::Extrapolator/AtlasExtrapolator" ),
51 m_vertexMapper ( "" ),
52
53 m_checkPatternStrategy ( "Classical" ),
54
55 // Pointers of Ntuple variable vectors
56 m_tree_Vert ( nullptr ),
57 m_ntupleVars ( nullptr )
58
59 {
60
65
66 this->declareProperties();
67
68 if( m_jp.FillNtuple ) {
69 m_ntupleVars = std::make_unique<NtupleVars>( );
70 }
71
72 }
AthAlgorithm()
Default constructor:
std::map< std::string, PatternStrategyFunc > m_patternStrategyFuncs
bool checkTrackHitPatternToVertex(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
bool checkTrackHitPatternToVertexByExtrapolationAssist(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
bool checkTrackHitPatternToVertexByExtrapolation(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
std::unique_ptr< NtupleVars > m_ntupleVars
ToolHandle< Trk::IVertexMapper > m_vertexMapper
bool checkTrackHitPatternToVertexOuterOnly(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
ToolHandle< Trk::IExtrapolator > m_extrapolator
ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
get a handle on the Track to Vertex tool
const xAOD::VertexContainer * m_primaryVertices
ToolHandle< Trk::ITrkVKalVrtFitter > m_fitSvc
ToolHandle< Trk::ITruthToTrack > m_truthToTrack

◆ ~VrtSecInclusive()

VKalVrtAthena::VrtSecInclusive::~VrtSecInclusive ( )

Default Destructor.

Definition at line 77 of file VrtSecInclusive.cxx.

78 {
79 ATH_MSG_DEBUG("destructor called");
80 }
#define ATH_MSG_DEBUG(x)

Member Function Documentation

◆ addEventInfo()

StatusCode VKalVrtAthena::VrtSecInclusive::addEventInfo ( )
private

Definition at line 236 of file AANT_Tools.cxx.

236 {
237 // add event level variables
238 //
239 ATH_MSG_DEBUG( " > addEventInfo: in addEventInfo");
240
241 // this code has been taken from AnalysisExamples/VFitZmmOnAOD
242 //
243 //get EventInfo for run and event number
244
245 const xAOD::EventInfo* eventInfo;
246 ATH_CHECK( evtStore()->retrieve(eventInfo) );
247
248 //
249 //m_ntupleVars->m_runNumber = eventInfo->runNumber();
250 m_ntupleVars->get<unsigned int>( "RunNumber" ) = eventInfo->runNumber();
251 m_ntupleVars->get<unsigned int>( "Event") = eventInfo->eventNumber();
252 m_ntupleVars->get<unsigned int>( "Time" ) = eventInfo->timeStamp() ;
253 m_ntupleVars->get<unsigned int>( "LumiBlock" ) = eventInfo->lumiBlock() ;
254 m_ntupleVars->get<unsigned int>( "BCID" ) = eventInfo->bcid();
255
256 ATH_MSG_DEBUG( " > addEventInfo: event "<< m_ntupleVars->get<unsigned int>( "Event" ) );
257
258 return StatusCode::SUCCESS;
259 }
#define ATH_CHECK
Evaluate an expression and check for errors.
uint32_t lumiBlock() const
The current event's luminosity block number.
uint32_t bcid() const
The bunch crossing ID of the event.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ associateNonSelectedTracks()

StatusCode VKalVrtAthena::VrtSecInclusive::associateNonSelectedTracks ( std::vector< WrkVrt > * workVerticesContainer)
private

in addition to selected tracks, associate as much tracks as possible

Definition at line 1101 of file VertexingAlgs.cxx.

1102 {
1103
1104 const xAOD::TrackParticleContainer *allTracks ( nullptr );
1105 ATH_CHECK( evtStore()->retrieve(allTracks, m_jp.TrackLocation) );
1106
1107 const xAOD::VertexContainer *pvs (nullptr);
1108 ATH_CHECK( evtStore()->retrieve( pvs, "PrimaryVertices") );
1109
1110 if( !m_decor_isAssociated ) {
1111 m_decor_isAssociated.emplace ( "is_associated" + m_jp.augVerString );
1112 }
1113
1114 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": #verticess = " << workVerticesContainer->size() );
1115
1116 unsigned associateCounter { 0 };
1117
1118 // Loop over vertices
1119 for( auto& wrkvrt : *workVerticesContainer ) {
1120
1121 if( !wrkvrt.isGood ) continue;
1122 if( wrkvrt.selectedTrackIndices.size() <= 1 ) continue;
1123
1124 improveVertexChi2( wrkvrt );
1125
1126 wrkvrt.Chi2_core = wrkvrt.Chi2;
1127
1128 auto& vertexPos = wrkvrt.vertex;
1129
1130 std::vector<double> distanceToPVs;
1131
1132 for( const auto* pv : *pvs ) {
1133 distanceToPVs.emplace_back( VKalVrtAthena::vtxVtxDistance( vertexPos, pv->position() ) );
1134 }
1135 const auto& minDistance = *( std::min_element( distanceToPVs.begin(), distanceToPVs.end() ) );
1136
1137 if( minDistance < m_jp.associateMinDistanceToPV ) continue;
1138
1139
1140 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": vertex pos = (" << vertexPos.x() << ", " << vertexPos.y() << ", " << vertexPos.z() << "), "
1141 "#selected = " << wrkvrt.selectedTrackIndices.size() << ", #assoc = " << wrkvrt.associatedTrackIndices.size() );
1142
1143 std::vector<const xAOD::TrackParticle*> candidates;
1144
1145 // Search for candidate tracks
1146 for( auto itr = allTracks->begin(); itr != allTracks->end(); ++itr ) {
1147 const auto* trk = *itr;
1148
1149 // If the track is already used for any DV candidate, reject.
1150 {
1151 auto result = std::find_if( workVerticesContainer->begin(), workVerticesContainer->end(),
1152 [&] ( WrkVrt& wrkvrt ) {
1153 auto found = std::find_if( wrkvrt.selectedTrackIndices.begin(), wrkvrt.selectedTrackIndices.end(),
1154 [&]( long int index ) {
1155 // when using selected tracks from electrons, also check the orginal track particle from GSF to see if InDetTrackParticle (trk) is an electron that is already in the vertex
1156 if (m_jp.doSelectTracksFromElectrons || m_jp.doSelectIDAndGSFTracks) {
1157 const xAOD::TrackParticle *id_tr;
1158 id_tr = xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(m_selectedTracks.at(index));
1159 return trk == m_selectedTracks.at(index) or trk == id_tr;
1160 }
1161 else{
1162 return trk == m_selectedTracks.at(index);
1163 }
1164 } );
1165 return found != wrkvrt.selectedTrackIndices.end();
1166 } );
1167 if( result != workVerticesContainer->end() ) continue;
1168 }
1169
1170 // If the track is already registered to the associated track list, reject.
1171 {
1172 auto result = std::find_if( m_associatedTracks.begin(), m_associatedTracks.end(),
1173 [&] (const auto* atrk) { return trk == atrk; } );
1174 if( result != m_associatedTracks.end() ) continue;
1175 }
1176
1177 // Reject PV-associated tracks
1178 // if( !selectTrack_notPVassociated( trk ) ) continue;
1179
1180 // pT selection
1181 if( trk->pt() < m_jp.associatePtCut ) continue;
1182
1183 // chi2 selection
1184 if( trk->chiSquared() / trk->numberDoF() > m_jp.associateChi2Cut ) continue;
1185
1186 // Hit pattern consistentcy requirement
1187 if( !checkTrackHitPatternToVertexOuterOnly( trk, vertexPos ) ) continue;
1188
1189 // Get the closest approach
1190 std::vector<double> impactParameters;
1191 std::vector<double> impactParErrors;
1192
1193 if( !getSVImpactParameters( trk, vertexPos, impactParameters, impactParErrors) ) continue;
1194
1195 if( std::abs( impactParameters.at(0) ) / sqrt( impactParErrors.at(0) ) > m_jp.associateMaxD0Signif ) continue;
1196 if( std::abs( impactParameters.at(1) ) / sqrt( impactParErrors.at(1) ) > m_jp.associateMaxZ0Signif ) continue;
1197
1198 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": trk " << trk
1199 << ": d0 to vtx = " << impactParameters.at(k_d0)
1200 << ", z0 to vtx = " << impactParameters.at(k_z0)
1201 << ", distance to vtx = " << hypot( impactParameters.at(k_d0), impactParameters.at(k_z0) ) );
1202
1203 candidates.emplace_back( trk );
1204
1205 }
1206
1207 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": number of candidate tracks = " << candidates.size() );
1208
1209 std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState();
1210 // Attempt to add the track to the vertex and try fitting
1211 for( const auto* trk : candidates ) {
1212
1213 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": attempting to associate track = " << trk );
1214
1215 // Backup the current vertes status
1216 WrkVrt wrkvrt_backup = wrkvrt;
1217
1218 m_fitSvc->setApproximateVertex( vertexPos.x(), vertexPos.y(), vertexPos.z(), *state );
1219
1220 std::vector<const xAOD::TrackParticle*> baseTracks;
1221 std::vector<const xAOD::NeutralParticle*> dummyNeutrals;
1222
1223 wrkvrt.Chi2PerTrk.clear();
1224
1225 for( const auto& index : wrkvrt.selectedTrackIndices ) {
1226 baseTracks.emplace_back( m_selectedTracks.at( index ) );
1227 wrkvrt.Chi2PerTrk.emplace_back( AlgConsts::chi2PerTrackInitValue );
1228 }
1229 for( const auto& index : wrkvrt.associatedTrackIndices ) {
1230 baseTracks.emplace_back( m_associatedTracks.at( index ) );
1231 wrkvrt.Chi2PerTrk.emplace_back( AlgConsts::chi2PerTrackInitValue );
1232 }
1233
1234 baseTracks.emplace_back( trk );
1235 wrkvrt.Chi2PerTrk.emplace_back( AlgConsts::chi2PerTrackInitValue );
1236
1237 Amg::Vector3D initPos;
1238
1239 {
1240 StatusCode sc = m_fitSvc->VKalVrtFitFast( baseTracks, initPos, *state );/* Fast crude estimation */
1241
1242 if( sc.isFailure() ) ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": fast crude estimation failed.");
1243
1244 const auto& diffPos = initPos - vertexPos;
1245
1246 if( diffPos.norm() > 10. ) {
1247
1248 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": approx vertex as original" );
1249 m_fitSvc->setApproximateVertex( vertexPos.x(), vertexPos.y(), vertexPos.z(), *state );
1250
1251 } else {
1252
1253 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": approx vertex set to (" << initPos.x() << ", " << initPos.y() << ", " << initPos.z() << ")" );
1254 m_fitSvc->setApproximateVertex( initPos.x(), initPos.y(), initPos.z(), *state );
1255
1256 }
1257 }
1258
1259
1260 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": now vertex fitting..." );
1261
1262 StatusCode sc = m_fitSvc->VKalVrtFit(baseTracks, dummyNeutrals,
1263 wrkvrt.vertex,
1264 wrkvrt.vertexMom,
1265 wrkvrt.Charge,
1266 wrkvrt.vertexCov,
1267 wrkvrt.Chi2PerTrk,
1268 wrkvrt.TrkAtVrt,
1269 wrkvrt.Chi2,
1270 *state);
1271
1272 if( sc.isFailure() ) {
1273 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": VKalVrtFit failure. Revert to backup");
1274 wrkvrt = wrkvrt_backup;
1275
1276 if( m_jp.FillHist ) m_hists["associateMonitor"]->Fill( 1 );
1277
1278 continue;
1279 }
1280
1281
1282 if( m_jp.FillHist ) m_hists["associateMonitor"]->Fill( 0 );
1283
1284 auto& cov = wrkvrt.vertexCov;
1285
1286 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": succeeded in associating. New vertex pos = (" << vertexPos.perp() << ", " << vertexPos.z() << ", " << vertexPos.perp()*vertexPos.phi() << ")" );
1287 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": New vertex cov = (" << cov.at(0) << ", " << cov.at(1) << ", " << cov.at(2) << ", " << cov.at(3) << ", " << cov.at(4) << ", " << cov.at(5) << ")" );
1288
1289 associateCounter++;
1290
1291 wrkvrt.associatedTrackIndices.emplace_back( m_associatedTracks.size() );
1292
1293 m_associatedTracks.emplace_back( trk );
1294 (*m_decor_isAssociated)( *trk ) = true;
1295
1296 }
1297
1298 }
1299
1300 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1301 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": total associated number of tracks = " << associateCounter );
1302 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1303
1304 return StatusCode::SUCCESS;
1305 }
#define ATH_MSG_VERBOSE(x)
static Double_t sc
bool getSVImpactParameters(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex, std::vector< double > &impactParameters, std::vector< double > &impactParErrors)
get secondary vertex impact parameters
std::map< std::string, TH1 * > m_hists
double improveVertexChi2(WrkVrt &)
attempt to improve the vertex chi2 by removing the most-outlier track one by one until the vertex chi...
std::vector< const xAOD::TrackParticle * > m_associatedTracks
std::vector< const xAOD::TrackParticle * > m_selectedTracks
std::optional< SG::Decorator< char > > m_decor_isAssociated
Eigen::Matrix< double, 3, 1 > Vector3D
::StatusCode StatusCode
StatusCode definition for legacy code.
double vtxVtxDistance(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".

◆ augmentDVimpactParametersToLeptons()

template<class LeptonFlavor>
StatusCode VKalVrtAthena::VrtSecInclusive::augmentDVimpactParametersToLeptons ( const std::string & containerName)
private

Definition at line 108 of file Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/details/Utilities.h.

109 {
110
111 const xAOD::VertexContainer *secondaryVertexContainer( nullptr );
112 ATH_CHECK( evtStore()->retrieve( secondaryVertexContainer, "VrtSecInclusive_" + m_jp.secondaryVerticesContainerName + m_jp.augVerString) );
113
114 using LeptonContainer = DataVector<LeptonFlavor>;
115
116 const LeptonContainer *leptonContainer( nullptr );
117 ATH_CHECK( evtStore()->retrieve( leptonContainer, containerName ) );
118
119 if (m_ipDecors.empty()) {
120 m_ipDecors.emplace_back( "d0_wrtSVs" + m_jp.augVerString );
121 m_ipDecors.emplace_back( "z0_wrtSVs" + m_jp.augVerString );
122 m_ipDecors.emplace_back( "pt_wrtSVs" + m_jp.augVerString );
123 m_ipDecors.emplace_back( "eta_wrtSVs" + m_jp.augVerString );
124 m_ipDecors.emplace_back( "phi_wrtSVs" + m_jp.augVerString );
125 m_ipDecors.emplace_back( "d0err_wrtSVs" + m_jp.augVerString );
126 m_ipDecors.emplace_back( "z0err_wrtSVs" + m_jp.augVerString );
127 }
128
129 // Grouping decorators
130 enum { k_ip_d0, k_ip_z0, k_ip_pt, k_ip_eta, k_ip_phi, k_ip_d0err, k_ip_z0err };
131
132 if( !m_decor_svLink ) {
133 m_decor_svLink.emplace ( "svLinks" + m_jp.augVerString );
134 }
135
136 // Loop over leptons
137 for( const auto& lepton : *leptonContainer ) {
138
139 std::vector< std::vector< std::vector<float> > > ip_wrtSVs( m_ipDecors.size() ); // triple nest of { ip parameters, tracks, DVs }
140
141 bool linkFlag { false };
142
143 std::vector<unsigned> trackTypes;
144 genSequence<LeptonFlavor>( lepton, trackTypes );
145
146 // Loop over lepton types
147 for( auto& trackType : trackTypes ) {
148
149 std::vector< std::vector<float> > ip_wrtSV( m_ipDecors.size() ); // nest of { tracks, DVs }
150
151 const auto* trk = getLeptonTrackParticle<LeptonFlavor>( lepton, trackType );
152
153 if( !trk ) continue;
154
155 std::map< const xAOD::Vertex*, std::vector<double> > distanceMap;
156
157 std::vector<ElementLink< xAOD::VertexContainer > > links;
158
159 // Loop over vertices
160 for( const auto vtx : *secondaryVertexContainer ) {
161
162 std::vector<double> impactParameters;
163 std::vector<double> impactParErrors;
164
165 m_fitSvc->VKalGetImpact( trk, vtx->position(), static_cast<int>( lepton->charge() ), impactParameters, impactParErrors );
166
167 enum { k_d0, k_z0, k_theta, k_phi, k_qOverP }; // for the impact parameter
168 enum { k_d0d0, k_d0z0, k_z0z0 }; // for the par errors
169
170 const auto& theta = impactParameters.at( k_theta );
171 const auto& phi = impactParameters.at( k_phi );
172 const auto p = fabs( 1.0 / impactParameters.at(k_qOverP) );
173 const auto pt = fabs( p * sin( theta ) );
174 const auto eta = -log( tan(theta/2.) );
175
176 // filling the parameters to the corresponding container
177 ip_wrtSV.at( k_ip_d0 ) .emplace_back( impactParameters.at(k_d0) );
178 ip_wrtSV.at( k_ip_z0 ) .emplace_back( impactParameters.at(k_z0) );
179 ip_wrtSV.at( k_ip_pt ) .emplace_back( pt );
180 ip_wrtSV.at( k_ip_eta ) .emplace_back( eta );
181 ip_wrtSV.at( k_ip_phi ) .emplace_back( phi );
182 ip_wrtSV.at( k_ip_d0err ) .emplace_back( impactParErrors.at(k_d0d0) );
183 ip_wrtSV.at( k_ip_z0err ) .emplace_back( impactParErrors.at(k_z0z0) );
184
185 if( !linkFlag ) {
186
187 ElementLink<xAOD::VertexContainer> link_SV( *( dynamic_cast<const xAOD::VertexContainer*>( vtx->container() ) ), static_cast<size_t>( vtx->index() ) );
188 links.emplace_back( link_SV );
189
190 }
191
192 } // end of vertex loop
193
194 // The linking to the vertices need to be done only once
195 if( !linkFlag ) {
196 ( *m_decor_svLink )( *lepton ) = links;
197 linkFlag = true;
198 }
199
200 for( size_t ipar = 0; ipar < ip_wrtSVs.size(); ipar++ ) ip_wrtSVs.at( ipar ).emplace_back( ip_wrtSV.at( ipar ) );
201
202 } // end of track type loop
203
204 // decoration
205 for( size_t ipar = 0; ipar < m_ipDecors.size(); ipar++ ) {
206 m_ipDecors.at( ipar )( *lepton ) = ip_wrtSVs.at( ipar );
207 }
208
209 } // end of lepton container loop
210
211 return StatusCode::SUCCESS;
212 }
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Scalar theta() const
theta method
std::optional< VertexELType > m_decor_svLink
std::vector< IPDecoratorType > m_ipDecors
const xAOD::TrackParticle * getLeptonTrackParticle(const xAOD::Muon *muon, const unsigned &trackType)
void genSequence(const xAOD::Muon *, std::vector< unsigned > &trackTypes)

◆ categorizeVertexTruthTopology()

StatusCode VKalVrtAthena::VrtSecInclusive::categorizeVertexTruthTopology ( xAOD::Vertex * vertex)
private

Definition at line 44 of file TruthAlgs.cxx.

45 {
46
47 enum vertexCatogory_tracks {
48 allTruthAssociated,
49 hasFakeTracks,
50 allFakeTracks
51 };
52
53 enum vertexCategory_vertex {
54 uniqueTruthVertex,
55 multipleTruthVertices,
56 noTruthVertex
57 };
58
59
60 // std::multiset allows to have multiplicity of the element
61 multiset<const xAOD::TruthVertex*> truth_vertices;
62
63 // std::multiset doesn't allow to have multiplicity of the element
64 set<const xAOD::TruthVertex*> truth_vertices_types;
65
66 vector<const xAOD::TrackParticle*> reco_tracks; // associated with truth and has prodVtx
67 vector<const xAOD::TrackParticle*> orphan_tracks; // associated with truth, but does not have prodVtx
68 vector<const xAOD::TrackParticle*> fake_tracks; // no association with truth ( fake )
69
70 // loop over tracks
71 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): loop over tracks" );
72 for( size_t itrk=0; itrk<vertex->nTrackParticles(); itrk++ ) {
73 const auto *trk = vertex->trackParticle( itrk );
74
75 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): track loop itrk = " << itrk );
76 typedef ElementLink<xAOD::TruthParticleContainer> truthLink;
77 static const SG::ConstAccessor< truthLink > truthParticleLinkAcc( "truthParticleLink" );
78 const truthLink& link = truthParticleLinkAcc(*trk);
79
80 if ( ! link ) {
81 fake_tracks.emplace_back( trk );
82 continue;
83 }
84
85 const xAOD::TruthParticle *truth = *link;
86 if( ! truth->hasProdVtx() ) {
87 orphan_tracks.emplace_back( trk );
88 continue;
89 }
90
91 reco_tracks.emplace_back( trk );
92
93 truth_vertices_types .insert( truth->prodVtx() );
94 truth_vertices .insert( truth->prodVtx() );
95
96 }
97
98
99 // Add truth track pattern to the reco vertex
100 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): Add truth track pattern to the reco vertex" );
101 const static SG::Accessor<char> trkpatAcc( "truth_trk_pattern" );
102 if( reco_tracks.size() == vertex->nTrackParticles() ) {
103 trkpatAcc( *vertex ) = allTruthAssociated;
104 } else if( fake_tracks.size() == vertex->nTrackParticles() ) {
105 trkpatAcc( *vertex ) = allFakeTracks;
106 } else {
107 trkpatAcc( *vertex ) = hasFakeTracks;
108 }
109
110
111 // Histogramming - counting the number of appearing truth vertices connected
112 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): Histogramming - counting the number of appearing truth vertices connected" );
113 vector< tuple<const xAOD::TruthVertex*, size_t> > truth_vertex_histogram;
114 for( const auto *v : truth_vertices_types ) {
115 size_t count = truth_vertices.count( v );
116 truth_vertex_histogram.emplace_back( v, count );
117 }
118
119 // Determine the truth vertex associated to this vertex by majority decision
120 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): Determine the truth vertex associated to this vertex by majority decision" );
121 tuple<const xAOD::TruthVertex*, size_t> tmp_tuple( nullptr, 0 );
122 for( const auto& t : truth_vertex_histogram ) {
123 const size_t& size_tmp = get<1>( tmp_tuple );
124 const size_t& size_this = get<1>( t );
125 if( size_tmp < size_this ) tmp_tuple = t;
126 }
127
128 // Add truth track pattern to the reco vertex
129 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): Add truth track pattern to the reco vertex" );
130 char truth_vtx_pattern = 0;
131 if( truth_vertices_types.empty() ) {
132 truth_vtx_pattern = noTruthVertex;
133 } else if( truth_vertices_types.size() == 1 ) {
134 truth_vtx_pattern = uniqueTruthVertex;
135 } else {
136 truth_vtx_pattern = multipleTruthVertices;
137 }
138 static const SG::Accessor<char> vtxpatAcc( "truth_vtx_pattern" );
139 vtxpatAcc(*vertex) = truth_vtx_pattern;
140
141
142 ElementLink<xAOD::TruthVertexContainer> vtx_link;
143 if( noTruthVertex != truth_vtx_pattern ) {
144
145 // Retrieve the truth vertex container for element link
146 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): Retrieve the truth vertex container for element link" );
147 const xAOD::TruthVertexContainer* truthVertexContainer ( nullptr );
148 ATH_CHECK( evtStore()->retrieve( truthVertexContainer, "TruthVertices") );
149
150 // create the element link
151 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): create the element link" );
152 const auto *theVertex = get<0>( tmp_tuple );
153 if( theVertex ) {
154 // Add the truth vertex element link to the reco vertex
155 vtx_link.toIndexedElement(*truthVertexContainer,theVertex->index());
156 ATH_MSG_VERBOSE( "categorizeVertexTruthTopology(): Add the truth vertex element link to the reco vertex" );
157 }
158 }
159 // [JDC] a ElementLink decorator should be filled every event
160 // although using a null link
161 static const SG::Accessor<ElementLink<xAOD::TruthVertexContainer> >
162 linkAcc( "truth_vtx_link" );
163 linkAcc(*vertex) = vtx_link;
164
165 return StatusCode::SUCCESS;
166 }
bool hasProdVtx() const
Check for a production vertex on this particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
TruthVertexContainer_v1 TruthVertexContainer
Declare the latest version of the truth vertex container.
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ checkTrackHitPatternToVertex()

bool VKalVrtAthena::VrtSecInclusive::checkTrackHitPatternToVertex ( const xAOD::TrackParticle * trk,
const Amg::Vector3D & vertex )
private

A classical method with hard-coded geometry.

Definition at line 2185 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2186 {
2187
2188 const uint32_t pattern = trk->hitPattern();
2189
2190 return patternCheck( pattern, vertex );
2191
2192 }
bool patternCheck(const uint32_t &pattern, const Amg::Vector3D &vertex)
uint32_t hitPattern() const
setEventNumber uint32_t

◆ checkTrackHitPatternToVertexByExtrapolation()

bool VKalVrtAthena::VrtSecInclusive::checkTrackHitPatternToVertexByExtrapolation ( const xAOD::TrackParticle * trk,
const Amg::Vector3D & vertex )
private

New method with track extrapolation.

Definition at line 1178 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

1179 {
1180
1181 if( m_extrapolatedPatternBank.find( trk ) == m_extrapolatedPatternBank.end() ) {
1182
1183 std::unique_ptr<ExtrapolatedPattern> exPattern_along( extrapolatedPattern( trk, Trk::alongMomentum ) );
1184 std::unique_ptr<ExtrapolatedPattern> exPattern_oppos( extrapolatedPattern( trk, Trk::oppositeMomentum ) );
1185
1186 m_extrapolatedPatternBank.emplace( trk, std::make_pair( std::move(exPattern_along), std::move(exPattern_oppos) ) );
1187
1188 }
1189
1190 auto& exPattern = m_extrapolatedPatternBank.at( trk );
1191
1192 using LayerCombination = std::vector<int>;
1193
1194 std::map<LayerCombination, unsigned> layerMap;
1195 if( layerMap.empty() ) {
1196 layerMap[ { 1, 0, 0 } ] = Trk::pixelBarrel0;
1197 layerMap[ { 1, 0, 1 } ] = Trk::pixelBarrel1;
1198 layerMap[ { 1, 0, 2 } ] = Trk::pixelBarrel2;
1199 layerMap[ { 1, 0, 3 } ] = Trk::pixelBarrel3;
1200
1201 layerMap[ { 1, 2, 0 } ] = Trk::pixelEndCap0;
1202 layerMap[ { 1, 2, 1 } ] = Trk::pixelEndCap1;
1203 layerMap[ { 1, 2, 2 } ] = Trk::pixelEndCap2;
1204 layerMap[ { 1,-2, 0 } ] = Trk::pixelEndCap0;
1205 layerMap[ { 1,-2, 1 } ] = Trk::pixelEndCap1;
1206 layerMap[ { 1,-2, 2 } ] = Trk::pixelEndCap2;
1207
1208 layerMap[ { 2, 0, 0 } ] = Trk::sctBarrel0;
1209 layerMap[ { 2, 0, 1 } ] = Trk::sctBarrel1;
1210 layerMap[ { 2, 0, 2 } ] = Trk::sctBarrel2;
1211 layerMap[ { 2, 0, 3 } ] = Trk::sctBarrel3;
1212
1213 layerMap[ { 2, 2, 0 } ] = Trk::sctEndCap0;
1214 layerMap[ { 2, 2, 1 } ] = Trk::sctEndCap1;
1215 layerMap[ { 2, 2, 2 } ] = Trk::sctEndCap2;
1216 layerMap[ { 2, 2, 3 } ] = Trk::sctEndCap3;
1217 layerMap[ { 2, 2, 4 } ] = Trk::sctEndCap4;
1218 layerMap[ { 2, 2, 5 } ] = Trk::sctEndCap5;
1219 layerMap[ { 2, 2, 6 } ] = Trk::sctEndCap6;
1220 layerMap[ { 2, 2, 7 } ] = Trk::sctEndCap7;
1221 layerMap[ { 2, 2, 8 } ] = Trk::sctEndCap8;
1222 layerMap[ { 2,-2, 0 } ] = Trk::sctEndCap0;
1223 layerMap[ { 2,-2, 1 } ] = Trk::sctEndCap1;
1224 layerMap[ { 2,-2, 2 } ] = Trk::sctEndCap2;
1225 layerMap[ { 2,-2, 3 } ] = Trk::sctEndCap3;
1226 layerMap[ { 2,-2, 4 } ] = Trk::sctEndCap4;
1227 layerMap[ { 2,-2, 5 } ] = Trk::sctEndCap5;
1228 layerMap[ { 2,-2, 6 } ] = Trk::sctEndCap6;
1229 layerMap[ { 2,-2, 7 } ] = Trk::sctEndCap7;
1230 layerMap[ { 2,-2, 8 } ] = Trk::sctEndCap8;
1231 }
1232
1233 enum { position=0, detector=1, bec=2, layer=3, isGood=4 };
1234
1235 // Lambda!
1236 auto getDetectorType = [&]( const ExtrapolatedPoint& point ) -> unsigned {
1237
1238 const LayerCombination comb { std::get<detector>( point ), std::get<bec>( point ), std::get<layer>( point ) };
1239
1240 for( auto& pair : layerMap ) {
1241 if( pair.first == comb ) {
1242 return pair.second;
1243 }
1244 }
1245
1247 };
1248
1249 enum { kShouldNotHaveHit, kShouldHaveHit, kMayHaveHit };
1250 std::vector<unsigned> expectedHitPattern(Trk::numberOfDetectorTypes, kShouldNotHaveHit);
1251
1252 auto minExpectedRadius = AlgConsts::maxValue;
1253
1254 // Loop over extrapolated points (along direction)
1255 auto& exPattern_along = *( exPattern.first );
1256
1257 for( auto itr = exPattern_along.begin(); itr != exPattern_along.end(); ++itr ) {
1258 if( std::next( itr ) == exPattern_along.end() ) continue;
1259
1260 const auto& point = *itr;
1261 const auto& nextPoint = *( std::next( itr ) );
1262
1263 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": isGood = " << std::get<isGood>( point ) );
1264
1265 const auto& thisPos = std::get<position>( point );
1266 const auto& nextPos = std::get<position>( nextPoint );
1267
1268 auto sectionVector = nextPos - thisPos;
1269 auto vertexVector = TVector3( vertex.x(), vertex.y(), vertex.z() ) - thisPos;
1270
1271
1272 const auto& detectorType = getDetectorType( point );
1273
1274 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": detType = " << detectorType );
1275
1276 if( detectorType == AlgConsts::invalidUnsigned ) continue;
1277 if( detectorType >= Trk::numberOfDetectorTypes ) continue;
1278
1279 // if the vertex is nearby (within 10 mm), the hit may be presnet ("X")
1280 if( vertexVector.Mag() < 10. ) {
1281 expectedHitPattern.at( detectorType ) = kMayHaveHit;
1282 continue;
1283 }
1284
1285 // if the front-end module is not active, then the hit is not expected,
1286 // which means the hit may be present
1287 if( !static_cast<bool>(std::get<isGood>( point )) ) {
1288 expectedHitPattern.at( detectorType ) = kMayHaveHit;
1289 continue;
1290 }
1291
1292 // if the inner product of the above two vectors is positive,
1293 // then point is inner than the vertex.
1294 // Else, the point is outer than the vertex and expect to have hits
1295 // when the track is originated from the vertex.
1296
1297 if( sectionVector.Mag() == 0. ) continue;
1298
1299 ATH_MSG_VERBOSE( " > " << __FUNCTION__
1300 << ": hitPos = (" << thisPos.Perp() << ", " << thisPos.z() << ", " << thisPos.Phi() << ")"
1301 << ", sectionVec = (" << sectionVector.Perp() << ", " << sectionVector.z() << ", " << sectionVector.Phi() << ")"
1302 << ", vertexVec = (" << vertexVector.Perp() << ", " << vertexVector.z() << ", " << vertexVector.Phi() << ")"
1303 << ", cos(s,v) = " << sectionVector * vertexVector / ( sectionVector.Mag() * vertexVector.Mag() + AlgConsts::infinitesimal ) );
1304
1305 if( sectionVector * vertexVector > 0. ) continue;
1306
1307 if( minExpectedRadius > thisPos.Perp() ) minExpectedRadius = thisPos.Perp();
1308
1309 // now, the hit is expected to present.
1310
1311 expectedHitPattern.at( detectorType ) = kShouldHaveHit;
1312 }
1313
1314 // Loop over extrapolated points (opposite direction)
1315 auto& exPattern_oppos = *( exPattern.second );
1316 bool oppositeFlag = false;
1317
1318 for( auto itr = exPattern_oppos.begin(); itr != exPattern_oppos.end(); ++itr ) {
1319 if( std::next( itr ) == exPattern_oppos.end() ) continue;
1320
1321 const auto& point = *itr;
1322 const auto& nextPoint = *( std::next( itr ) );
1323
1324 const auto& thisPos = std::get<position>( point );
1325 const auto& nextPos = std::get<position>( nextPoint );
1326
1327 auto sectionVector = nextPos - thisPos;
1328 auto vertexVector = TVector3( vertex.x(), vertex.y(), vertex.z() ) - thisPos;
1329
1330 const auto& detectorType = getDetectorType( point );
1331
1332 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": detType = " << detectorType );
1333
1334 ATH_MSG_DEBUG( " > " << __FUNCTION__
1335 << ": hitPos = (" << thisPos.Perp() << ", " << thisPos.z() << ", " << thisPos.Phi() << ")"
1336 << ", vertex = (" << vertex.perp() << ", " << vertex.z() << ", " << vertex.phi() << ")"
1337 << ", cos(s,v) = " << sectionVector * vertexVector / ( sectionVector.Mag() * vertexVector.Mag() + AlgConsts::infinitesimal ) );
1338
1339 if( detectorType == AlgConsts::invalidUnsigned ) continue;
1340 if( detectorType >= Trk::numberOfDetectorTypes ) continue;
1341
1342 if( sectionVector * vertexVector < 0. ) {
1343 oppositeFlag = true;
1344 }
1345 }
1346
1347 // If the first expected point's radius is smaller than the vertex radius,
1348 // it's the case that the vertex was reconstructed in the opposite phi-direction
1349 // to the track outgoing direction. Such a case should be rejected.
1350 // bool oppositeFlag = ( minExpectedRadius < vertex.perp() );
1351
1352 std::string msg = "Expected hit pattern: ";
1353 for( unsigned i=0; i<Trk::numberOfDetectorTypes; i++) {
1354 msg += Form("%s", expectedHitPattern.at(i) < kMayHaveHit? Form("%u", expectedHitPattern.at(i)) : "X" );
1355 }
1356 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": " << msg );
1357
1358 msg = "Recorded hit pattern: ";
1359 for( unsigned i=0; i<Trk::numberOfDetectorTypes; i++) {
1360 msg += Form("%u", ( trk->hitPattern() >> i ) & 1 );
1361 }
1362 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": " << msg );
1363
1364 std::vector<unsigned> matchedLayers;
1365
1366 for( unsigned i=0; i<Trk::numberOfDetectorTypes; i++) {
1367 const unsigned recordedPattern = ( (trk->hitPattern()>>i) & 1 );
1368
1369 if( expectedHitPattern.at(i) == kMayHaveHit ) {
1370 matchedLayers.emplace_back( i );
1371 } else if( expectedHitPattern.at(i) == kShouldHaveHit ) {
1372 if( expectedHitPattern.at(i) != recordedPattern ) {
1373 break;
1374 } else {
1375 matchedLayers.emplace_back( i );
1376 }
1377 } else {
1378 if( expectedHitPattern.at(i) != recordedPattern ) {
1379 break;
1380 }
1381 }
1382
1383 }
1384
1385 uint8_t PixelHits = 0;
1386 uint8_t SctHits = 0;
1387 uint8_t TRTHits = 0;
1388 if( !(trk->summaryValue( PixelHits, xAOD::numberOfPixelHits ) ) ) PixelHits =0;
1389 if( !(trk->summaryValue( SctHits, xAOD::numberOfSCTHits ) ) ) SctHits =0;
1390 if( !(trk->summaryValue( TRTHits, xAOD::numberOfTRTHits ) ) ) TRTHits =0;
1391
1392 auto dphi = trk->phi() - vertex.phi();
1393 while( dphi > TMath::Pi() ) dphi -= TMath::TwoPi();
1394 while( dphi < -TMath::Pi() ) dphi += TMath::TwoPi();
1395
1396 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": vtx phi = " << vertex.phi() << ", track phi = " << trk->phi() << ", dphi = " << dphi
1397 << ", oppositeFlag = " << oppositeFlag
1398 << ", nPixelHits = " << static_cast<int>(PixelHits)
1399 << ", nSCTHits = " << static_cast<int>(SctHits)
1400 << ", nTRTHits = " << static_cast<int>(TRTHits)
1401 << ", nMatchedLayers = " << matchedLayers.size() );
1402
1403 if( PixelHits == 0 && vertex.perp() > 300. ) {
1404 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": vertex r > 300 mm, w/o no pixel hits" );
1405 }
1406
1407
1408 // Requires the first 2 layers with the hit matches.
1409 if( matchedLayers.size() < 2 ) return false;
1410
1411 // In case of the first matched layer is not within pixel barrel, requires the first 4 layers with the hit match
1412 if( matchedLayers.at(0) >= Trk::pixelEndCap0 ) {
1413 if( matchedLayers.size() < 4 ) return false;
1414 }
1415
1416 // Sometimes the vertex is reconstructed at the opposite phi direction.
1417 // In this case, the pattern match may pass.
1418 // This can be avoided by requiring that the
1419 if( oppositeFlag ) return false;
1420
1421 // The following condition should apply for vertices outer than IBL.
1422 if( false /*matchedLayers.at(0) > Trk::pixelBarrel0*/ ) {
1423
1424 // If the dphi (defined above) is opposite, reject.
1425 if( fabs( dphi ) > TMath::Pi()/2.0 ) return false;
1426
1427 // If the track is not within the forward hemisphere to the vertex, reject.
1428 TVector3 trkP; trkP.SetPtEtaPhi( trk->pt(), trk->eta(), trk->phi() );
1429 TVector3 vtx; vtx.SetXYZ( vertex.x(), vertex.y(), vertex.z() );
1430 if( trkP.Dot( vtx ) < 0. ) return false;
1431
1432 }
1433
1434 return true;
1435 }
MsgStream & msg() const
ExtrapolatedPattern * extrapolatedPattern(const xAOD::TrackParticle *, enum Trk::PropDirection)
std::tuple< const TVector3, Detector, Bec, Layer, Flag > ExtrapolatedPoint
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
@ layer
Definition HitInfo.h:79
@ oppositeMomentum
@ alongMomentum
@ pixelBarrel0
there are three or four pixel barrel layers (R1/R2)
@ pixelEndCap0
three pixel discs (on each side)
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].

◆ checkTrackHitPatternToVertexByExtrapolationAssist()

bool VKalVrtAthena::VrtSecInclusive::checkTrackHitPatternToVertexByExtrapolationAssist ( const xAOD::TrackParticle * trk,
const Amg::Vector3D & vertex )
private

New method with track extrapolation.

Definition at line 2207 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2208 {
2209
2210 if( m_extrapolatedPatternBank.find( trk ) == m_extrapolatedPatternBank.end() ) {
2211
2212 std::unique_ptr<ExtrapolatedPattern> exPattern_along( extrapolatedPattern( trk, Trk::alongMomentum ) );
2213
2214 m_extrapolatedPatternBank.emplace( trk, std::make_pair( std::move(exPattern_along), nullptr ) );
2215
2216 }
2217
2218 if( vertex.perp() < 31.0 ) {
2219 double dphi = trk->phi() - vertex.phi();
2220 while( dphi > TMath::Pi() ) { dphi -= TMath::TwoPi(); }
2221 while( dphi < -TMath::Pi() ) { dphi += TMath::TwoPi(); }
2222 if( cos(dphi) < -0.8 ) return false;
2223 }
2224
2225 auto& exPattern = m_extrapolatedPatternBank.at( trk );
2226
2227 using LayerCombination = std::vector<int>;
2228
2229 std::map<LayerCombination, unsigned> layerMap;
2230 if( layerMap.empty() ) {
2231 layerMap[ { 1, 0, 0 } ] = Trk::pixelBarrel0;
2232 layerMap[ { 1, 0, 1 } ] = Trk::pixelBarrel1;
2233 layerMap[ { 1, 0, 2 } ] = Trk::pixelBarrel2;
2234 layerMap[ { 1, 0, 3 } ] = Trk::pixelBarrel3;
2235
2236 layerMap[ { 1, 2, 0 } ] = Trk::pixelEndCap0;
2237 layerMap[ { 1, 2, 1 } ] = Trk::pixelEndCap1;
2238 layerMap[ { 1, 2, 2 } ] = Trk::pixelEndCap2;
2239 layerMap[ { 1,-2, 0 } ] = Trk::pixelEndCap0;
2240 layerMap[ { 1,-2, 1 } ] = Trk::pixelEndCap1;
2241 layerMap[ { 1,-2, 2 } ] = Trk::pixelEndCap2;
2242
2243 layerMap[ { 2, 0, 0 } ] = Trk::sctBarrel0;
2244 layerMap[ { 2, 0, 1 } ] = Trk::sctBarrel1;
2245 layerMap[ { 2, 0, 2 } ] = Trk::sctBarrel2;
2246 layerMap[ { 2, 0, 3 } ] = Trk::sctBarrel3;
2247
2248 layerMap[ { 2, 2, 0 } ] = Trk::sctEndCap0;
2249 layerMap[ { 2, 2, 1 } ] = Trk::sctEndCap1;
2250 layerMap[ { 2, 2, 2 } ] = Trk::sctEndCap2;
2251 layerMap[ { 2, 2, 3 } ] = Trk::sctEndCap3;
2252 layerMap[ { 2, 2, 4 } ] = Trk::sctEndCap4;
2253 layerMap[ { 2, 2, 5 } ] = Trk::sctEndCap5;
2254 layerMap[ { 2, 2, 6 } ] = Trk::sctEndCap6;
2255 layerMap[ { 2, 2, 7 } ] = Trk::sctEndCap7;
2256 layerMap[ { 2, 2, 8 } ] = Trk::sctEndCap8;
2257 layerMap[ { 2,-2, 0 } ] = Trk::sctEndCap0;
2258 layerMap[ { 2,-2, 1 } ] = Trk::sctEndCap1;
2259 layerMap[ { 2,-2, 2 } ] = Trk::sctEndCap2;
2260 layerMap[ { 2,-2, 3 } ] = Trk::sctEndCap3;
2261 layerMap[ { 2,-2, 4 } ] = Trk::sctEndCap4;
2262 layerMap[ { 2,-2, 5 } ] = Trk::sctEndCap5;
2263 layerMap[ { 2,-2, 6 } ] = Trk::sctEndCap6;
2264 layerMap[ { 2,-2, 7 } ] = Trk::sctEndCap7;
2265 layerMap[ { 2,-2, 8 } ] = Trk::sctEndCap8;
2266 }
2267
2268 enum { position=0, detector=1, bec=2, layer=3, isGood=4 };
2269
2270 // Lambda!
2271 auto getDetectorType = [&]( const ExtrapolatedPoint& point ) -> unsigned {
2272
2273 const LayerCombination comb { std::get<detector>( point ), std::get<bec>( point ), std::get<layer>( point ) };
2274
2275 for( auto& pair : layerMap ) {
2276 if( pair.first == comb ) {
2277 return pair.second;
2278 }
2279 }
2280
2282 };
2283
2284 uint32_t disabledPattern { 0 };
2285
2286 // Loop over extrapolated points (along direction)
2287 auto& exPattern_along = *( exPattern.first );
2288
2289 for( auto itr = exPattern_along.begin(); itr != exPattern_along.end(); ++itr ) {
2290 if( std::next( itr ) == exPattern_along.end() ) continue;
2291
2292 const auto& point = *itr;
2293
2294 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": isGood = " << std::get<isGood>( point ) );
2295
2296 if( !std::get<isGood>( point ) ) {
2297 const auto& detectorType = getDetectorType( point );
2298 disabledPattern += (1 << detectorType);
2299 }
2300 }
2301
2302 uint32_t hitPattern = trk->hitPattern();
2303 uint32_t modifiedPattern = disabledPattern | hitPattern;
2304
2305 std::string msg = "Disabled hit pattern: ";
2306 for( unsigned i=0; i<Trk::numberOfDetectorTypes; i++) {
2307 msg += Form("%u", ( disabledPattern >> i ) & 1 );
2308 }
2309 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": " << msg );
2310
2311 msg = "Recorded hit pattern: ";
2312 for( unsigned i=0; i<Trk::numberOfDetectorTypes; i++) {
2313 msg += Form("%u", ( hitPattern >> i ) & 1 );
2314 }
2315 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": " << msg );
2316
2317 return patternCheck( modifiedPattern, vertex );
2318
2319 }

◆ checkTrackHitPatternToVertexOuterOnly()

bool VKalVrtAthena::VrtSecInclusive::checkTrackHitPatternToVertexOuterOnly ( const xAOD::TrackParticle * trk,
const Amg::Vector3D & vertex )
private

A classical method with hard-coded geometry.

Definition at line 2196 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2197 {
2198
2199 const uint32_t pattern = trk->hitPattern();
2200
2201 return patternCheckOuterOnly( pattern, vertex );
2202
2203 }
bool patternCheckOuterOnly(const uint32_t &pattern, const Amg::Vector3D &vertex)

◆ clearNtupleVariables()

StatusCode VKalVrtAthena::VrtSecInclusive::clearNtupleVariables ( )
private

Definition at line 227 of file AANT_Tools.cxx.

227 {
228
229 m_ntupleVars->clear();
230
231 return StatusCode::SUCCESS;
232 }

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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)

◆ declareProperties()

void VKalVrtAthena::VrtSecInclusive::declareProperties ( )
private

Definition at line 686 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

686 {
687
688 declareProperty("GeoModel", m_jp.geoModel = VKalVrtAthena::GeoModel::Run2 );
689
690 declareProperty("TrackLocation", m_jp.TrackLocation = "InDetTrackParticles" );
691 declareProperty("MuonLocation", m_jp.MuonLocation = "Muons" );
692 declareProperty("ElectronLocation", m_jp.ElectronLocation = "Electrons" );
693 declareProperty("PrimVrtLocation", m_jp.PrimVrtLocation = "PrimaryVertices" );
694 declareProperty("McParticleContainer", m_jp.truthParticleContainerName = "TruthParticles" );
695 declareProperty("MCEventContainer", m_jp.mcEventContainerName = "TruthEvents" );
696 declareProperty("AugmentingVersionString", m_jp.augVerString = "_VSI" );
697 declareProperty("TruthParticleFilter", m_jp.truthParticleFilter = "Rhadron" ); // Either "", "Kshort", "Rhadron", "HNL", "HadInt", "Bhadron"
698
699 declareProperty("All2trkVerticesContainerName", m_jp.all2trksVerticesContainerName = "All2TrksVertices" );
700 declareProperty("SecondaryVerticesContainerName", m_jp.secondaryVerticesContainerName = "SecondaryVertices" );
701
702 declareProperty("FillHist", m_jp.FillHist = false );
703 declareProperty("FillNtuple", m_jp.FillNtuple = false );
704 declareProperty("FillIntermediateVertices", m_jp.FillIntermediateVertices = false );
705 declareProperty("DoIntersectionPos", m_jp.doIntersectionPos = false );
706 declareProperty("DoMapToLocal", m_jp.doMapToLocal = false );
707 declareProperty("DoTruth", m_jp.doTruth = false );
708 declareProperty("DoPVcompatibility", m_jp.doPVcompatibilityCut = true );
709 declareProperty("DoTightPVcompatibility", m_jp.doTightPVcompatibilityCut = false );
710 declareProperty("RemoveFake2TrkVrt", m_jp.removeFakeVrt = true );
711 declareProperty("DoDelayedFakeReject", m_jp.removeFakeVrtLate = false );
712 declareProperty("CheckHitPatternStrategy", m_checkPatternStrategy = "Classical" ); // Either Classical or Extrapolation
713 declareProperty("MCTrackResolution", m_jp.mcTrkResolution = 0.06 ); // see getTruth for explanation
714 declareProperty("TruthTrkLen", m_jp.TruthTrkLen = 1000 ); // in [mm]
715 declareProperty("ExtrapPV", m_jp.extrapPV = false ); // Leave false. only for testing
716 declareProperty("PassThroughTrackSelection", m_jp.passThroughTrackSelection = false );
717 declareProperty("DoFastMode", m_jp.doFastMode = false );
718
719
720 declareProperty("DoTwoTrSoftBtag", m_jp.doTwoTrSoftBtag = false );
721 declareProperty("TwoTrVrtAngleCut", m_jp.twoTrVrtAngleCut = -10 );
722 declareProperty("TwoTrVrtMinDistFromPVCut", m_jp.twoTrVrtMinDistFromPV = 0. );
723
724 declareProperty("TruncateListOfWorkingVertices", m_jp.truncateWrkVertices = true );
725 declareProperty("MaxNumberOfWorkingVertices", m_jp.maxWrkVertices = 1500 );
726
727 // default values are set upstream - check top of file
728 declareProperty("do_PVvetoCut", m_jp.do_PVvetoCut = true );
729 declareProperty("do_d0Cut", m_jp.do_d0Cut = true );
730 declareProperty("do_z0Cut", m_jp.do_z0Cut = true );
731 declareProperty("do_d0errCut", m_jp.do_d0errCut = false );
732 declareProperty("do_z0errCut", m_jp.do_z0errCut = false );
733 declareProperty("do_d0signifCut", m_jp.do_d0signifCut = false );
734 declareProperty("do_z0signifCut", m_jp.do_z0signifCut = false );
735
736 declareProperty("ImpactWrtBL", m_jp.ImpactWrtBL = true ); // false option is going to be deprecated
737 declareProperty("a0TrkPVDstMinCut", m_jp.d0TrkPVDstMinCut = 0. ); // in [mm]
738 declareProperty("a0TrkPVDstMaxCut", m_jp.d0TrkPVDstMaxCut = 1000. ); // in [mm]
739 declareProperty("a0TrkPVSignifCut", m_jp.d0TrkPVSignifCut = 0. ); // in [mm]
740 declareProperty("twoTrkVtxFormingD0Cut", m_jp.twoTrkVtxFormingD0Cut = 1. ); // in [mm]
741 declareProperty("zTrkPVDstMinCut", m_jp.z0TrkPVDstMinCut = 0. ); // in [mm]
742 declareProperty("zTrkPVDstMaxCut", m_jp.z0TrkPVDstMaxCut = 1000. ); // in [mm]
743 declareProperty("zTrkPVSignifCut", m_jp.z0TrkPVSignifCut = 0. ); // in unit of sigma
744 declareProperty("TrkA0ErrCut", m_jp.d0TrkErrorCut = 10000 ); // in [mm]
745 declareProperty("TrkZErrCut", m_jp.z0TrkErrorCut = 20000 ); // in [mm]
746
747 declareProperty("SelTrkMaxCutoff", m_jp.SelTrkMaxCutoff = 50 ); // max number of tracks
748 declareProperty("TrkPtCut", m_jp.TrkPtCut = 1000. ); // low pT threshold. in [MeV]
749 declareProperty("TrkChi2Cut", m_jp.TrkChi2Cut = 3. ); // in terms of chi2 / ndof
750 declareProperty("PVcompatibilityCut", m_jp.pvCompatibilityCut = -20. ); // in [mm]
751 declareProperty("SelVrtChi2Cut", m_jp.SelVrtChi2Cut = 4.5 ); // in terms of chi2 / ndof
752
753 declareProperty("CutSctHits", m_jp.CutSctHits = 0 );
754 declareProperty("CutPixelHits", m_jp.CutPixelHits = 0 );
755 declareProperty("CutSiHits", m_jp.CutSiHits = 0 );
756 declareProperty("DoSAloneTRT", m_jp.SAloneTRT = false ); // SAlone = "standalone"
757 declareProperty("CutBLayHits", m_jp.CutBLayHits = 0 );
758 declareProperty("CutSharedHits", m_jp.CutSharedHits = 0 );
759 declareProperty("doTRTPixCut", m_jp.doTRTPixCut = false ); // mode for R-hadron displaced vertex
760 declareProperty("CutTRTHits", m_jp.CutTRTHits = 0 );
761 declareProperty("CutTightSCTHits", m_jp.CutTightSCTHits = 7 );
762 declareProperty("CutTightTRTHits", m_jp.CutTightTRTHits = 20 );
763
764 declareProperty("TrkExtrapolator", m_jp.trkExtrapolator = 2 );
765
766 declareProperty("doReassembleVertices", m_jp.doReassembleVertices = false );
767 declareProperty("doMergeByShuffling", m_jp.doMergeByShuffling = false );
768 declareProperty("doSuggestedRefitOnMerging", m_jp.doSuggestedRefitOnMerging = true ); // sub-option of doMergeByShuffling-1
769 declareProperty("doMagnetMerging", m_jp.doMagnetMerging = true ); // sub-option of doMergeByShuffling-2
770 declareProperty("doWildMerging", m_jp.doWildMerging = true ); // sub-option of doMergeByShuffling-3
771 declareProperty("doMergeFinalVerticesDistance", m_jp.doMergeFinalVerticesDistance = false );
772 declareProperty("doAssociateNonSelectedTracks", m_jp.doAssociateNonSelectedTracks = false );
773 declareProperty("doFinalImproveChi2", m_jp.doFinalImproveChi2 = false );
774
775 declareProperty("VertexMergeCut", m_jp.VertexMergeCut = 3 );
776 declareProperty("TrackDetachCut", m_jp.TrackDetachCut = 6 );
777 declareProperty("associateMinDistanceToPV", m_jp.associateMinDistanceToPV = 0.5 );
778 declareProperty("associateMaxD0Signif", m_jp.associateMaxD0Signif = 5. ); // wrt. DV in unit of sigma
779 declareProperty("associateMaxZ0Signif", m_jp.associateMaxZ0Signif = 5. ); // wrt. DV in unit of sigma
780 declareProperty("associatePtCut", m_jp.associatePtCut = 0. ); // in [MeV]
781 declareProperty("associateChi2Cut", m_jp.associateChi2Cut = 20. );
782 declareProperty("reassembleMaxImpactParameterD0", m_jp.reassembleMaxImpactParameterD0 = 1. ); // wrt. DV in [mm]
783 declareProperty("reassembleMaxImpactParameterZ0", m_jp.reassembleMaxImpactParameterZ0 = 5. ); // wrt. DV in [mm]
784 declareProperty("mergeByShufflingMaxSignificance", m_jp.mergeByShufflingMaxSignificance = 100. ); // in unit of sigma
785 declareProperty("mergeByShufflingAllowance", m_jp.mergeByShufflingAllowance = 4. ); // in unit of sigma
786 declareProperty("VertexMergeFinalDistCut", m_jp.VertexMergeFinalDistCut = 1. ); // in [mm]
787 declareProperty("VertexMergeFinalDistScaling", m_jp.VertexMergeFinalDistScaling = 0. ); // in [1/mm]
788 declareProperty("improveChi2ProbThreshold", m_jp.improveChi2ProbThreshold = 1.e-4 );
789
790 // A test implementation for muon vertices
791 declareProperty("doSelectTracksFromMuons", m_jp.doSelectTracksFromMuons = false );
792 declareProperty("doRemoveCaloTaggedMuons", m_jp.doRemoveCaloTaggedMuons = false );
793 declareProperty("doSelectTracksFromElectrons", m_jp.doSelectTracksFromElectrons = false );
794 declareProperty("doSelectIDAndGSFTracks", m_jp.doSelectIDAndGSFTracks = false );
795 declareProperty("doRemoveNonLeptonVertices", m_jp.doRemoveNonLeptonVertices = false );
796
797 // Disappearing track vertices
798 declareProperty("doDisappearingTrackVertexing", m_jp.doDisappearingTrackVertexing = false );
799 declareProperty("twoTrVrtMaxPerigeeDist", m_jp.twoTrVrtMaxPerigeeDist = 50 ); // in [mm]
800 declareProperty("twoTrVrtMinRadius", m_jp.twoTrVrtMinRadius = 50 ); // in [mm]
801
802
803
804 // Select tracks with additonal LRT Cuts (inspiried by Run 3 LRT optimization studies)
805 declareProperty("doSelectTracksWithLRTCuts", m_jp.doSelectTracksWithLRTCuts = false );
806
807 // Additional dressing option
808 declareProperty("doAugmentDVimpactParametersToMuons", m_jp.doAugmentDVimpactParametersToMuons = false );
809 declareProperty("doAugmentDVimpactParametersToElectrons", m_jp.doAugmentDVimpactParametersToElectrons = false );
810
811 // Additional ToolHandles
812 declareProperty("VertexFitterTool", m_fitSvc, " Private TrkVKalVrtFitter" );
813 declareProperty("Extrapolator", m_extrapolator );
814 declareProperty("TrackToVertexTool", m_trackToVertexTool );
815 declareProperty("TrackToVertexIPEstimatorTool", m_trackToVertexIPEstimatorTool );
816 declareProperty("VertexMapper", m_vertexMapper );
817 declareProperty("TruthToTrack", m_truthToTrack );
818
819 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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>

◆ deleteNtupleVariables()

StatusCode VKalVrtAthena::VrtSecInclusive::deleteNtupleVariables ( )
private

Definition at line 209 of file AANT_Tools.cxx.

209 {
210
211 m_ntupleVars->deleteNtupleVariables();
212
213 return StatusCode::SUCCESS;
214 }

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

◆ disassembleVertex()

StatusCode VKalVrtAthena::VrtSecInclusive::disassembleVertex ( std::vector< WrkVrt > * workVerticesContainer,
const unsigned & vertexIndex )
private

Definition at line 118 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

119 {
120
121 auto& wrkvrt = workVerticesContainer->at(iv);
122
123 ATH_MSG_VERBOSE(" >> disassembleVertex(): begin: disassembling vertex[" << iv << "], workVerticesContainer.size() = " << workVerticesContainer->size() );
124 ATH_MSG_VERBOSE(" >> disassembleVertex(): Vertex: r = " << wrkvrt.vertex.perp() << ", z = " << wrkvrt.vertex.z() );
125
126 // Loop over the tracks associated to the vertex and slect the maximum chi2 track
127 const auto& ntrk = wrkvrt.selectedTrackIndices.size();
128 size_t maxChi2TrackIndex = AlgConsts::invalidUnsigned;
129
130 // If the size of the tracks is less than 2, this algorithm is meaningless.
131 if( wrkvrt.selectedTrackIndices.size() <= 2 ) return StatusCode::SUCCESS;
132
133 for( auto& index : wrkvrt.selectedTrackIndices ) {
134 const xAOD::TrackParticle* trk = m_selectedTracks.at( index );
135
136 ATH_MSG_VERBOSE(" >> disassembleVertex(): > track at vertex[" << iv << "]: "
137 << "index = " << trk->index()
138 << ", pT = " << trk->pt()
139 << ", phi = " << trk->phi()
140 << ", d0 = " << trk->d0()
141 << ", z0 = " << trk->z0());
142 }
143
144 // find the track with the maximum chi2
145 const auto& max = std::max_element( wrkvrt.Chi2PerTrk.begin(), wrkvrt.Chi2PerTrk.end() );
146
147 if( max == wrkvrt.Chi2PerTrk.end() ) return StatusCode::SUCCESS;
148
149 maxChi2TrackIndex = max - wrkvrt.Chi2PerTrk.begin();
150
151 // return if no track is found.
152 if(maxChi2TrackIndex == AlgConsts::invalidUnsigned ) return StatusCode::SUCCESS;
153
154
155 // define work variables
156 vector<const xAOD::NeutralParticle*> dummyNeutrals;
157
158 vector<WrkVrt> new_vertices;
159
160 // Loop over the tracks associated to the vertex other than the selected tracks
161 ATH_MSG_VERBOSE(" >> disassembleVertex(): Loop over the tracks associated to the vertex other than the selected tracks.");
162 for(size_t itrk=0; itrk<ntrk; itrk++) {
163
164 ATH_MSG_VERBOSE(" >> disassembleVertex(): > Loop itrk = " << itrk << " / " << ntrk );
165
166 // reject the selected track
167 if( itrk == maxChi2TrackIndex ) {
168 ATH_MSG_VERBOSE(" >> disassembleVertex(): > skipped." );
169 continue;
170 }
171
172 const size_t this_trk_id = wrkvrt.selectedTrackIndices[itrk];
173 const size_t selected_trk_id = wrkvrt.selectedTrackIndices[maxChi2TrackIndex];
174
175 ATH_MSG_VERBOSE(" >> disassembleVertex(): > this_trk_id = " << this_trk_id << ", selected_trk_id = " << selected_trk_id << ", alltrks_size = " << m_selectedTracks.size() );
176 if( this_trk_id >= m_selectedTracks.size() ) {
177 ATH_MSG_VERBOSE(" >> disassembleVertex(): > this_trk_id is invalid. continue!" );
178 continue;
179 }
180 if( selected_trk_id >= m_selectedTracks.size() ) {
181 ATH_MSG_VERBOSE(" >> disassembleVertex(): > selected_trk_id is invalid. continue!" );
182 continue;
183 }
184
185 ATH_MSG_VERBOSE(" >> disassembleVertex(): > Storing tracks to ListBaseTracks" );
186 ATH_MSG_VERBOSE(" >> disassembleVertex(): > m_selectedTracks.at( this_trk_id ) = " << m_selectedTracks.at( this_trk_id )->index() );
187 ATH_MSG_VERBOSE(" >> disassembleVertex(): > m_selectedTracks.at( this_trk_id ) = " << m_selectedTracks.at( selected_trk_id )->index() );
188
189 vector<const xAOD::TrackParticle*> ListBaseTracks;
190 ListBaseTracks.emplace_back( m_selectedTracks.at( this_trk_id ) );
191 ListBaseTracks.emplace_back( m_selectedTracks.at( selected_trk_id ) );
192
193 ATH_MSG_VERBOSE(" >> disassembleVertex(): > ListBaseTracks was stored." );
194
195 WrkVrt newvrt;
196 newvrt.selectedTrackIndices.emplace_back( this_trk_id );
197 newvrt.selectedTrackIndices.emplace_back( selected_trk_id );
198
199 // Fit the new vertex
200 ATH_MSG_VERBOSE(" >> disassembleVertex(): > Fast Fit" );
201
202 std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState();
203 ATH_CHECK( m_fitSvc->VKalVrtFitFast( ListBaseTracks, newvrt.vertex, *state ) );
204
205 ATH_MSG_VERBOSE( " >> disassembleVertex(): > ApproxVertex: r = " << newvrt.vertex.perp() << ", z = " << newvrt.vertex.z() );
206
207 if( vtxVtxDistance( wrkvrt.vertex, newvrt.vertex ) > 10. )
208 {
209 m_fitSvc->setApproximateVertex( wrkvrt.vertex[0], wrkvrt.vertex[1], wrkvrt.vertex[2], *state );
210 }
211 else
212 {
213 m_fitSvc->setApproximateVertex( newvrt.vertex[0], newvrt.vertex[1], newvrt.vertex[2], *state );
214 }
215
216 ATH_MSG_VERBOSE(" >> disassembleVertex(): > Fit the new vertex" );
217 StatusCode sc = m_fitSvc->VKalVrtFit(ListBaseTracks,
218 dummyNeutrals,
219 newvrt.vertex,
220 newvrt.vertexMom,
221 newvrt.Charge,
222 newvrt.vertexCov,
223 newvrt.Chi2PerTrk,
224 newvrt.TrkAtVrt,
225 newvrt.Chi2,
226 *state);
227
228 if( sc.isFailure() ) continue;
229
230 newvrt.closestWrkVrtIndex = 0;
231 newvrt.closestWrkVrtValue = AlgConsts::maxValue;
232
233 // register the new vertex to the vertex list
234 ATH_MSG_VERBOSE(" >> disassembleVertex(): > register the new vertex to the vertex list" );
235 new_vertices.emplace_back( newvrt );
236 }
237
238 // remove the selected track from the original vertex
239 wrkvrt.selectedTrackIndices.erase( wrkvrt.selectedTrackIndices.begin() + maxChi2TrackIndex ); //remove track
240 ATH_MSG_VERBOSE(" >> disassembleVertex(): removed the selected track from the original vertex. wrkvrt.selectedTrackIndices.size = " << wrkvrt.selectedTrackIndices.size() );
241
242 // refit the original vertex
243 ATH_MSG_VERBOSE(" >> disassembleVertex(): refit the original vertex" );
244
245 StatusCode sc = refitVertex( wrkvrt );
246 if( sc.isFailure() ) {
247 // WARNING CODE ATLASRECTS-3145::001 refitVertex Failure, vertex lost
248 ATH_MSG_WARNING("ATLASRECTS-3145::001" );
249 return StatusCode::SUCCESS;
250 }
251 // end of workaround
252
253 for( const auto& vertex : new_vertices ) {
254 ATH_MSG_VERBOSE(" >> disassembleVertex(): > emplace_back new vertex" );
255 workVerticesContainer->emplace_back( vertex );
256 }
257
258 ATH_MSG_VERBOSE(" >> disassembleVertex(): end. workVerticesContainer.size() = " << workVerticesContainer->size() );
259 return StatusCode::SUCCESS;
260 }
#define ATH_MSG_WARNING(x)
#define max(a, b)
Definition cfImp.cxx:41
size_t index() const
Return the index of this element within its container.
float z0() const
Returns the parameter.
float d0() const
Returns the parameter.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
std::deque< long int > selectedTrackIndices
flagged true for good vertex candidates

◆ distanceBetweenVertices()

double VKalVrtAthena::VrtSecInclusive::distanceBetweenVertices ( const WrkVrt & v1,
const WrkVrt & v2 ) const
private

calculate the physical distance

Definition at line 112 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

112 {
113 return (v2.vertex - v1.vertex).norm();
114 }

◆ dumpTruthInformation()

void VKalVrtAthena::VrtSecInclusive::dumpTruthInformation ( )
private

Definition at line 2366 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2366 {
2367
2368 const xAOD::EventInfo* eventInfo { nullptr };
2369 const xAOD::TruthParticleContainer* truthParticles { nullptr };
2370 const xAOD::TruthVertexContainer* truthVertices { nullptr };
2371
2372 auto sc0 = evtStore()->retrieve( eventInfo, "EventInfo" );
2373 if( sc0.isFailure() ) { return; }
2374
2375 if( !eventInfo->eventType( xAOD::EventInfo::IS_SIMULATION ) ) {
2376 return;
2377 }
2378
2379 auto sc1 = evtStore()->retrieve( truthParticles, "TruthParticles" );
2380 if( sc1.isFailure() ) { return; }
2381
2382 auto sc2 = evtStore()->retrieve( truthVertices, "TruthVertices" );
2383 if( sc2.isFailure() ) { return; }
2384
2385 if( !truthParticles ) { return; }
2386 if( !truthVertices ) { return; }
2387
2388 m_tracingTruthVertices.clear();
2389
2390 std::vector<const xAOD::TruthParticle*> truthSvTracks;
2391
2392 // truth particle selection functions
2393
2394 auto selectNone = [](const xAOD::TruthVertex*) ->bool { return false; };
2395
2396 auto selectRhadron = [](const xAOD::TruthVertex* truthVertex ) -> bool {
2397 if( truthVertex->nIncomingParticles() != 1 ) return false;
2398 if( !truthVertex->incomingParticle(0) ) return false;
2399 if( abs(truthVertex->incomingParticle(0)->pdgId()) < 1000000 ) return false;
2400 if( abs(truthVertex->incomingParticle(0)->pdgId()) > 1000000000 ) return false; // Nuclear codes, e.g. deuteron
2401 // neutralino in daughters
2402 bool hasNeutralino = false;
2403 for( unsigned ip = 0; ip < truthVertex->nOutgoingParticles(); ip++ ) {
2404 const auto* p = truthVertex->outgoingParticle(ip);
2405 if( abs( p->pdgId() ) == 1000022 ) {
2406 hasNeutralino = true;
2407 break;
2408 }
2409 }
2410 return hasNeutralino;
2411 };
2412
2413 auto selectHNL = [](const xAOD::TruthVertex* truthVertex ) -> bool {
2414 if( truthVertex->nIncomingParticles() != 1 ) return false;
2415 if( !truthVertex->incomingParticle(0) ) return false;
2416 if( abs(truthVertex->incomingParticle(0)->pdgId()) != 50 ) return false;
2417 return true;
2418 };
2419
2420 auto selectHiggs = [](const xAOD::TruthVertex* truthVertex ) -> bool {
2421 if( truthVertex->nIncomingParticles() != 1 ) return false;
2422 if( !truthVertex->incomingParticle(0) ) return false;
2423 if( abs(truthVertex->incomingParticle(0)->pdgId()) != 36 ) return false;
2424 return true;
2425 };
2426
2427 auto selectKshort = [](const xAOD::TruthVertex* truthVertex ) -> bool {
2428 if( truthVertex->nIncomingParticles() != 1 ) return false;
2429 if( !truthVertex->incomingParticle(0) ) return false;
2430 if( abs(truthVertex->incomingParticle(0)->pdgId()) != 310 ) return false;
2431 return true;
2432 };
2433
2434 auto selectBhadron = [](const xAOD::TruthVertex* truthVertex ) -> bool {
2435 if( truthVertex->nIncomingParticles() != 1 ) return false;
2436 if( !truthVertex->incomingParticle(0) ) return false;
2437 if( abs(truthVertex->incomingParticle(0)->pdgId()) <= 500 || abs(truthVertex->incomingParticle(0)->pdgId()) >= 600 ) return false;
2438 return true;
2439 };
2440
2441 auto selectHadInt = [](const xAOD::TruthVertex* truthVertex ) -> bool {
2442 if( truthVertex->nIncomingParticles() != 1 ) return false;
2443 if( !truthVertex->incomingParticle(0) ) return false;
2444
2445 const auto* parent = truthVertex->incomingParticle(0);
2446 if( parent->isLepton() ) return false;
2447
2448 TLorentzVector p4sum_in;
2449 TLorentzVector p4sum_out;
2450 for( unsigned ip = 0; ip < truthVertex->nIncomingParticles(); ip++ ) {
2451 const auto* particle = truthVertex->incomingParticle(ip);
2452 TLorentzVector p4; p4.SetPtEtaPhiM( particle->pt(), particle->eta(), particle->phi(), particle->m() );
2453 p4sum_in += p4;
2454 }
2455 for( unsigned ip = 0; ip < truthVertex->nOutgoingParticles(); ip++ ) {
2456 const auto* particle = truthVertex->outgoingParticle(ip);
2457 TLorentzVector p4; p4.SetPtEtaPhiM( particle->pt(), particle->eta(), particle->phi(), particle->m() );
2458 p4sum_out += p4;
2459 }
2460 return p4sum_out.E() - p4sum_in.E() >= 100.;
2461 };
2462
2463
2464
2465 using ParticleSelectFunc = bool (*)(const xAOD::TruthVertex*);
2466 std::map<std::string, ParticleSelectFunc> selectFuncs { { "", selectNone },
2467 { "Kshort", selectKshort },
2468 { "Bhadron", selectBhadron },
2469 { "Rhadron", selectRhadron },
2470 { "HNL", selectHNL },
2471 { "Higgs", selectHiggs },
2472 { "HadInt", selectHadInt } };
2473
2474
2475 if( selectFuncs.find( m_jp.truthParticleFilter ) == selectFuncs.end() ) {
2476 ATH_MSG_WARNING( " > " << __FUNCTION__ << ": invalid function specification: " << m_jp.truthParticleFilter );
2477 return;
2478 }
2479
2480 auto selectFunc = selectFuncs.at( m_jp.truthParticleFilter );
2481
2482 // loop over truth vertices
2483 for( const auto *truthVertex : *truthVertices ) {
2484 if( selectFunc( truthVertex ) ) {
2485 m_tracingTruthVertices.emplace_back( truthVertex );
2486 std::string msg;
2487 msg += Form("pdgId = %d, (r, z) = (%.2f, %.2f), ", truthVertex->incomingParticle(0)->pdgId(), truthVertex->perp(), truthVertex->z());
2488 msg += Form("nOutgoing = %lu, ", truthVertex->nOutgoingParticles() );
2489 msg += Form("mass = %.3f GeV, pt = %.3f GeV", truthVertex->incomingParticle(0)->m()/1.e3, truthVertex->incomingParticle(0)->pt()/1.e3 );
2490 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": " << msg );
2491 }
2492 }
2493
2494 if( m_jp.FillHist ) {
2495 for( const auto* truthVertex : m_tracingTruthVertices ) {
2496 m_hists["nMatchedTruths"]->Fill( 0., truthVertex->perp() );
2497 }
2498 }
2499
2500 }
std::vector< const xAOD::TruthVertex * > m_tracingTruthVertices
bool eventType(EventType type) const
Check for one particular bitmask value.
@ IS_SIMULATION
true: simulation, false: data
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
setBGCode setTAP setLVL2ErrorBits bool
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode VKalVrtAthena::VrtSecInclusive::execute ( )
virtual

Definition at line 294 of file VrtSecInclusive.cxx.

295 {
296 //
297 ATH_MSG_DEBUG("VrtSecInclusive execute()");
298
300
301 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey);
302 if (!eventInfo.isValid()) {
303 ATH_MSG_ERROR ("Could not retrieve EventInfo");
304 return StatusCode::FAILURE;
305 }
306
307 SG::WriteDecorHandle<xAOD::EventInfo,int> vertexingStatusDecor(m_vertexingStatusKey);
308
309 // clear ntuple variables
310 StatusCode sc = this->initEvent();
311 if(sc.isFailure()) {
312 ATH_MSG_WARNING("Problem in initEvent ");
313 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
314 return StatusCode::SUCCESS;
315 }
316
317 // add event level info to ntuple
318 if( m_jp.FillNtuple ) sc = addEventInfo();
319
320 if (sc.isFailure() ) {
321 ATH_MSG_WARNING("Failure in getEventInfo() ");
322 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
323 return StatusCode::SUCCESS;
324 }
325
326
328 //
329 // Setup StoreGate Variables
330 //
331
332 // Check Return StatusCode::Failure if the user-specified container names have duplication.
333 {
334 std::vector<std::string> userContainerNames { m_jp.secondaryVerticesContainerName, m_jp.all2trksVerticesContainerName };
335 std::set<std::string> userContainerNamesSet;
336 for( auto& name : userContainerNames ) userContainerNamesSet.insert( name );
337 if( userContainerNamesSet.size() != userContainerNames.size() ) {
338 ATH_MSG_ERROR( " > " << __FUNCTION__ << ": detected duplicated user-specified container name. Please check your job property" );
339 return StatusCode::FAILURE;
340 }
341 }
342
343 auto *secondaryVertexContainer = new xAOD::VertexContainer;
344 auto *secondaryVertexAuxContainer = new xAOD::VertexAuxContainer;
345
346 secondaryVertexContainer ->setStore( secondaryVertexAuxContainer );
347
348 ATH_CHECK( evtStore()->record( secondaryVertexContainer, "VrtSecInclusive_" + m_jp.secondaryVerticesContainerName + m_jp.augVerString ) );
349 ATH_CHECK( evtStore()->record( secondaryVertexAuxContainer, "VrtSecInclusive_" + m_jp.secondaryVerticesContainerName + m_jp.augVerString + "Aux." ) );
350
351 if( m_jp.FillIntermediateVertices ) {
352 auto *twoTrksVertexContainer = new xAOD::VertexContainer;
353 auto *twoTrksVertexAuxContainer = new xAOD::VertexAuxContainer;
354
355 twoTrksVertexContainer ->setStore( twoTrksVertexAuxContainer );
356
357 ATH_CHECK( evtStore()->record( twoTrksVertexContainer, "VrtSecInclusive_" + m_jp.all2trksVerticesContainerName + m_jp.augVerString ) );
358 ATH_CHECK( evtStore()->record( twoTrksVertexAuxContainer, "VrtSecInclusive_" + m_jp.all2trksVerticesContainerName + m_jp.augVerString + "Aux." ) );
359
360 for( auto itr = m_vertexingAlgorithms.begin(); itr!=m_vertexingAlgorithms.end(); ++itr ) {
361
362 auto& name = itr->first;
363
364 auto *intermediateVertexContainer = new xAOD::VertexContainer;
365 auto *intermediateVertexAuxContainer = new xAOD::VertexAuxContainer;
366
367 intermediateVertexContainer ->setStore( intermediateVertexAuxContainer );
368
369 ATH_CHECK( evtStore()->record( intermediateVertexContainer, "VrtSecInclusive_IntermediateVertices_" + name + m_jp.augVerString ) );
370 ATH_CHECK( evtStore()->record( intermediateVertexAuxContainer, "VrtSecInclusive_IntermediateVertices_" + name + m_jp.augVerString + "Aux." ) );
371 }
372
373 }
374
376
377
378 // Later use elsewhere in the algorithm
379 m_selectedTracks.clear();
380 m_associatedTracks.clear();
381 m_leptonicTracks.clear();
382
384
386 //
387 // now start algorithm
388 //
389
390 //--------------------------------------------------------
391 // Primary vertex processing
392 //
393 sc = this->processPrimaryVertices(); // fetch the 1st primary reconstructed vertex
394
395 if( sc.isFailure() or !m_thePV ) {
396
397 ATH_MSG_WARNING("processPrimaryVertices() failed");
398 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
399 return StatusCode::SUCCESS;
400 }
401
402 // Perform track selection and store it to selectedBaseTracks
403 for( auto alg : m_trackSelectionAlgs ) {
404 ATH_CHECK( (this->*alg)() );
405 }
406
407 if( m_jp.FillNtuple )
408 m_ntupleVars->get<unsigned int>( "NumSelTrks" ) = static_cast<int>( m_selectedTracks.size() );
409
410 // fill information about selected tracks in AANT
412
413 //-------------------------------------------------------
414 // Skip the event if the number of selected tracks is more than m_jp.SelTrkMaxCutoff
415 if( m_selectedTracks.size() < 2 ) {
416 ATH_MSG_DEBUG( "execute: Too few (<2) selected reco tracks. Terminated reconstruction." );
418 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
420 return StatusCode::SUCCESS;
421 }
422
423 if( m_selectedTracks.size() > m_jp.SelTrkMaxCutoff ) {
424 ATH_MSG_INFO( "execute: Too many selected reco tracks. Terminated reconstruction." );
426 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
428 return StatusCode::SUCCESS;
429 }
430
431 //-------------------------------------------------------
432 // Core part of Vertexing
433 //
434
435 {
436
438
439 // set of vertices created in the following while loop.
440 std::vector<WrkVrt> workVerticesContainer;
441
442 // the main sequence of the main vertexing algorithms
443 // see initialize() what kind of algorithms exist.
444 for( auto itr = m_vertexingAlgorithms.begin(); itr!=m_vertexingAlgorithms.end(); ++itr ) {
445
446 auto& name = itr->first;
447 auto alg = itr->second;
448
449 auto t_start = std::chrono::system_clock::now();
450
451 ATH_CHECK( (this->*alg)( &workVerticesContainer ) );
452
453 auto t_end = std::chrono::system_clock::now();
454
455 if( m_jp.FillHist ) {
456 auto sec = std::chrono::duration_cast<std::chrono::microseconds>( t_end - t_start ).count();
457 m_hists["CPUTime"]->Fill( m_vertexingAlgorithmStep, sec/1.e6 );
458 }
459
460 std::erase_if( workVerticesContainer,
461 []( WrkVrt& wrkvrt ) {
462 return ( !wrkvrt.isGood || wrkvrt.nTracksTotal() < 2 ); }
463 );
464
465 ATH_CHECK( monitorVertexingAlgorithmStep( &workVerticesContainer, name, std::next( itr ) == m_vertexingAlgorithms.end() ) );
466
468
469 }
470 }
471
473 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
474
475 // Fill AANT
476 if( m_jp.FillNtuple ) {
477 m_tree_Vert->Fill();
479 }
480
482
483 ATH_MSG_VERBOSE( "execute: process done." );
484 // end
485 return StatusCode::SUCCESS;
486
487 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
void lockTrackDecorations(const xAOD::TrackParticle *trk, bool onlySelection) const
lock decorations at the end of the algorithm
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Read/Write Handle Keys.
StatusCode monitorVertexingAlgorithmStep(std::vector< WrkVrt > *, const std::string &name, bool final=false)
monitor the intermediate status of vertexing
std::vector< std::pair< std::string, vertexingAlg > > m_vertexingAlgorithms
SG::WriteDecorHandleKey< xAOD::EventInfo > m_vertexingStatusKey
std::vector< const xAOD::TrackParticle * > m_leptonicTracks
std::vector< TrackSelectionAlg > m_trackSelectionAlgs
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
std::size_t erase_if(T_container &container, T_Func pred)
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.

◆ extractIncompatibleTrackPairs()

StatusCode VKalVrtAthena::VrtSecInclusive::extractIncompatibleTrackPairs ( std::vector< WrkVrt > * workVerticesContainer)
private

related to the graph method and verte finding

Definition at line 39 of file VertexingAlgs.cxx.

40 {
41
42 // Output SVs as xAOD::Vertex
43 // Needs a conversion function from WrkVrtSet to xAOD::Vertex here.
44 // The supposed form of the function will be as follows:
45 const xAOD::TrackParticleContainer* trackParticleContainer ( nullptr );
46 ATH_CHECK( evtStore()->retrieve( trackParticleContainer, m_jp.TrackLocation) );
47
48 xAOD::VertexContainer *twoTrksVertexContainer( nullptr );
49 if( m_jp.FillIntermediateVertices ) {
50 ATH_CHECK( evtStore()->retrieve( twoTrksVertexContainer, "VrtSecInclusive_" + m_jp.all2trksVerticesContainerName + m_jp.augVerString ) );
51 }
52
53 m_incomp.clear();
54
55 // Work variables
56 std::vector<const xAOD::TrackParticle*> baseTracks;
57 std::vector<const xAOD::NeutralParticle*> dummyNeutrals;
58
59 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Selected Tracks = "<< m_selectedTracks.size());
60 if( m_jp.FillHist ) { m_hists["selTracksDist"]->Fill( m_selectedTracks.size() ); }
61
62 std::string msg;
63
64 enum recoStep { kStart, kInitVtxPosition, kImpactParamCheck, kVKalVrtFit, kChi2, kVposCut, kPatternMatch };
65
66 const double maxR { 563. }; // r = 563 mm is the TRT inner surface
67 double roughD0Cut = 100.;
68 double roughZ0Cut = 50.;
69 if(m_jp.doDisappearingTrackVertexing){
70 roughD0Cut = 1000.;
71 roughZ0Cut = 1000.;
72 }
73
74 // Truth match map
75 std::map<const xAOD::TruthVertex*, bool> matchMap;
76
77 // first make all 2-track vertices
78 for( auto itrk = m_selectedTracks.begin(); itrk != m_selectedTracks.end(); ++itrk ) {
79 for( auto jtrk = std::next(itrk); jtrk != m_selectedTracks.end(); ++jtrk ) {
80
81 // avoid both tracks are too close to the beam line
82
83 const int itrk_id = itrk - m_selectedTracks.begin();
84 const int jtrk_id = jtrk - m_selectedTracks.begin();
85
86 WrkVrt wrkvrt;
87 wrkvrt.selectedTrackIndices.emplace_back( itrk_id );
88 wrkvrt.selectedTrackIndices.emplace_back( jtrk_id );
89
90 // Attempt to think the combination is incompatible by default
91 m_incomp.emplace_back( itrk_id, jtrk_id );
92
93 if(m_jp.doDisappearingTrackVertexing) {
94
95 const auto* cont_i = dynamic_cast<const xAOD::TrackParticleContainer*>( (*itrk)->container() );
96 const auto* cont_j = dynamic_cast<const xAOD::TrackParticleContainer*>( (*jtrk)->container() );
97
98 if ( !cont_i || !cont_j ) {
99 ATH_MSG_DEBUG(" one of the track containers is null");
100 continue;
101 }
102
103 ElementLink<xAOD::TrackParticleContainer> link_i, link_j;
104 link_i.toIndexedElement( *cont_i, (*itrk)->index() );
105 link_j.toIndexedElement( *cont_j, (*jtrk)->index() );
106
107 if (!link_i.isValid() || !link_j.isValid()) {
108 ATH_MSG_DEBUG(" link itrk (" << (*itrk)->index() << ") or jtrk (" << (*jtrk)->index() << ") is not valid");
109 }
110 else {
111 if( link_i.dataID() == link_j.dataID() ) {
112 continue;
113 }
114 }
115 }
116
117
118 if( std::abs( (*itrk)->d0() ) < m_jp.twoTrkVtxFormingD0Cut && std::abs( (*jtrk)->d0() ) < m_jp.twoTrkVtxFormingD0Cut ) continue;
119
120 baseTracks.clear();
121 baseTracks.emplace_back( *itrk );
122 baseTracks.emplace_back( *jtrk );
123
124 if( m_jp.FillHist ) m_hists["incompMonitor"]->Fill( kStart );
125
126 // new code to find initial approximate vertex
127 Amg::Vector3D initVertex;
128
129 std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState();
130 StatusCode sc = m_fitSvc->VKalVrtFitFast( baseTracks, initVertex, *state );/* Fast crude estimation */
131 if( sc.isFailure() ) {
132 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": fast crude estimation fails ");
133 continue;
134 }
135
136 if( initVertex.perp() > maxR ) {
137 continue;
138 }
139 if( m_jp.doDisappearingTrackVertexing && initVertex.perp() <m_jp.twoTrVrtMinRadius){
140 continue;
141 }
142 if( m_jp.FillHist ) m_hists["incompMonitor"]->Fill( kInitVtxPosition );
143
144 std::vector<double> impactParameters;
145 std::vector<double> impactParErrors;
146
147 if( !getSVImpactParameters( *itrk, initVertex, impactParameters, impactParErrors) ) continue;
148 const auto roughD0_itrk = impactParameters.at(TrkParameter::k_d0);
149 const auto roughZ0_itrk = impactParameters.at(TrkParameter::k_z0);
150 if( fabs( impactParameters.at(0)) > roughD0Cut || fabs( impactParameters.at(1) ) > roughZ0Cut ) {
151 continue;
152 }
153
154 if( !getSVImpactParameters( *jtrk, initVertex, impactParameters, impactParErrors) ) continue;
155 const auto roughD0_jtrk = impactParameters.at(TrkParameter::k_d0);
156 const auto roughZ0_jtrk = impactParameters.at(TrkParameter::k_z0);
157 if( fabs( impactParameters.at(0) ) > roughD0Cut || fabs( impactParameters.at(1) ) > roughZ0Cut ) {
158 continue;
159 }
160 if( m_jp.FillHist ) m_hists["incompMonitor"]->Fill( kImpactParamCheck );
161
162 m_fitSvc->setApproximateVertex( initVertex.x(), initVertex.y(), initVertex.z(), *state );
163
164
165
166 // Vertex VKal Fitting
167 sc = m_fitSvc->VKalVrtFit( baseTracks,
168 dummyNeutrals,
169 wrkvrt.vertex, wrkvrt.vertexMom, wrkvrt.Charge,
170 wrkvrt.vertexCov, wrkvrt.Chi2PerTrk,
171 wrkvrt.TrkAtVrt, wrkvrt.Chi2, *state );
172
173 if( sc.isFailure() ) {
174 continue; /* No fit */
175 }
176 if( m_jp.FillHist ) m_hists["incompMonitor"]->Fill( kVKalVrtFit );
177
178 // Compatibility to the primary vertex.
179 Amg::Vector3D vDist = wrkvrt.vertex - m_thePV->position();
180 const double vPos = ( vDist.x()*wrkvrt.vertexMom.Px()+vDist.y()*wrkvrt.vertexMom.Py()+vDist.z()*wrkvrt.vertexMom.Pz() )/wrkvrt.vertexMom.Rho();
181 const double vPosMomAngT = ( vDist.x()*wrkvrt.vertexMom.Px()+vDist.y()*wrkvrt.vertexMom.Py() ) / vDist.perp() / wrkvrt.vertexMom.Pt();
182 const double vPosMomAng3D = ( vDist.x()*wrkvrt.vertexMom.Px()+vDist.y()*wrkvrt.vertexMom.Py()+vDist.z()*wrkvrt.vertexMom.Pz() ) / (vDist.norm() * wrkvrt.vertexMom.Rho());
183
184 double dphi1 = TVector2::Phi_mpi_pi(vDist.phi() - (*itrk)->phi());
185 double dphi2 = TVector2::Phi_mpi_pi(vDist.phi() - (*jtrk)->phi());
186
187 const double dist_fromPV = vDist.norm();
188 if( m_jp.FillHist ) m_hists["2trkVtxDistFromPV"]->Fill( dist_fromPV );
189
190 if( m_jp.FillNtuple ) {
191 // Fill the 2-track vertex properties to AANT
192 m_ntupleVars->get<unsigned int>( "All2TrkVrtNum" )++;
193 m_ntupleVars->get< std::vector<double> >( "All2TrkVrtMass" ) .emplace_back(wrkvrt.vertexMom.M());
194 m_ntupleVars->get< std::vector<double> >( "All2TrkVrtPt" ) .emplace_back(wrkvrt.vertexMom.Perp());
195 m_ntupleVars->get< std::vector<int> > ( "All2TrkVrtCharge" ) .emplace_back(wrkvrt.Charge);
196 m_ntupleVars->get< std::vector<double> >( "All2TrkVrtX" ) .emplace_back(wrkvrt.vertex.x());
197 m_ntupleVars->get< std::vector<double> >( "All2TrkVrtY" ) .emplace_back(wrkvrt.vertex.y());
198 m_ntupleVars->get< std::vector<double> >( "All2TrkVrtZ" ) .emplace_back(wrkvrt.vertex.z());
199 m_ntupleVars->get< std::vector<double> >( "All2TrkVrtChiSq" ) .emplace_back(wrkvrt.Chi2);
200 }
201
202
203 // Create a xAOD::Vertex instance
204 xAOD::Vertex *vertex { nullptr };
205
206 if( m_jp.FillIntermediateVertices ) {
207 vertex = new xAOD::Vertex;
208 twoTrksVertexContainer->emplace_back( vertex );
209
210 for( const auto *trk: baseTracks ) {
211
212 // Acquire link to the track
213 ElementLink<xAOD::TrackParticleContainer> trackElementLink( *( dynamic_cast<const xAOD::TrackParticleContainer*>( trk->container() ) ), trk->index() );
214
215 // Register link to the vertex
216 vertex->addTrackAtVertex( trackElementLink, 1. );
217 }
218
219 vertex->setVertexType( xAOD::VxType::SecVtx );
220 vertex->setPosition( wrkvrt.vertex );
221 vertex->setFitQuality( wrkvrt.Chi2, 1 ); // Ndof is always 1
222
223 static const SG::Accessor<float> massAcc("mass");
224 static const SG::Accessor<float> pTAcc("pT");
225 static const SG::Accessor<float> chargeAcc("charge");
226 static const SG::Accessor<float> vPosAcc("vPos");
227 static const SG::Accessor<bool> isFakeAcc("isFake");
228 massAcc(*vertex) = wrkvrt.vertexMom.M();
229 pTAcc(*vertex) = wrkvrt.vertexMom.Perp();
230 chargeAcc(*vertex) = wrkvrt.Charge;
231 vPosAcc(*vertex) = vPos;
232 isFakeAcc(*vertex) = true;
233 }
234
235
237
238 uint8_t trkiBLHit,trkjBLHit;
239 if( !((*itrk)->summaryValue( trkiBLHit,xAOD::numberOfInnermostPixelLayerHits))) trkiBLHit=0;
240 if( !((*jtrk)->summaryValue( trkjBLHit,xAOD::numberOfInnermostPixelLayerHits))) trkjBLHit=0;
241
242 if( m_jp.FillNtuple ) m_ntupleVars->get< std::vector<int> >( "All2TrkSumBLHits" ).emplace_back( trkiBLHit + trkjBLHit );
243
244 // track chi2 cut
245 if( m_jp.FillHist ) m_hists["2trkChi2Dist"]->Fill( log10( wrkvrt.Chi2 ) );
246
247 if( wrkvrt.fitQuality() > m_jp.SelVrtChi2Cut) {
248 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": failed to pass chi2 threshold." );
249 continue; /* Bad Chi2 */
250 }
251 if( m_jp.FillHist ) m_hists["incompMonitor"]->Fill( kChi2 );
252
253
254 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": attempting form vertex from ( " << itrk_id << ", " << jtrk_id << " )." );
255 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": candidate vertex: "
256 << " isGood = " << (wrkvrt.isGood? "true" : "false")
257 << ", #ntrks = " << wrkvrt.nTracksTotal()
258 << ", #selectedTracks = " << wrkvrt.selectedTrackIndices.size()
259 << ", #associatedTracks = " << wrkvrt.associatedTrackIndices.size()
260 << ", chi2/ndof = " << wrkvrt.fitQuality()
261 << ", (r, z) = (" << wrkvrt.vertex.perp()
262 <<", " << wrkvrt.vertex.z() << ")" );
263
264 for( const auto* truthVertex : m_tracingTruthVertices ) {
265 Amg::Vector3D vTruth( truthVertex->x(), truthVertex->y(), truthVertex->z() );
266 Amg::Vector3D vReco ( wrkvrt.vertex.x(), wrkvrt.vertex.y(), wrkvrt.vertex.z() );
267
268 const auto distance = vReco - vTruth;
269
270 AmgSymMatrix(3) cov;
271 cov.fillSymmetric( 0, 0, wrkvrt.vertexCov.at(0) );
272 cov.fillSymmetric( 1, 0, wrkvrt.vertexCov.at(1) );
273 cov.fillSymmetric( 1, 1, wrkvrt.vertexCov.at(2) );
274 cov.fillSymmetric( 2, 0, wrkvrt.vertexCov.at(3) );
275 cov.fillSymmetric( 2, 1, wrkvrt.vertexCov.at(4) );
276 cov.fillSymmetric( 2, 2, wrkvrt.vertexCov.at(5) );
277
278 const double s2 = distance.transpose() * cov.inverse() * distance;
279
280 if( distance.norm() < 2.0 || s2 < 100. ) {
281 ATH_MSG_DEBUG ( " > " << __FUNCTION__ << ": truth-matched candidate! : signif^2 = " << s2 );
282 matchMap.emplace( truthVertex, true );
283 }
284 }
285
286 if( m_jp.FillHist ) {
287 dynamic_cast<TH2F*>( m_hists["vPosDist"] )->Fill( wrkvrt.vertex.perp(), vPos );
288 dynamic_cast<TH2F*>( m_hists["vPosMomAngTDist"] )->Fill( wrkvrt.vertex.perp(), vPosMomAngT );
289 m_hists["vPosMomAngT"] ->Fill( vPosMomAngT );
290 m_hists["vPosMomAng3D"] ->Fill( vPosMomAng3D );
291 }
292
293 if( m_jp.doTwoTrSoftBtag ){
294 if(dist_fromPV < m_jp.twoTrVrtMinDistFromPV ){
295 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass the 2tr vertex min distance from PV cut." );
296 continue;
297 }
298
299 if( vPosMomAng3D < m_jp.twoTrVrtAngleCut ){
300 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass the vertex angle cut." );
301 continue;
302 }
303 }
304
305 if( m_jp.doPVcompatibilityCut ) {
306 if( cos( dphi1 ) < -0.8 && cos( dphi2 ) < -0.8 ) {
307 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass the vPos cut. (both tracks are opposite against the vertex pos)" );
308 continue;
309 }
310 if (m_jp.doTightPVcompatibilityCut && (cos( dphi1 ) < -0.8 || cos( dphi2 ) < -0.8)){
311 ATH_MSG_DEBUG(" > "<< __FUNCTION__ << ": failed to pass the tightened vPos cut. (at least one track is opposite against the vertex pos)" );
312 continue;
313 }
314 if( vPosMomAngT < -0.8 ) {
315 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass the vPos cut. (pos-mom directions are opposite)" );
316 continue;
317 }
318 if( vPos < m_jp.pvCompatibilityCut ) {
319 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass the vPos cut." );
320 continue;
321 }
322 }
323 if( m_jp.FillHist ) m_hists["incompMonitor"]->Fill( kVposCut );
324
325 // fake rejection cuts with track hit pattern consistencies
326 if( m_jp.removeFakeVrt && !m_jp.removeFakeVrtLate ) {
327 if( !this->passedFakeReject( wrkvrt.vertex, (*itrk), (*jtrk) ) ) {
328
329 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass fake rejection algorithm." );
330 continue;
331 }
332 }
333 if( m_jp.FillHist ) m_hists["incompMonitor"]->Fill( kPatternMatch );
334
335 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": passed fake rejection." );
336
337 if( m_jp.FillNtuple ) {
338 // Fill AANT for vertices after fake rejection
339 m_ntupleVars->get< unsigned int >( "AfFakVrtNum" )++;
340 m_ntupleVars->get< std::vector<double> >( "AfFakVrtMass" ) .emplace_back(wrkvrt.vertexMom.M());
341 m_ntupleVars->get< std::vector<double> >( "AfFakVrtPt" ) .emplace_back(wrkvrt.vertexMom.Perp());
342 m_ntupleVars->get< std::vector<int> > ( "AfFakVrtCharge" ) .emplace_back(wrkvrt.Charge);
343 m_ntupleVars->get< std::vector<double> >( "AfFakVrtX" ) .emplace_back(wrkvrt.vertex.x());
344 m_ntupleVars->get< std::vector<double> >( "AfFakVrtY" ) .emplace_back(wrkvrt.vertex.y());
345 m_ntupleVars->get< std::vector<double> >( "AfFakVrtZ" ) .emplace_back(wrkvrt.vertex.z());
346 m_ntupleVars->get< std::vector<double> >( "AfFakVrtChiSq" ) .emplace_back(wrkvrt.Chi2);
347 }
348
349 // The vertex passed the quality cut: overwrite isFake to false
350 if( m_jp.FillIntermediateVertices && vertex ) {
351 static const SG::Accessor<bool> isFakeAcc("isFake");
352 isFakeAcc(*vertex) = false;
353 }
354
355
356 // Now this vertex passed all criteria and considred to be a compatible vertices.
357 // Therefore the track pair is removed from the incompatibility list.
358 m_incomp.pop_back();
359
360 wrkvrt.isGood = true;
361
362 workVerticesContainer->emplace_back( wrkvrt );
363
364 msg += Form(" (%d, %d), ", itrk_id, jtrk_id );
365
366 if( m_jp.FillHist ) {
367 m_hists["initVertexDispD0"]->Fill( roughD0_itrk, initVertex.perp() );
368 m_hists["initVertexDispD0"]->Fill( roughD0_jtrk, initVertex.perp() );
369 m_hists["initVertexDispZ0"]->Fill( roughZ0_itrk, initVertex.z() );
370 m_hists["initVertexDispZ0"]->Fill( roughZ0_jtrk, initVertex.z() );
371 }
372
373 }
374 }
375
376
377 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": compatible track pairs = " << msg );
378
379 if( m_jp.FillNtuple ) m_ntupleVars->get<unsigned int>( "SizeIncomp" ) = m_incomp.size();
380
381 if( m_jp.FillHist ) {
382 for( auto& pair: matchMap ) {
383 if( pair.second ) m_hists["nMatchedTruths"]->Fill( 1, pair.first->perp() );
384 }
385 }
386
387 return StatusCode::SUCCESS;
388 }
void fillSymmetric(size_t i, size_t j, Scalar value)
method to fill elements for a symmetric matrix
#define AmgSymMatrix(dim)
if(febId1==febId2)
bool passedFakeReject(const Amg::Vector3D &FitVertex, const xAOD::TrackParticle *itrk, const xAOD::TrackParticle *jtrk)
Flag false if the consistituent tracks are not consistent with the vertex position.
std::vector< std::pair< int, int > > m_incomp
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
@ SecVtx
Secondary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ extrapolatedPattern()

VrtSecInclusive::ExtrapolatedPattern * VKalVrtAthena::VrtSecInclusive::extrapolatedPattern ( const xAOD::TrackParticle * trk,
enum Trk::PropDirection direction )
private

Definition at line 1110 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

1110 {
1111
1112 auto* pattern = new ExtrapolatedPattern;
1113 const EventContext& ctx = Gaudi::Hive::currentContext();
1114 std::vector<std::unique_ptr<Trk::TrackParameters>> paramsVector =
1115 m_extrapolator->extrapolateBlindly(ctx, trk->perigeeParameters(), direction);
1116
1118
1119 auto nDisabled = 0;
1120
1121 for( auto& params : paramsVector ) {
1122
1123 const TVector3 position( params->position().x(), params->position().y(), params->position().z() );
1124
1125 if( prevPos == position ) {
1126 continue;
1127 }
1128
1129 prevPos = position;
1130
1131 const auto* detElement = params->associatedSurface().associatedDetectorElement();
1132
1133 if( detElement ) {
1134
1135 enum { Pixel = 1, SCT = 2 };
1136
1137 const auto& id = detElement->identify();
1138 Flag good = false;
1139
1140 if( m_atlasId->is_pixel(id) ) {
1141
1142 auto idHash = m_pixelId->wafer_hash( id );
1143 good = m_pixelCondSummaryTool->isGood( idHash, ctx );
1144
1145 pattern->emplace_back( std::make_tuple( position, Pixel, m_pixelId->barrel_ec(id), m_pixelId->layer_disk(id), good ) );
1146
1147 } else if( m_atlasId->is_sct(id) ) {
1148
1149 auto idHash = m_sctId->wafer_hash( id );
1150 good = m_sctCondSummaryTool->isGood( idHash, ctx );
1151
1152 pattern->emplace_back( std::make_tuple( position, SCT, m_sctId->barrel_ec(id), m_sctId->layer_disk(id), good ) );
1153
1154 }
1155
1156 if( !pattern->empty() ) {
1157
1158 ATH_MSG_VERBOSE(" >> " << __FUNCTION__ << ", track " << trk << ": position = (" << position.Perp() << ", " << position.z() << ", " << position.Phi() << "), detElement ID = " << id << ", good = " << good
1159 << ": (det, bec, layer) = (" << std::get<1>( pattern->back() ) << ", " << std::get<2>( pattern->back() ) << ", " << std::get<3>( pattern->back() ) << ")" );
1160
1161 if( !good ) nDisabled++;
1162 }
1163
1164 }
1165
1166 }
1167
1168 if( m_jp.FillHist ) {
1169 m_hists["disabledCount"]->Fill( nDisabled );
1170 }
1171
1172 return pattern;
1173
1174 }
@ SCT
Definition RegSelEnums.h:25
ToolHandle< IInDetConditionsTool > m_pixelCondSummaryTool
Condition service.
ToolHandle< IInDetConditionsTool > m_sctCondSummaryTool
const AtlasDetectorID * m_atlasId
std::vector< ExtrapolatedPoint > ExtrapolatedPattern
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
@ Pixel
Definition DetType.h:13

◆ fillAANT_SecondaryVertices()

StatusCode VKalVrtAthena::VrtSecInclusive::fillAANT_SecondaryVertices ( xAOD::VertexContainer * vertices)
private

Definition at line 351 of file AANT_Tools.cxx.

351 {
352
353 // Loop over vertices
354 for( xAOD::Vertex *vertex : *vertices ) {
355
356 // Track Loop
357 for(size_t itrk=0; itrk<vertex->nTrackParticles(); itrk++) {
358
359 // Here trk is not const - will augment SV perigee variables in the loop.
360 const xAOD::TrackParticle* trk = vertex->trackParticle( itrk );
361
362 //
363 // add variables for each track into ntuple
364 // Add all vertices to same ntuple, and extract later in root macro
365 //
366 m_ntupleVars->get< vector<double> >( "SecVtx_TrkPt" ) .emplace_back( trk->pt() );
367 m_ntupleVars->get< vector<double> >( "SecVtx_TrkPhi" ) .emplace_back( trk->phi() );
368 m_ntupleVars->get< vector<double> >( "SecVtx_TrkEta" ) .emplace_back( trk->eta() );
369 m_ntupleVars->get< vector<double> >( "SecVtx_Trk2dIP" ) .emplace_back( trk->d0() );
370 m_ntupleVars->get< vector<double> >( "SecVtx_TrkZIP" ) .emplace_back( trk->z0() );
371 m_ntupleVars->get< vector<double> >( "SecVtx_Trkdel2dIP" ) .emplace_back( trk->definingParametersCovMatrix()(Trk::d0, Trk::d0) );
372 m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelZIP" ) .emplace_back( trk->definingParametersCovMatrix()(Trk::z0, Trk::z0) );
373
374 track_summary trk_summary;
375 fillTrackSummary( trk_summary, trk );
376
377 m_ntupleVars->get< vector<int> >( "SecVtx_TrkBLay" ) .emplace_back( trk_summary.numIBLHits );
378 m_ntupleVars->get< vector<int> >( "SecVtx_TrkPixExclBLay" ) .emplace_back( trk_summary.numPixelHits - trk_summary.numIBLHits );
379 m_ntupleVars->get< vector<int> >( "SecVtx_TrkSCT" ) .emplace_back( trk_summary.numSctHits );
380
381 static const SG::ConstAccessor<float> pt_wrtSVAcc("pt_wrtSV");
382 static const SG::ConstAccessor<float> eta_wrtSVAcc("eta_wrtSV");
383 static const SG::ConstAccessor<float> phi_wrtSVAcc("phi_wrtSV");
384 static const SG::ConstAccessor<float> d0_wrtSVAcc("d0_wrtSV");
385 static const SG::ConstAccessor<float> z0_wrtSVAcc("z0_wrtSV");
386 static const SG::ConstAccessor<float> errP_wrtSVAcc("errP_wrtSV");
387 static const SG::ConstAccessor<float> errd0_wrtSVAcc("errd0_wrtSV");
388 static const SG::ConstAccessor<float> errz0_wrtSVAcc("errz0_wrtSV");
389 ATH_MSG_VERBOSE(" >> fillAANT_SecondaryVertices : filling track vars wrt. SV");
390 if( pt_wrtSVAcc.isAvailable(*trk) &&
391 eta_wrtSVAcc.isAvailable(*trk) &&
392 phi_wrtSVAcc.isAvailable(*trk) &&
393 d0_wrtSVAcc.isAvailable(*trk) &&
394 z0_wrtSVAcc.isAvailable(*trk) &&
395 errP_wrtSVAcc.isAvailable(*trk) &&
396 errd0_wrtSVAcc.isAvailable(*trk) &&
397 errz0_wrtSVAcc.isAvailable(*trk) ) {
398
399 m_ntupleVars->get< vector<double> >( "SecVtx_TrkPtWrtSV" ) .emplace_back( pt_wrtSVAcc(*trk) );
400 m_ntupleVars->get< vector<double> >( "SecVtx_TrkEtaWrtSV" ) .emplace_back( eta_wrtSVAcc(*trk) );
401 m_ntupleVars->get< vector<double> >( "SecVtx_TrkPhiWrtSV" ) .emplace_back( phi_wrtSVAcc(*trk) );
402 m_ntupleVars->get< vector<double> >( "SecVtx_Trk2dIPWrtSV" ) .emplace_back( d0_wrtSVAcc(*trk) );
403 m_ntupleVars->get< vector<double> >( "SecVtx_TrkZIPWrtSV" ) .emplace_back( z0_wrtSVAcc(*trk) );
404 m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelPWrtSV" ) .emplace_back( errP_wrtSVAcc(*trk) );
405 m_ntupleVars->get< vector<double> >( "SecVtx_Trkdel2dIPWrtSV" ) .emplace_back( errd0_wrtSVAcc(*trk) );
406 m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelZIPWrtSV" ) .emplace_back( errz0_wrtSVAcc(*trk) );
407
408 } else {
409
410 ATH_MSG_VERBOSE(" >> fillAANT_SecondaryVertices : filling track vars wrt. SV (invalid values)");
411
412 m_ntupleVars->get< vector<double> >( "SecVtx_TrkPtWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
413 m_ntupleVars->get< vector<double> >( "SecVtx_TrkEtaWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
414 m_ntupleVars->get< vector<double> >( "SecVtx_TrkPhiWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
415 m_ntupleVars->get< vector<double> >( "SecVtx_Trk2dIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
416 m_ntupleVars->get< vector<double> >( "SecVtx_TrkZIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
417 m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
418 m_ntupleVars->get< vector<double> >( "SecVtx_Trkdel2dIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
419 m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelZIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
420
421 }
422
423 } // loop over tracks in vertex
424
425 ATH_MSG_DEBUG(" >> fillAANT_SecondaryVertices : Track loop end. ");
426
427 ATH_MSG_VERBOSE(" >> fillAANT_SecondaryVertices : filling vertex vars");
428
429 static const SG::ConstAccessor<float> massAcc("mass");
430 static const SG::ConstAccessor<float> mass_eAcc("mass_e");
431 static const SG::ConstAccessor<float> pTAcc("pT");
432 static const SG::ConstAccessor<float> pzAcc("pz");
433 static const SG::ConstAccessor<float> vtx_chargeAcc("vtx_charge");
434 static const SG::ConstAccessor<float> sumBLayHitsAcc("sumBLayHits");
435 static const SG::ConstAccessor<float> allTrksBLayHitsAcc("allTrksBLayHits");
436 static const SG::ConstAccessor<float> minOpAngAcc("minOpAng");
437
438 m_ntupleVars->get< vector<int> >( "SecVtx_NumTrks" ) .emplace_back( vertex->nTrackParticles() );
439 m_ntupleVars->get< vector<double> >( "SecVtx_Chi2" ) .emplace_back( vertex->chiSquared() );
440 m_ntupleVars->get< vector<double> >( "SecVtxX" ) .emplace_back( vertex->x() );
441 m_ntupleVars->get< vector<double> >( "SecVtxY" ) .emplace_back( vertex->y() );
442 m_ntupleVars->get< vector<double> >( "SecVtxZ" ) .emplace_back( vertex->z() );
443 m_ntupleVars->get< vector<double> >( "SecVtx_Mass" ) .emplace_back( massAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
444 m_ntupleVars->get< vector<double> >( "SecVtx_Mass_electron" ) .emplace_back( mass_eAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
445 m_ntupleVars->get< vector<double> >( "SecVtx_pT" ) .emplace_back( pTAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
446 m_ntupleVars->get< vector<double> >( "SecVtx_pZ" ) .emplace_back( pzAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
447 m_ntupleVars->get< vector<int> >( "SecVtx_Charge" ) .emplace_back( vtx_chargeAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
448 m_ntupleVars->get< vector<int> >( "SecVtx_SumBLayHits" ) .emplace_back( sumBLayHitsAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
449 m_ntupleVars->get< vector<int> >( "SecVtx_AllTrksBLayHits" ) .emplace_back( allTrksBLayHitsAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
450 m_ntupleVars->get< vector<double> >( "SecVtx_MinOpAng" ) .emplace_back( minOpAngAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
451
452
453 } // loop over vertices
454
455 return StatusCode::SUCCESS;
456 }
static void fillTrackSummary(track_summary &summary, const xAOD::TrackParticle *trk)
retrieve the track hit information
struct VKalVrtAthena::VrtSecInclusive::track_summary_properties track_summary
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64

◆ fillAANT_SelectedBaseTracks()

StatusCode VKalVrtAthena::VrtSecInclusive::fillAANT_SelectedBaseTracks ( )
private

Definition at line 263 of file AANT_Tools.cxx.

263 {
264
265 for ( const xAOD::TrackParticle* trk : m_selectedTracks ) {
266
267 if( m_jp.FillNtuple ) {
268 uint8_t tmpT;
269 if( !(trk->summaryValue(tmpT,xAOD::numberOfPixelHits)) ) tmpT=0;
270 m_ntupleVars->get< vector<int> >( "SVTrk_PixHits" ).emplace_back( (int) tmpT);
271
272 if( !(trk->summaryValue(tmpT,xAOD::numberOfSCTHits)) ) tmpT=0;
273 m_ntupleVars->get< vector<int> >( "SVTrk_SCTHits" ).emplace_back( (int) tmpT);
274
275 if( !(trk->summaryValue(tmpT,xAOD::numberOfTRTHits)) ) tmpT=0;
276 m_ntupleVars->get< vector<int> >( "SVTrk_TRTHits" ).emplace_back( (int) tmpT);
277
278 if( !(trk->summaryValue(tmpT,xAOD::numberOfInnermostPixelLayerHits)) ) tmpT=0;
279 m_ntupleVars->get< vector<int> >( "SVTrk_BLayHits" ).emplace_back( (int) tmpT);
280 }
281
282
283 //
284 // get perigee params
285 //
286 const auto& perigee = trk->perigeeParameters();
287
288 if( m_jp.FillNtuple ) {
289
290 double phi = perigee.parameters()[Trk::phi];
291 double theta = perigee.parameters()[Trk::theta];
292 double d0 = perigee.parameters()[Trk::d0];
293 double qOverP = perigee.parameters()[Trk::qOverP];
294 double errqOverP = (*(perigee.covariance()))(Trk::qOverP,Trk::qOverP);
295 double errd0 = (*(perigee.covariance()))(Trk::d0,Trk::d0);
296 double ptrk = (1./qOverP);
297 double pT = ptrk*sin(theta);
298 double trketa = -1.*log( tan(theta/2) );
299
300 // here we have to look at the original recotrack id to establish cross-link
301 // between "SVTrk" vars and "RecoTrk" vars:
302 static const SG::ConstAccessor<unsigned long> trk_idAcc("trk_id");
303 m_ntupleVars->get< vector<int> >( "SVTrk_id" ) .emplace_back( trk_idAcc(*trk) );
304
305 m_ntupleVars->get< vector<double> >( "SVTrk_pT" ) .emplace_back(pT);
306 m_ntupleVars->get< vector<double> >( "SVTrk_p" ) .emplace_back(ptrk);
307 m_ntupleVars->get< vector<double> >( "SVTrk_phi" ) .emplace_back(phi);
308 m_ntupleVars->get< vector<double> >( "SVTrk_eta" ) .emplace_back(trketa);
309 m_ntupleVars->get< vector<double> >( "SVTrk_2dIP" ) .emplace_back(d0);
310 m_ntupleVars->get< vector<double> >( "SVTrk_ZIP" ) .emplace_back(perigee.parameters()[Trk::z0]);
311
312 double matchProb = -1;
314 if(m_jp.doTruth)
315 {
316 const xAOD::TruthParticle* aTemp_truth = getTrkGenParticle( trk );
317 if( aTemp_truth )
318 {
319 uniqueID = HepMC::uniqueID(aTemp_truth);
320 static const SG::ConstAccessor<float> truthMatchProbabilityAcc( "truthMatchProbability" );
321 matchProb= truthMatchProbabilityAcc( *trk );
322 }
323 }
324
325 m_ntupleVars->get< vector<int> >( "SVTrk_barcode" ) .emplace_back( uniqueID );
326 m_ntupleVars->get< vector<double> >( "SVTrk_matchPr" ) .emplace_back( matchProb );
327
328 ATH_MSG_DEBUG(" > fillAANT_SelectedBaseTracks: Sel Trk d0/pT/eta/match bc/pr "
329 << d0 << ","
330 << pT << ","
331 << trketa << ","
332 << uniqueID << ","
333 << matchProb );
334
335 double errp = ptrk*ptrk*errqOverP;
336
337 m_ntupleVars->get< vector<double> >( "SVTrk_delp" ) .emplace_back( errp );
338 m_ntupleVars->get< vector<double> >( "SVTrk_del2dIP" ) .emplace_back( errd0 );
339 m_ntupleVars->get< vector<double> >( "SVTrk_delzIP" ) .emplace_back( (*(perigee.covariance()))(Trk::z0,Trk::z0) );
340
341 }
342
343
344 } // end of selected tracks
345
346 return StatusCode::SUCCESS;
347 }
static const xAOD::TruthParticle * getTrkGenParticle(const xAOD::TrackParticle *)
Definition TruthAlgs.cxx:26
int uniqueID(const T &p)
constexpr int UNDEFINED_ID
@ qOverP
perigee
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75

◆ fillTrackSummary()

void VKalVrtAthena::VrtSecInclusive::fillTrackSummary ( track_summary & summary,
const xAOD::TrackParticle * trk )
staticprivate

retrieve the track hit information

Definition at line 1093 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

1093 {
1094 summary.numIBLHits = 0;
1095 summary.numBLayerHits = 0;
1096 summary.numPixelHits = 0;
1097 summary.numSctHits = 0;
1098 summary.numTrtHits = 0;
1099
1102 trk->summaryValue( summary.numPixelHits, xAOD::numberOfPixelHits );
1103 trk->summaryValue( summary.numSctHits, xAOD::numberOfSCTHits );
1104 trk->summaryValue( summary.numTrtHits, xAOD::numberOfTRTHits );
1105 }
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer

◆ finalize()

StatusCode VKalVrtAthena::VrtSecInclusive::finalize ( )
virtual

Definition at line 268 of file VrtSecInclusive.cxx.

269 {
270
271 ATH_MSG_INFO("finalize: VrtSecInclusive finalize()");
272 return StatusCode::SUCCESS;
273 }

◆ findMinVerticesNextPair()

double VKalVrtAthena::VrtSecInclusive::findMinVerticesNextPair ( std::vector< WrkVrt > * workVerticesContainer,
std::pair< unsigned, unsigned > & indexPair )
staticprivate

returns the next pair of vertices that give next-to-minimum distance significance

Definition at line 414 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

415 {
416 //
417 // Give minimal distance between nonmodifed yet vertices
418 //
419
420 indexPair.first = 0;
421 indexPair.second = 0;
422
424
425 for(unsigned iv=0; iv<workVerticesContainer->size()-1; iv++) {
426 auto& vertex = workVerticesContainer->at(iv);
427
428 if( vertex.selectedTrackIndices.size() < 2) continue; /* Bad vertex */
429 if( vertex.closestWrkVrtIndex == 0 ) continue; /* Used vertex */
430
431 if( vertex.closestWrkVrtValue < minValue ) {
432
433 unsigned jv = vertex.closestWrkVrtIndex;
434
435 // Close vertex to given [iv] one is modified already
436 if( workVerticesContainer->at(jv).closestWrkVrtIndex == 0 ) continue;
437
438 minValue = vertex.closestWrkVrtValue;
439
440 indexPair.first = iv;
441 indexPair.second = jv;
442
443 }
444 }
445
446 return minValue;
447 }
#define minValue(current, test)

◆ findMinVerticesPair()

double VKalVrtAthena::VrtSecInclusive::findMinVerticesPair ( std::vector< WrkVrt > * workVerticesContainer,
std::pair< unsigned, unsigned > & indexPair,
const AlgForVerticesPair & algorithm )
private

returns the pair of vertices that give minimum in terms of some observable (e.g.

distance, significance)

Definition at line 374 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

375 {
376 //
377 // Minimal normalized vertex-vertex distance
378 //
379
380 for( auto& workVertex : *workVerticesContainer ) {
381 workVertex.closestWrkVrtValue = AlgConsts::maxValue;
382 workVertex.closestWrkVrtIndex = 0;
383 }
384
386
387 for( auto iv = workVerticesContainer->begin(); iv != workVerticesContainer->end(); ++iv ) {
388 if( (*iv).selectedTrackIndices.size()< 2) continue; /* Bad vertices */
389
390 auto i_index = iv - workVerticesContainer->begin();
391
392 for( auto jv = std::next(iv); jv != workVerticesContainer->end(); ++jv ) {
393 if( (*jv).selectedTrackIndices.size()< 2) continue; /* Bad vertices */
394
395 auto j_index = iv - workVerticesContainer->begin();
396
397 double value = (this->*algorithm)( (*iv), (*jv) );
398
399 if( value < minValue ){
400 minValue = value;
401 indexPair.first = i_index;
402 indexPair.second = j_index;
403 }
404 if( value < (*iv).closestWrkVrtValue ) {(*iv).closestWrkVrtValue = value; (*iv).closestWrkVrtIndex = j_index; }
405 if( value < (*jv).closestWrkVrtValue ) {(*jv).closestWrkVrtValue = value; (*jv).closestWrkVrtIndex = i_index; }
406 }
407 }
408
409 return minValue;
410 }
std::string algorithm
Definition hcg.cxx:85

◆ findNtrackVertices()

StatusCode VKalVrtAthena::VrtSecInclusive::findNtrackVertices ( std::vector< WrkVrt > * workVerticesContainer)
private

Definition at line 392 of file VertexingAlgs.cxx.

393 {
394 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": begin");
395 if(m_jp.doDisappearingTrackVertexing){
396 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": skip");
397 return StatusCode::SUCCESS;
398 }
399
400
401 const auto compSize = m_selectedTracks.size()*(m_selectedTracks.size() - 1)/2 - m_incomp.size();
402 if( m_jp.FillHist ) { m_hists["2trkVerticesDist"]->Fill( compSize ); }
403
404 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": compatible track pair size = " << compSize );
405 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": incompatible track pair size = " << m_incomp.size() );
406
407
408 if( not m_jp.doFastMode ) {
409
410 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": incompatibility graph finder mode" );
411
412 // clear the container
413 workVerticesContainer->clear();
414
415 // Graph method: Trk::pgraphm_()
416 // used in order to find compatible sub-graphs from the incompatible graph
417
418 // List of edgeds between imcompatible nodes
419 // This weit is the data model of imcompatible graph used in Trk::pgraphm_().
420 std::vector<long int> weit;
421
422 for( auto& pair : m_incomp ) {
423 weit.emplace_back( pair.first + 1 ); /* +1 is needed for PGRAPH due to FORTRAN-style counting */
424 weit.emplace_back( pair.second + 1 ); /* +1 is needed for PGRAPH due to FORTRAN-style counting */
425 }
426
427 // Solution of the graph method routine (minimal covering of the graph)
428 // The size of the solution is returned by NPTR (see below)
429 std::vector<long int> solution( m_selectedTracks.size() );
430
431 // Number of edges in the list is the size of incompatibility track pairs.
432 long int nEdges = m_incomp.size();
433
434 // input number of nodes in the graph.
435 long int nTracks = static_cast<long int>( m_selectedTracks.size() );
436
437 // Input variable; the threshold. Solutions shorter than nth are not returned (ignored).
438 long int nth = 2; //VK some speed up
439
440 // NPTR: I/O variable (Destructive FORTRAN Style!!!)
441 // - on input: =0 for initialization, >0 to get next solution
442 // - on output: >0 : length of the solution stored in set; =0 : no more solutions can be found
443 long int solutionSize { 0 };
444
445 // This is just a unused strawman needed for m_fitSvc->VKalVrtFit()
446 std::vector<const xAOD::TrackParticle*> baseTracks;
447 std::vector<const xAOD::NeutralParticle*> dummyNeutrals;
448
449 std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState();
450 auto pgraph = std::make_unique<Trk::PGraph>();
451 int iterationLimit(2000);
452 // Main iteration
453 while(true) {
454
455 // Find a solution from the given set of incompatible tracks (==weit)
456 pgraph->pgraphm_( weit.data(), nEdges, nTracks, solution.data(), &solutionSize, nth);
457
458 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": Trk::pgraphm_() output: solutionSize = " << solutionSize );
459 if (0 == iterationLimit--){
460 ATH_MSG_WARNING("Iteration limit (2000) reached in VrtSecInclusive::findNtrackVertices, solution size = "<<solutionSize);
461 break;
462 }
463 if(solutionSize <= 0) break; // No more solutions ==> Exit
464 if(solutionSize == 1) continue; // i.e. single node ==> Not a good solution
465
466 baseTracks.clear();
467
468 std::string msg = "solution = [ ";
469 for( int i=0; i< solutionSize; i++) {
470 msg += Form( "%ld, ", solution[i]-1 );
471 }
472 msg += " ]";
473 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": " << msg );
474
475 // varaible of new vertex
476 WrkVrt wrkvrt;
477
478 // Try to compose a new vertex using the solution nodes
479 // Here the track ID is labelled with array
480 wrkvrt.isGood = true;
481 wrkvrt.selectedTrackIndices.clear();
482
483 for(long int i = 0; i<solutionSize; i++) {
484 wrkvrt.selectedTrackIndices.emplace_back(solution[i]-1);
485 baseTracks.emplace_back( m_selectedTracks.at(solution[i]-1) );
486 }
487
488 // Perform vertex fitting
489 Amg::Vector3D initVertex;
490
491 StatusCode sc = m_fitSvc->VKalVrtFitFast( baseTracks, initVertex, *state );/* Fast crude estimation */
492 if(sc.isFailure()) ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": fast crude estimation fails ");
493
494 m_fitSvc->setApproximateVertex( initVertex.x(), initVertex.y(), initVertex.z(), *state );
495
496 sc = m_fitSvc->VKalVrtFit(baseTracks, dummyNeutrals,
497 wrkvrt.vertex,
498 wrkvrt.vertexMom,
499 wrkvrt.Charge,
500 wrkvrt.vertexCov,
501 wrkvrt.Chi2PerTrk,
502 wrkvrt.TrkAtVrt,
503 wrkvrt.Chi2,
504 *state);
505
506 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": FoundAppVrt=" << solutionSize << ", (r, z) = " << wrkvrt.vertex.perp() << ", " << wrkvrt.vertex.z() << ", chi2/ndof = " << wrkvrt.fitQuality() );
507
508 if( sc.isFailure() ) {
509
510 if( wrkvrt.selectedTrackIndices.size() <= 2 ) {
511 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": VKalVrtFit failed in 2-trk solution ==> give up.");
512 continue;
513 }
514
515 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": VKalVrtFit failed ==> retry...");
516
517 WrkVrt tmp;
518 tmp.isGood = false;
519
520 // Create 2-trk vertex combination and find any compatible vertex
521 for( auto& itrk: wrkvrt.selectedTrackIndices ) {
522 for( auto& jtrk: wrkvrt.selectedTrackIndices ) {
523 if( itrk == jtrk ) continue;
524 if( tmp.isGood ) continue;
525
526 tmp.selectedTrackIndices.clear();
527 tmp.selectedTrackIndices.emplace_back( itrk );
528 tmp.selectedTrackIndices.emplace_back( jtrk );
529
530 baseTracks.clear();
531 baseTracks.emplace_back( m_selectedTracks.at( itrk ) );
532 baseTracks.emplace_back( m_selectedTracks.at( jtrk ) );
533
534 // Perform vertex fitting
535 Amg::Vector3D initVertex;
536
537 sc = m_fitSvc->VKalVrtFitFast( baseTracks, initVertex, *state );
538 if( sc.isFailure() ) ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": fast crude estimation fails ");
539
540 m_fitSvc->setApproximateVertex( initVertex.x(), initVertex.y(), initVertex.z(), *state );
541
542 sc = m_fitSvc->VKalVrtFit(baseTracks, dummyNeutrals,
543 tmp.vertex,
544 tmp.vertexMom,
545 tmp.Charge,
546 tmp.vertexCov,
547 tmp.Chi2PerTrk,
548 tmp.TrkAtVrt,
549 tmp.Chi2,
550 *state);
551
552 if( sc.isFailure() ) continue;
553
554 tmp.isGood = true;
555
556 }
557 }
558
559 if( !tmp.isGood ) {
560 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Did not find any viable vertex in all 2-trk combinations. Give up.");
561 continue;
562 }
563
564 // Now, found at least one seed 2-track vertex. ==> attempt to attach other tracks
565 for( auto& itrk: wrkvrt.selectedTrackIndices ) {
566
567 if( std::find( tmp.selectedTrackIndices.begin(), tmp.selectedTrackIndices.end(), itrk ) != tmp.selectedTrackIndices.end() ) continue;
568
569 auto backup = tmp;
570
571 tmp.selectedTrackIndices.emplace_back( itrk );
572 baseTracks.clear();
573 for( auto& jtrk : tmp.selectedTrackIndices ) { baseTracks.emplace_back( m_selectedTracks.at(jtrk) ); }
574
575 // Perform vertex fitting
576 Amg::Vector3D initVertex;
577
578 sc = m_fitSvc->VKalVrtFitFast( baseTracks, initVertex, *state );/* Fast crude estimation */
579 if(sc.isFailure()) ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": fast crude estimation fails ");
580
581 m_fitSvc->setApproximateVertex( initVertex.x(), initVertex.y(), initVertex.z(), *state );
582
583 sc = m_fitSvc->VKalVrtFit(baseTracks, dummyNeutrals,
584 tmp.vertex,
585 tmp.vertexMom,
586 tmp.Charge,
587 tmp.vertexCov,
588 tmp.Chi2PerTrk,
589 tmp.TrkAtVrt,
590 tmp.Chi2,
591 *state);
592
593 if( sc.isFailure() ) {
594 tmp = backup;
595 continue;
596 }
597
598 }
599
600 wrkvrt = tmp;
601 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": VKalVrtFit succeeded; register the vertex to the list.");
602 wrkvrt.isGood = true;
603 wrkvrt.closestWrkVrtIndex = AlgConsts::invalidUnsigned;
604 wrkvrt.closestWrkVrtValue = AlgConsts::maxValue;
605 workVerticesContainer->emplace_back( wrkvrt );
606
607 } else {
608
609 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": VKalVrtFit succeeded; register the vertex to the list.");
610 wrkvrt.isGood = true;
611 wrkvrt.closestWrkVrtIndex = AlgConsts::invalidUnsigned;
612 wrkvrt.closestWrkVrtValue = AlgConsts::maxValue;
613 workVerticesContainer->emplace_back( wrkvrt );
614
615 }
616
617 }
618
619
620 } else {
621
622 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": rapid finder mode" );
623
624 struct Cluster {
625 Amg::Vector3D position;
626 std::set<long int> tracks;
627 };
628
629 std::vector<struct Cluster> clusters;
630
631 for( auto& wrkvrt : *workVerticesContainer ) {
632
633 bool foundCluster = false;
634
635 for( auto& cluster: clusters ) {
636 if( (wrkvrt.vertex - cluster.position).norm() < 1.0 ) {
637 for( auto& itrk : wrkvrt.selectedTrackIndices ) {
638 cluster.tracks.insert( itrk );
639 }
640 foundCluster = true;
641 break;
642 }
643 }
644
645 if( !foundCluster ) {
646 Cluster c;
647 c.position = wrkvrt.vertex;
648 for( auto& itrk : wrkvrt.selectedTrackIndices ) {
649 c.tracks.insert( itrk );
650 }
651 clusters.emplace_back( c );
652 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": added a new cluster" );
653 }
654
655 }
656
657 // This is just a unused strawman needed for m_fitSvc->VKalVrtFit()
658 std::vector<const xAOD::TrackParticle*> baseTracks;
659 std::vector<const xAOD::NeutralParticle*> dummyNeutrals;
660
661 workVerticesContainer->clear();
662
663 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": found cluster size =" << clusters.size() );
664
665 std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState();
666 for( auto& cluster : clusters ) {
667
668 // varaible of new vertex
669 WrkVrt wrkvrt;
670
671 // Try to compose a new vertex using the solution nodes
672 // Here the track ID is labelled with array
673 wrkvrt.isGood = true;
674 wrkvrt.selectedTrackIndices.clear();
675
676 for(const auto& index: cluster.tracks) {
677 wrkvrt.selectedTrackIndices.emplace_back( index );
678 baseTracks.emplace_back( m_selectedTracks.at( index ) );
679 }
680
681 // Perform vertex fitting
682 Amg::Vector3D initVertex;
683
684 StatusCode sc = m_fitSvc->VKalVrtFitFast( baseTracks, initVertex, *state );/* Fast crude estimation */
685 if(sc.isFailure()) ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": fast crude estimation fails ");
686
687 m_fitSvc->setApproximateVertex( initVertex.x(), initVertex.y(), initVertex.z(), *state );
688
689 sc = m_fitSvc->VKalVrtFit(baseTracks, dummyNeutrals,
690 wrkvrt.vertex,
691 wrkvrt.vertexMom,
692 wrkvrt.Charge,
693 wrkvrt.vertexCov,
694 wrkvrt.Chi2PerTrk,
695 wrkvrt.TrkAtVrt,
696 wrkvrt.Chi2,
697 *state);
698
699 if( sc.isFailure() ) {
700 continue;
701 }
702
703 workVerticesContainer->emplace_back( wrkvrt );
704 }
705
706 }
707
708 if (m_jp.truncateWrkVertices){
709 if (workVerticesContainer->size() > m_jp.maxWrkVertices){
711 workVerticesContainer->resize(m_jp.maxWrkVertices);
712 }
713 }
714
715 //-------------------------------------------------------
716 // Iterative cleanup algorithm
717
718 //-Remove vertices fully contained in other vertices
719 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": Remove vertices fully contained in other vertices .");
720 while( workVerticesContainer->size() > 1 ) {
721 size_t tmpN = workVerticesContainer->size();
722
723 size_t iv = 0;
724 for(; iv<tmpN-1; iv++) {
725 size_t jv = iv+1;
726 for(; jv<tmpN; jv++) {
727 const auto nTCom = nTrkCommon( workVerticesContainer, {iv, jv} );
728
729 if( nTCom == workVerticesContainer->at(iv).selectedTrackIndices.size() ) { workVerticesContainer->erase(workVerticesContainer->begin()+iv); break; }
730 else if( nTCom == workVerticesContainer->at(jv).selectedTrackIndices.size() ) { workVerticesContainer->erase(workVerticesContainer->begin()+jv); break; }
731
732 }
733 if(jv!=tmpN) break; // One vertex is erased. Restart check
734 }
735 if(iv==tmpN-1) break; // No vertex deleted
736 }
737
738 //-Identify remaining 2-track vertices with very bad Chi2 and mass (b-tagging)
739 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": Identify remaining 2-track vertices with very bad Chi2 and mass (b-tagging).");
740 for( auto& wrkvrt : *workVerticesContainer ) {
741
742 if( TMath::Prob( wrkvrt.Chi2, wrkvrt.ndof() ) < m_jp.improveChi2ProbThreshold ) wrkvrt.isGood = false;
743 if( wrkvrt.selectedTrackIndices.size() != 2 ) continue;
744 if( m_jp.FillHist ) m_hists["NtrkChi2Dist"]->Fill( log10( wrkvrt.fitQuality() ) );
745 }
746
747 if( m_jp.FillNtuple) m_ntupleVars->get<unsigned int>( "NumInitSecVrt" ) = workVerticesContainer->size();
748
749 return StatusCode::SUCCESS;
750 }
static size_t nTrkCommon(std::vector< WrkVrt > *WrkVrtSet, const std::pair< unsigned, unsigned > &pairIndex)
returns the number of tracks commonly present in both vertices

◆ findWorstChi2ofMaximallySharedTrack()

double VKalVrtAthena::VrtSecInclusive::findWorstChi2ofMaximallySharedTrack ( std::vector< WrkVrt > * workVerticesContainer,
std::map< long int, std::vector< long int > > & trackToVertexMap,
long int & maxSharedTrack,
long int & worstMatchingVertex )
private

Definition at line 946 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

950 {
951
952 double worstChi2 = AlgConsts::invalidFloat;
953
954 // Find the track index that has the largest shared vertices
955 auto maxSharedTrackToVertices = std::max_element( trackToVertexMap.begin(), trackToVertexMap.end(), []( auto& p1, auto& p2 ) { return p1.second.size() < p2.second.size(); } );
956
957 if( maxSharedTrackToVertices == trackToVertexMap.end() ) return worstChi2;
958
959 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": max-shared track index = " << maxSharedTrackToVertices->first << ", number of shared vertices = " << maxSharedTrackToVertices->second.size() );
960
961 if( maxSharedTrackToVertices->second.size() < 2 ) return worstChi2;
962
963 // map of vertex index and the chi2 of the track for the maxSharedTrack
964 std::map<long int, double> vrtChi2Map;
965
966 // loop over vertices for the largest shared track
967 for( auto& iv : maxSharedTrackToVertices->second ) {
968 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": loop over vertices: vertex index " << iv );
969
970 auto& wrkvrt = workVerticesContainer->at( iv );
971 auto& trackIndices = wrkvrt.selectedTrackIndices;
972
973 // find the index of the track
974 auto index = std::find_if( trackIndices.begin(), trackIndices.end(), [&]( auto& index ) { return index == maxSharedTrackToVertices->first; } );
975 if( index == trackIndices.end() ) {
976 ATH_MSG_WARNING(" >> " << __FUNCTION__ << ": index not found (algorithm inconsistent)" );
977 return worstChi2;
978 }
979
980 auto& chi2 = wrkvrt.Chi2PerTrk.at( index - trackIndices.begin() );
981
982 vrtChi2Map.emplace( std::pair<long int, double>(iv, chi2) );
983 }
984
985 auto worstVrtChi2Pair = std::max_element( vrtChi2Map.begin(), vrtChi2Map.end(), []( auto& p1, auto& p2 ) { return p1.second < p2.second; } );
986
987 if( worstVrtChi2Pair == vrtChi2Map.end() ) {
988 ATH_MSG_WARNING(" >> " << __FUNCTION__ << ": max_element of vrtChi2Map not found" );
989 return worstChi2;
990 }
991
992 maxSharedTrack = maxSharedTrackToVertices->first;
993 worstMatchingVertex = worstVrtChi2Pair->first;
994 worstChi2 = worstVrtChi2Pair->second;
995
996 return worstChi2;
997 }
double chi2(TH1 *h0, TH1 *h1)
str index
Definition DeMoScan.py:362

◆ getIntersection() [1/2]

template<class Track>
void VKalVrtAthena::VrtSecInclusive::getIntersection ( Track * trk,
std::vector< IntersectionPos * > & layers,
const Trk::Perigee * per )
private

◆ getIntersection() [2/2]

template<class TrackT>
void VKalVrtAthena::VrtSecInclusive::getIntersection ( TrackT * trk,
vector< IntersectionPos * > & layers,
const Trk::Perigee * per )

Definition at line 18 of file Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/details/Utilities.h.

18 {
19 //
20 // get intersection point of track with various surfaces
21 //
22
23 //--------------------
24 // main loop
25 for( auto *layer : layers ) {
26
27 ATH_MSG_VERBOSE( " >> getIntersection(): attempt to loop " << layer->name() );
28 setIntersection( trk, layer, per );
29
30 }
31
32
33 ATH_MSG_VERBOSE( " >> getIntersection(): End of getIntersection" );
34 }
void setIntersection(Track *trk, IntersectionPos *bec, const Trk::Perigee *per)

◆ getSVImpactParameters()

bool VKalVrtAthena::VrtSecInclusive::getSVImpactParameters ( const xAOD::TrackParticle * trk,
const Amg::Vector3D & vertex,
std::vector< double > & impactParameters,
std::vector< double > & impactParErrors )
private

get secondary vertex impact parameters

Definition at line 2317 of file VertexingAlgs.cxx.

2319 {
2320
2321 impactParameters.clear();
2322 impactParErrors.clear();
2323
2324 if( m_jp.trkExtrapolator==1 ){
2325 m_fitSvc->VKalGetImpact(trk, vertex, static_cast<int>( trk->charge() ), impactParameters, impactParErrors);
2326 }
2327 else if( m_jp.trkExtrapolator==2 ){
2328 auto sv_perigee = m_trackToVertexTool->perigeeAtVertex(Gaudi::Hive::currentContext(), *trk, vertex );
2329 if( !sv_perigee ) return false;
2330 impactParameters.push_back(sv_perigee->parameters() [Trk::d0]);
2331 impactParameters.push_back(sv_perigee->parameters() [Trk::z0]);
2332 impactParErrors.push_back((*sv_perigee->covariance())( Trk::d0, Trk::d0 ));
2333 impactParErrors.push_back((*sv_perigee->covariance())( Trk::z0, Trk::z0 ));
2334 }
2335 else{
2336 ATH_MSG_WARNING( " > " << __FUNCTION__ << ": Unknown track extrapolator " << m_jp.trkExtrapolator );
2337 return false;
2338 }
2339
2340 return true;
2341
2342 } // getSVImpactParameters
float charge() const
Returns the charge.

◆ getTrkGenParticle()

const xAOD::TruthParticle * VKalVrtAthena::VrtSecInclusive::getTrkGenParticle ( const xAOD::TrackParticle * trkPart)
staticprivate

Definition at line 26 of file TruthAlgs.cxx.

27 {
28 typedef ElementLink< xAOD::TruthParticleContainer > Link_t;
29 constexpr const char* NAME = "truthParticleLink";
30 static const SG::ConstAccessor< Link_t > acc (NAME);
31 if( ! acc.isAvailable( *trkPart ) ) {
32 return nullptr;
33 }
34 const Link_t& link = acc( *trkPart );
35 if( ! link.isValid() ) {
36 return nullptr;
37 }
38 return *link;
39 }

◆ improveVertexChi2()

double VKalVrtAthena::VrtSecInclusive::improveVertexChi2 ( WrkVrt & vertex)
private

attempt to improve the vertex chi2 by removing the most-outlier track one by one until the vertex chi2 satisfies a certain condition.

Definition at line 265 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

266 {
267 //
268 // Iterate track removal until vertex get good Chi2
269 //
270
271 auto fitQuality_begin = vertex.fitQuality();
272
273 auto removeCounter = 0;
274
275 if( vertex.nTracksTotal() <= 2 ) return 0.;
276
277 {
278 WrkVrt backup = vertex;
279 StatusCode sc = refitVertexWithSuggestion( vertex, vertex.vertex );
280 if( sc.isFailure() ) {
281 vertex = backup;
282 return 0;
283 }
284 }
285
286 double chi2Probability = TMath::Prob( vertex.Chi2, vertex.ndof() );
287
288 while (chi2Probability < m_jp.improveChi2ProbThreshold ) {
289 if( vertex.nTracksTotal() == 2 ) return chi2Probability;
290
291 WrkVrt vertex_backup = vertex;
292
293 auto maxChi2 = std::max_element( vertex.Chi2PerTrk.begin(), vertex.Chi2PerTrk.end() );
294 size_t index = maxChi2 - vertex.Chi2PerTrk.begin();
295
296
297 ATH_MSG_DEBUG( " >>> " << __FUNCTION__ << ": worst chi2 trk index = " << index << ", #trks = " << vertex.Chi2PerTrk.size() );
298
299 if( index < vertex.selectedTrackIndices.size() ) {
300 vertex.selectedTrackIndices.erase( vertex.selectedTrackIndices.begin() + index ); //remove track
301 removeCounter++;
302 } else {
303 index -= vertex.selectedTrackIndices.size();
304 if( index >= vertex.associatedTrackIndices.size() ) {
305 ATH_MSG_WARNING( " >>> " << __FUNCTION__ << ": invalid index" );
306 break;
307 }
308 vertex.associatedTrackIndices.erase( vertex.associatedTrackIndices.begin() + index ); //remove track
309 removeCounter++;
310 }
311
312 StatusCode sc = refitVertexWithSuggestion( vertex, vertex.vertex );
313
314 if( sc.isFailure() || vertex_backup.fitQuality() < vertex.fitQuality() ) {
315 vertex = vertex_backup;
316 chi2Probability = 0;
317 break;
318 }
319
320 chi2Probability = TMath::Prob( vertex.Chi2, vertex.ndof() );
321 }
322
323 auto fitQuality_end = vertex.fitQuality();
324
325 if( 0 == removeCounter ) {
326 ATH_MSG_DEBUG( " >>> " << __FUNCTION__ << ": no improvement was found." );
327 } else {
328 ATH_MSG_DEBUG( " >>> " << __FUNCTION__ << ": Removed " << removeCounter << " tracks; Fit quality improvement: " << fitQuality_begin << " ==> " << fitQuality_end );
329 }
330
331 return chi2Probability;
332 }
StatusCode refitVertexWithSuggestion(WrkVrt &, const Amg::Vector3D &)
refit the vertex with suggestion

◆ initEvent()

StatusCode VKalVrtAthena::VrtSecInclusive::initEvent ( )
virtual

Definition at line 276 of file VrtSecInclusive.cxx.

277 {
278
279 ATH_MSG_DEBUG("initEvent: begin");
280
281 // Clear all variables to be stored to the AANT
282 if( m_jp.FillNtuple ) {
284 }
285
286
287 ATH_MSG_DEBUG("initEvent: from initEvent ");
288 return StatusCode::SUCCESS;
289
290 }

◆ initialize()

StatusCode VKalVrtAthena::VrtSecInclusive::initialize ( )
virtual

Definition at line 84 of file VrtSecInclusive.cxx.

85 {
86 ATH_MSG_INFO("initialize: begin");
87 //
88 // first instantiate tools
89
90 // VKalVrt vertex fitter
91 if (m_fitSvc.retrieve().isFailure()) {
92 ATH_MSG_ERROR("initialize: Can't find Trk::TrkVKalVrtFitter");
93 return StatusCode::SUCCESS;
94 } else {
95 ATH_MSG_INFO("initialize: Trk::TrkVKalVrtFitter found");
96 }
97
98 //
99 // retreive tool to get trackParameters of generated Particles
100 if(m_truthToTrack.retrieve().isFailure()) {
101 ATH_MSG_INFO("initialize: Cannot retrieve Trk::TruthToTrack Tool!");
102 return StatusCode::FAILURE;
103 }
104 else {
105 ATH_MSG_INFO("initialize: Retrieved Trk::TruthToTrack Tool" << m_truthToTrack);
106
107 }
108 // extract TrackToVertex extrapolator tool
109 if ( m_trackToVertexTool.retrieve().isFailure() ) {
110 ATH_MSG_ERROR("initialize: failed to retrieve trackToVertex tool ");
111 return StatusCode::SUCCESS;
112 }
113 else {
114 ATH_MSG_INFO("initialize: Retrieved Reco::TrackToVertex Tool" << m_trackToVertexTool);
115 }
116 // extract TrackToVertexIPEstimator extrapolator tool
117 if ( m_trackToVertexIPEstimatorTool.retrieve().isFailure() ) {
118 ATH_MSG_ERROR("initialize: failed to retrieve trackToVertexIPEstimator tool ");
119 return StatusCode::SUCCESS;
120 }
121 else {
122 ATH_MSG_INFO("initialize: Retrieved Trk::TrackToVertexIPEstimator Tool" << m_trackToVertexIPEstimatorTool);
123 }
124
125 if( detStore()->retrieve(m_atlasId, "AtlasID").isFailure() ) return StatusCode::FAILURE;
126 if( detStore()->retrieve(m_pixelId, "PixelID").isFailure() ) return StatusCode::FAILURE;
127 if( detStore()->retrieve(m_sctId, "SCT_ID") .isFailure() ) return StatusCode::FAILURE;
128
129 if ( m_pixelCondSummaryTool.retrieve().isFailure() ) {
130 ATH_MSG_ERROR("initialize: failed to retrieve PixelConditionsSummaryTool");
131 return StatusCode::SUCCESS;
132 }
133 else {
134 ATH_MSG_INFO("initialize: Retrieved PixelConditionsSummaryTool" << m_pixelCondSummaryTool);
135 }
136 if ( m_sctCondSummaryTool.retrieve().isFailure() ) {
137 ATH_MSG_ERROR("initialize: failed to retrieve SCTConditionsSummaryTool");
138 return StatusCode::SUCCESS;
139 }
140 else {
141 ATH_MSG_INFO("initialize: Retrieved SCTConditionsSummaryTool" << m_sctCondSummaryTool);
142 }
143
144 ATH_CHECK( m_extrapolator.retrieve() );
145
146 // extract VertexMapper
147 if( m_jp.doMapToLocal ) {
148 ATH_CHECK( m_vertexMapper.retrieve() );
149 }
150
151 // Track selection algorithm configuration
152 if( m_jp.doSelectTracksFromMuons ) { m_trackSelectionAlgs.emplace_back( &VrtSecInclusive::selectTracksFromMuons ); }
153 if( m_jp.doSelectTracksFromElectrons ) { m_trackSelectionAlgs.emplace_back( &VrtSecInclusive::selectTracksFromElectrons ); }
154 if( m_jp.doSelectIDAndGSFTracks ) { m_trackSelectionAlgs.emplace_back( &VrtSecInclusive::selectInDetAndGSFTracks ); }
155
156 // if none of the above two flags are activated, use ID tracks (default)
157 if( !m_jp.doSelectTracksFromMuons && !m_jp.doSelectTracksFromElectrons && !m_jp.doSelectIDAndGSFTracks) {
158
160
161 }
162
163
164 // Vertexing algorithm configuration
165 m_vertexingAlgorithms.emplace_back( "extractIncompatibleTrackPairs", &VrtSecInclusive::extractIncompatibleTrackPairs );
166 m_vertexingAlgorithms.emplace_back( "findNtrackVertices", &VrtSecInclusive::findNtrackVertices );
167 m_vertexingAlgorithms.emplace_back( "rearrangeTracks", &VrtSecInclusive::rearrangeTracks );
168
169 if( m_jp.doReassembleVertices ) {
170 m_vertexingAlgorithms.emplace_back( "reassembleVertices", &VrtSecInclusive::reassembleVertices );
171 }
172
173 if( m_jp.doMergeByShuffling ) {
174 m_vertexingAlgorithms.emplace_back( "mergeByShuffling", &VrtSecInclusive::mergeByShuffling );
175 }
176
177 if ( m_jp.doMergeFinalVerticesDistance ) {
178 m_vertexingAlgorithms.emplace_back( "mergeFinalVertices", &VrtSecInclusive::mergeFinalVertices );
179 }
180
181 if( m_jp.doAssociateNonSelectedTracks ) {
182 m_vertexingAlgorithms.emplace_back( "associateNonSelectedTracks", &VrtSecInclusive::associateNonSelectedTracks );
183 }
184
186
187
188 // now make histograms/ntuples
189
190 ServiceHandle<ITHistSvc> hist_root("THistSvc", name());
191 ATH_CHECK( hist_root.retrieve() );
192
193 if( m_jp.FillHist ) {
194
195 std::vector<double> rbins = { 0.1, 0.3, 0.5, 1, 2, 3, 5, 7, 10, 14, 20, 28, 38, 50, 64, 80, 100, 130, 170, 220, 280, 350, 450, 600 };
196 std::vector<double> nbins = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 20, 24, 28, 38, 50, 70, 100, 150 };
197
198 const size_t& nAlgs = m_vertexingAlgorithms.size();
199
200 ATH_MSG_INFO("initialize: Filling Histograms");
201 //
202 m_hists["trkSelCuts"] = new TH1F("trkSelCuts", ";Cut Order;Tracks", 10, -0.5, 10-0.5 );
203 m_hists["selTracksDist"] = new TH1F("selTracksDist", ";Selected Tracks;Events", 2000, -0.5, 2000-0.5 );
204 m_hists["initVertexDispD0"] = new TH2F("initVertexDispD0", ";Rough d0 wrt init [mm];r [mm];Vertices", 1000, -100, 100, rbins.size()-1, &(rbins[0]) );
205 m_hists["initVertexDispZ0"] = new TH2F("initVertexDispZ0", ";Rough z0 wrt init [mm];z [mm];Vertices", 1000, -100, 100, 100, -1000, 1000 );
206 m_hists["incompMonitor"] = new TH1F("incompMonitor", ";Setp;Track Pairs", 10, -0.5, 10-0.5 );
207 m_hists["2trkVerticesDist"] = new TH1F("2trkVerticesDist", ";2-track Vertices;Events", 1000, -0.5, 1000-0.5 );
208 m_hists["2trkChi2Dist"] = new TH1F("2trkChi2Dist", ";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
209 m_hists["NtrkChi2Dist"] = new TH1F("NtrkChi2Dist", ";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
210 m_hists["vPosDist"] = new TH2F("vPosDist", ";r;#vec{x}*#vec{p}/p_{T} [mm]", rbins.size()-1, &(rbins[0]), 200, -1000, 1000 );
211 m_hists["vPosMomAngTDist"] = new TH2F("vPosMomAngDistT", ";r;cos(#vec{r},#vec{p}_{T})", rbins.size()-1, &(rbins[0]), 200, -1.0, 1.0 );
212 m_hists["disabledCount"] = new TH1F("disabledCount", ";N_{modules};Tracks", 20, -0.5, 10-0.5 );
213 m_hists["vertexYield"] = new TH1F("vertexYield", ";Algorithm Step;Vertices", nAlgs, -0.5, nAlgs-0.5 );
214 m_hists["vertexYieldNtrk"] = new TH2F("vertexYieldNtrk", ";Ntrk;Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
215 m_hists["vertexYieldChi2"] = new TH2F("vertexYieldChi2", ";#chi^{2}/N_{dof};Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
216 m_hists["mergeType"] = new TH1F("mergeType", ";Merge Algorithm Type;Entries", 10, -0.5, 10-0.5 );
217 m_hists["associateMonitor"] = new TH1F("associateMonitor", ";Step;Vertices", 10, -0.5, 10-0.5 );
218 m_hists["shuffleMinSignif1"] = new TH1F("shuffleMinSignif1", ";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
219 m_hists["shuffleMinSignif2"] = new TH1F("shuffleMinSignif2", ";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
220 m_hists["shuffleMinSignif3"] = new TH1F("shuffleMinSignif3", ";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
221 m_hists["finalCutMonitor"] = new TH1F("finalCutMonitor", ";Step;Vertices", 6, -0.5, 6-0.5 );
222 m_hists["finalVtxNtrk"] = new TH1F("finalVtxNtrk", ";N_{trk};Vertices", nbins.size()-1, &(nbins[0]) );
223 m_hists["finalVtxR"] = new TH1F("finalVtxR", ";r [mm];Vertices", 600, 0, 600 );
224 m_hists["finalVtxNtrkR"] = new TH2F("finalVtxNtrkR", ";N_{trk};r [mm];Vertices", nbins.size()-1, &(nbins[0]), rbins.size()-1, &(rbins[0]) );
225 m_hists["CPUTime"] = new TH1F("CPUTime", ";Step;Accum. CPU Time [s]", 10, -0.5, 10-0.5 );
226 m_hists["nMatchedTruths"] = new TH2F("nMatchedTruths", ";Step;;r [mm];Matched truth vertices", 11, -0.5, 11-0.5, rbins.size()-1, &(rbins[0]) );
227 m_hists["vPosMomAngT"] = new TH1F("vPosMomAngT", ";cos(#vec{r},#vec{p}_{T}", 200, -1.0, 1.0 );
228 m_hists["vPosMomAng3D"] = new TH1F("vPosMomAng3D", ";cos(#vec{r},#vec{p})", 200, -1.0, 1.0 );
229 m_hists["2trkVtxDistFromPV"] = new TH1F("2trkVtDistFromPV", ";2tr vertex distance from PV;Events", 100, 0, 3 );
230
231
232 std::string histDir("/AANT/VrtSecInclusive" + m_jp.augVerString + "/");
233
234 for( auto& pair : m_hists ) {
235 ATH_CHECK( hist_root->regHist( histDir + pair.first, pair.second ) );
236 }
237 }
238
239
240 if( m_jp.FillNtuple ) {
241
243
244 m_tree_Vert = new TTree("tree_VrtSecInclusive","TTree of VrtSecInclusive");
245 ATH_CHECK( hist_root->regTree("/AANT/tree_VrtSecInclusive", m_tree_Vert) );
246
248
249 }
250
251 // initialize keys
252 ATH_CHECK(m_eventInfoKey.initialize());
253
254 // Instantiate and initialize our event info decorator write
255 m_vertexingStatusKey = SG::WriteDecorHandleKey<xAOD::EventInfo>(m_eventInfoKey.key() + "." + "VrtSecInclusive_"+ m_jp.secondaryVerticesContainerName + m_jp.augVerString + "_status");
256 this->declare(m_vertexingStatusKey);
257 m_vertexingStatusKey.setOwner(&(*this));
258 ATH_CHECK(m_vertexingStatusKey.initialize());
259
260 //
261 ATH_MSG_INFO("initialize: Exit VrtSecInclusive::initialize()");
262 return StatusCode::SUCCESS;
263 }
const ServiceHandle< StoreGateSvc > & detStore() const
StatusCode associateNonSelectedTracks(std::vector< WrkVrt > *)
in addition to selected tracks, associate as much tracks as possible
StatusCode mergeFinalVertices(std::vector< WrkVrt > *)
attempt to merge vertices by lookng at the distance between two vertices
StatusCode refitAndSelectGoodQualityVertices(std::vector< WrkVrt > *)
finalization of the vertex and store to xAOD::VertexContainer
StatusCode reassembleVertices(std::vector< WrkVrt > *)
attempt to merge vertices when all tracks of a vertex A is close to vertex B in terms of impact param...
StatusCode rearrangeTracks(std::vector< WrkVrt > *)
StatusCode extractIncompatibleTrackPairs(std::vector< WrkVrt > *)
related to the graph method and verte finding
StatusCode findNtrackVertices(std::vector< WrkVrt > *)
StatusCode mergeByShuffling(std::vector< WrkVrt > *)
attempt to merge splitted vertices when they are significantly distant due to the long-tail behavior ...
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ lockLeptonDecorations()

void VKalVrtAthena::VrtSecInclusive::lockLeptonDecorations ( const SG::AuxVectorData * cont) const
private

Definition at line 508 of file VrtSecInclusive.cxx.

508 {
509 SG::AuxVectorData* cont_nc ATLAS_THREAD_SAFE =
510 const_cast<SG::AuxVectorData*> (cont);
511 for (const IPDecoratorType& dec : m_ipDecors) {
512 if (dec.isAvailable (*cont)) {
513 cont_nc->lockDecoration (dec.auxid());
514 }
515 }
516
517 if (m_decor_svLink) {
518 if (m_decor_svLink->isAvailable (*cont)) {
519 cont_nc->lockDecoration (m_decor_svLink->auxid());
520 }
521 }
522 }
#define ATLAS_THREAD_SAFE
SG::AuxElement::Decorator< std::vector< std::vector< float > > > IPDecoratorType

◆ lockTrackDecorations() [1/2]

StatusCode VKalVrtAthena::VrtSecInclusive::lockTrackDecorations ( bool onlySelection) const
private

Definition at line 524 of file VrtSecInclusive.cxx.

525 {
526 const xAOD::TrackParticleContainer* trackParticleContainer ( nullptr );
527 ATH_CHECK( evtStore()->retrieve( trackParticleContainer, m_jp.TrackLocation) );
528 for( const xAOD::TrackParticle* trk : *trackParticleContainer ) {
529 lockTrackDecorations( trk, onlySelection );
530 }
531
532 const xAOD::MuonContainer* muons ( nullptr );
533 ATH_CHECK( evtStore()->retrieve( muons, m_jp.MuonLocation) );
534 if (muons->ownPolicy() != SG::VIEW_ELEMENTS) {
535 lockLeptonDecorations (muons);
536 }
537 for( const xAOD::Muon* muon : *muons ) {
538 if (muons->ownPolicy() == SG::VIEW_ELEMENTS) {
539 lockLeptonDecorations (muon->container());
540 }
541 if ( const xAOD::TrackParticle* trk = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ) ) {
542 lockTrackDecorations( trk, onlySelection );
543 }
544 }
545
546 const xAOD::ElectronContainer *electrons( nullptr );
547 ATH_CHECK( evtStore()->retrieve( electrons, m_jp.ElectronLocation ) );
548 if (electrons->ownPolicy() != SG::VIEW_ELEMENTS) {
549 lockLeptonDecorations (electrons);
550 }
551 for( const xAOD::Electron* electron : *electrons ) {
552 if (electrons->ownPolicy() == SG::VIEW_ELEMENTS) {
553 lockLeptonDecorations (electron->container());
554 }
555 if( electron->nTrackParticles() > 0 ) {
556 if (const xAOD::TrackParticle* trk = electron->trackParticle(0)) {
557 lockTrackDecorations( trk, onlySelection );
558 }
559 }
560 }
561
562 const xAOD::TrackParticleContainer* IDtracks ( nullptr );
563 ATH_CHECK( evtStore()->retrieve( IDtracks, m_jp.TrackLocation) );
564 for( const auto *trk : *IDtracks ) {
565 lockTrackDecorations( trk, onlySelection );
566 }
567
568 return StatusCode::SUCCESS;
569 }
void lockLeptonDecorations(const SG::AuxVectorData *cont) const
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Electron_v1 Electron
Definition of the current "egamma version".

◆ lockTrackDecorations() [2/2]

void VKalVrtAthena::VrtSecInclusive::lockTrackDecorations ( const xAOD::TrackParticle * trk,
bool onlySelection ) const
private

lock decorations at the end of the algorithm

Definition at line 489 of file VrtSecInclusive.cxx.

489 {
490 SG::AuxVectorData* cont_nc ATLAS_THREAD_SAFE =
491 const_cast<SG::AuxVectorData*> (trk->container());
492 cont_nc->lockDecoration (m_decor_isSelected->auxid());
493
494 if (onlySelection) return;
495
496 if (m_decor_isAssociated && m_decor_isAssociated->isAvailable (*cont_nc)) {
497 cont_nc->lockDecoration (m_decor_isAssociated->auxid());
498 }
499 if (m_decor_is_svtrk_final && m_decor_is_svtrk_final->isAvailable (*cont_nc)) {
500 cont_nc->lockDecoration (m_decor_is_svtrk_final->auxid());
501 }
502
503 for (const auto& p : m_trkDecors) {
504 cont_nc->lockDecoration (p.second.auxid());
505 }
506 }
const SG::AuxVectorData * container() const
Return the container holding this element.
std::map< unsigned, SG::Decorator< float > > m_trkDecors
std::optional< SG::Decorator< char > > m_decor_isSelected
std::optional< SG::Decorator< char > > m_decor_is_svtrk_final

◆ mergeByShuffling()

StatusCode VKalVrtAthena::VrtSecInclusive::mergeByShuffling ( std::vector< WrkVrt > * workVerticesContainer)
private

attempt to merge splitted vertices when they are significantly distant due to the long-tail behavior of the vertex reconstruction resolution

Definition at line 1309 of file VertexingAlgs.cxx.

1310 {
1311
1312 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": #verticess = " << workVerticesContainer->size() );
1313
1314 unsigned mergeCounter { 0 };
1315
1316 // First, sort WrkVrt by the track multiplicity
1317 std::sort( workVerticesContainer->begin(), workVerticesContainer->end(), [](WrkVrt& v1, WrkVrt& v2) { return v1.selectedTrackIndices.size() < v2.selectedTrackIndices.size(); } );
1318
1319 // Loop over vertices (small -> large Ntrk order)
1320 for( auto& wrkvrt : *workVerticesContainer ) {
1321 if( !wrkvrt.isGood ) continue;
1322 if( wrkvrt.selectedTrackIndices.size() <= 1 ) continue;
1323
1324 // Reverse iteration: large Ntrk -> small Ntrk order
1325 for( auto ritr = workVerticesContainer->rbegin(); ritr != workVerticesContainer->rend(); ++ritr ) {
1326 auto& vertexToMerge = *ritr;
1327
1328 if( !vertexToMerge.isGood ) continue;
1329 if( vertexToMerge.selectedTrackIndices.size() <= 1 ) continue;
1330 if( &wrkvrt == &vertexToMerge ) continue;
1331 if( vertexToMerge.selectedTrackIndices.size() < wrkvrt.selectedTrackIndices.size() ) continue;
1332
1333 const double& significance = significanceBetweenVertices( wrkvrt, vertexToMerge );
1334
1335 if( significance > m_jp.mergeByShufflingMaxSignificance ) continue;
1336
1337 bool mergeFlag { false };
1338
1339 ATH_MSG_DEBUG(" > " << __FUNCTION__
1340 << ": vertex " << &wrkvrt << " #tracks = " << wrkvrt.selectedTrackIndices.size()
1341 << " --> to Merge : " << &vertexToMerge << ", #tracks = " << vertexToMerge.selectedTrackIndices.size()
1342 << " significance = " << significance );
1343
1344 double min_signif = AlgConsts::maxValue;
1345
1346 // Method 1. Assume that the solution is somewhat wrong, and the solution gets correct if it starts from the other vertex position
1347 if( m_jp.doSuggestedRefitOnMerging && !mergeFlag ) {
1348 WrkVrt testVertex = wrkvrt;
1349 StatusCode sc = refitVertexWithSuggestion( testVertex, vertexToMerge.vertex );
1350 if( sc.isFailure() ) {
1351 //ATH_MSG_WARNING(" > " << __FUNCTION__ << ": detected vertex fitting failure!" );
1352 } else {
1353
1354 const auto signif = significanceBetweenVertices( testVertex, vertexToMerge );
1355 if( signif < min_signif ) min_signif = signif;
1356
1357 if( signif < m_jp.mergeByShufflingAllowance ) {
1358 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": method1: vertexToMerge " << &vertexToMerge << ": test signif = " << signif );
1359 mergeFlag = true;
1360
1361 }
1362
1363 if( m_jp.FillHist && min_signif > 0. ) m_hists["shuffleMinSignif1"]->Fill( log10( min_signif ) );
1364 if( m_jp.FillHist && mergeFlag ) { m_hists["mergeType"]->Fill( SHUFFLE1 ); }
1365 }
1366 }
1367
1368 // Method 2. magnet merging: borrowing another track from the target vertex to merge
1369 if( m_jp.doMagnetMerging && !mergeFlag ) {
1370
1371 // Loop over tracks in vertexToMerge
1372 for( auto& index : vertexToMerge.selectedTrackIndices ) {
1373
1374 WrkVrt testVertex = wrkvrt;
1375 testVertex.selectedTrackIndices.emplace_back( index );
1376
1377 StatusCode sc = refitVertexWithSuggestion( testVertex, vertexToMerge.vertex );
1378 if( sc.isFailure() ) {
1379 //ATH_MSG_WARNING(" > " << __FUNCTION__ << ": detected vertex fitting failure!" );
1380 } else {
1381
1382 const auto signif = significanceBetweenVertices( testVertex, vertexToMerge );
1383 if( signif < min_signif ) min_signif = signif;
1384
1385 if( signif < m_jp.mergeByShufflingAllowance ) {
1386 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": method2: vertexToMerge " << &vertexToMerge << " track index " << index << ": test signif = " << signif );
1387 mergeFlag = true;
1388 }
1389
1390 }
1391 }
1392
1393 if( m_jp.FillHist && min_signif > 0. ) m_hists["shuffleMinSignif2"]->Fill( log10( min_signif ) );
1394
1395 if( m_jp.FillHist && mergeFlag ) { m_hists["mergeType"]->Fill( SHUFFLE2 ); }
1396 }
1397
1398 // Method 3. Attempt to force merge
1399 if( m_jp.doWildMerging && !mergeFlag ) {
1400
1401 WrkVrt testVertex = wrkvrt;
1402
1403 for( auto& index : vertexToMerge.selectedTrackIndices ) {
1404 testVertex.selectedTrackIndices.emplace_back( index );
1405 }
1406
1407 StatusCode sc = refitVertexWithSuggestion( testVertex, vertexToMerge.vertex );
1408 if( sc.isFailure() ) {
1409 //ATH_MSG_WARNING(" > " << __FUNCTION__ << ": detected vertex fitting failure!" );
1410 } else {
1411
1412 const auto signif = significanceBetweenVertices( testVertex, vertexToMerge );
1413 if( signif < min_signif ) min_signif = signif;
1414
1415 if( signif < m_jp.mergeByShufflingAllowance ) {
1416 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": method3: vertexToMerge " << &vertexToMerge << ": test signif = " << signif );
1417 mergeFlag = true;
1418 }
1419
1420 if( m_jp.FillHist && min_signif > 0. ) m_hists["shuffleMinSignif3"]->Fill( log10( min_signif ) );
1421 if( m_jp.FillHist && mergeFlag ) { m_hists["mergeType"]->Fill( SHUFFLE3 ); }
1422
1423 }
1424 }
1425
1426
1427 if( mergeFlag ) {
1428 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": vertexToMerge " << &vertexToMerge << " ==> min signif = " << min_signif << " judged to merge" );
1429
1430 auto vertexToMerge_backup = vertexToMerge;
1431 auto wrkvrt_backup = wrkvrt;
1432
1433 StatusCode sc = mergeVertices( vertexToMerge, wrkvrt );
1434 if( sc.isFailure() ) {
1435 vertexToMerge = vertexToMerge_backup;
1436 wrkvrt = wrkvrt_backup;
1437 continue;
1438 }
1439
1440 improveVertexChi2( wrkvrt );
1441
1442 mergeCounter++;
1443 }
1444
1445 }
1446
1447 }
1448
1449 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1450 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Number of merges = " << mergeCounter );
1451 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1452
1453 return StatusCode::SUCCESS;
1454 }
StatusCode mergeVertices(WrkVrt &destination, WrkVrt &source)
the 2nd vertex is merged into the 1st vertex.
double significanceBetweenVertices(const WrkVrt &, const WrkVrt &) const
calculate the significance (Mahalanobis distance) between two reconstructed vertices
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ mergeFinalVertices()

StatusCode VKalVrtAthena::VrtSecInclusive::mergeFinalVertices ( std::vector< WrkVrt > * workVerticesContainer)
private

attempt to merge vertices by lookng at the distance between two vertices

Definition at line 1458 of file VertexingAlgs.cxx.

1459 {
1460
1461 unsigned mergeCounter { 0 };
1462
1463 while (true) {
1464 //
1465 // Minimal vertex-vertex distance
1466 //
1467 for( auto& wrkvrt : *workVerticesContainer) {
1468 wrkvrt.closestWrkVrtIndex = AlgConsts::invalidUnsigned;
1469 wrkvrt.closestWrkVrtValue = AlgConsts::maxValue;
1470 }
1471
1472 std::pair<unsigned, unsigned> indexPair { AlgConsts::invalidUnsigned, AlgConsts::invalidUnsigned };
1473 auto minDistance = findMinVerticesPair( workVerticesContainer, indexPair, &VrtSecInclusive::distanceBetweenVertices );
1474
1475 if( minDistance == AlgConsts::maxValue ) break;
1476 if( indexPair.first == AlgConsts::invalidUnsigned ) break;
1477 if( indexPair.second == AlgConsts::invalidUnsigned ) break;
1478
1479 auto& v1 = workVerticesContainer->at(indexPair.first);
1480 auto& v2 = workVerticesContainer->at(indexPair.second);
1481
1482 const double averageRadius = ( v1.vertex.perp() + v2.vertex.perp() ) / 2.0;
1483
1484 if( minDistance > m_jp.VertexMergeFinalDistCut + m_jp.VertexMergeFinalDistScaling * averageRadius ) {
1485 ATH_MSG_DEBUG( "Vertices " << indexPair.first << " and " << indexPair.second
1486 <<" are separated by distance " << minDistance );
1487 break;
1488 }
1489
1490 ATH_MSG_DEBUG( "Merging FINAL vertices " << indexPair.first << " and " << indexPair.second
1491 <<" which are separated by distance "<< minDistance );
1492
1493 StatusCode sc = mergeVertices( v1, v2 );
1494 if( sc.isFailure() ) {}
1495 if( m_jp.FillHist ) { m_hists["mergeType"]->Fill( FINAL ); }
1496
1497 improveVertexChi2( v1 );
1498
1499 mergeCounter++;
1500
1501 }
1502
1503 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1504 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Number of merges = " << mergeCounter );
1505 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1506
1507 return StatusCode::SUCCESS;
1508
1509 } // end of mergeFinalVertices
double distanceBetweenVertices(const WrkVrt &, const WrkVrt &) const
calculate the physical distance
double findMinVerticesPair(std::vector< WrkVrt > *, std::pair< unsigned, unsigned > &, const AlgForVerticesPair &)
returns the pair of vertices that give minimum in terms of some observable (e.g.

◆ mergeVertices()

StatusCode VKalVrtAthena::VrtSecInclusive::mergeVertices ( WrkVrt & destination,
WrkVrt & source )
private

the 2nd vertex is merged into the 1st vertex.

A destructive operation.

Definition at line 452 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

453 {
454 //
455 // Merge two close vertices into one (first) and set NTr=0 for second vertex
456 //
457
458 // firstly, take a backup of the original vertices
459 auto v1_bak = v1;
460 auto v2_bak = v2;
461
462 for( auto& index : v2.selectedTrackIndices ) { v1.selectedTrackIndices.emplace_back( index ); }
463
464 // Cleaning
465 deque<long int>::iterator TransfEnd;
466 sort( v1.selectedTrackIndices.begin(), v1.selectedTrackIndices.end() );
467 TransfEnd = unique(v1.selectedTrackIndices.begin(), v1.selectedTrackIndices.end() );
468 v1.selectedTrackIndices.erase( TransfEnd, v1.selectedTrackIndices.end());
469 //
470 //----------------------------------------------------------
471 v2.selectedTrackIndices.clear(); //Clean dropped vertex
472 v2.closestWrkVrtValue = AlgConsts::maxValue; //Clean dropped vertex
473 v2.closestWrkVrtIndex = 0; //Clean dropped vertex
474 v2.isGood = false; //Clean dropped vertex
475
476 v1.closestWrkVrtValue = AlgConsts::maxValue; //Clean new vertex
477 v1.closestWrkVrtIndex = 0; //Clean new vertex
478 v1.isGood = true; //Clean new vertex
479
480 StatusCode sc = refitVertex( v1 );
481 if( sc.isFailure() ) {
482 v1 = v1_bak;
483 v2 = v2_bak;
484
485 ATH_MSG_DEBUG(" >>> " << __FUNCTION__ << ": failure in merging" );
486
487 return StatusCode::FAILURE;
488 }
489
490 return StatusCode::SUCCESS;
491 }
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.

◆ monitorVertexingAlgorithmStep()

StatusCode VKalVrtAthena::VrtSecInclusive::monitorVertexingAlgorithmStep ( std::vector< WrkVrt > * workVerticesContainer,
const std::string & name,
bool final = false )
private

monitor the intermediate status of vertexing

Definition at line 2210 of file VertexingAlgs.cxx.

2210 {
2211
2212 if( m_jp.FillIntermediateVertices ) {
2213
2214 const xAOD::TrackParticleContainer* trackParticleContainer ( nullptr );
2215 ATH_CHECK( evtStore()->retrieve( trackParticleContainer, m_jp.TrackLocation) );
2216
2217 xAOD::VertexContainer* intermediateVertexContainer { nullptr };
2218
2219 ATH_CHECK( evtStore()->retrieve( intermediateVertexContainer, "VrtSecInclusive_IntermediateVertices_" + name + m_jp.augVerString ) );
2220
2221 for( auto& wrkvrt : *workVerticesContainer ) {
2222
2224 intermediateVertexContainer->emplace_back( vertex );
2225
2226 // Registering the vertex position to xAOD::Vertex
2227 vertex->setPosition( wrkvrt.vertex );
2228
2229 // Registering the vertex type: SV
2230 vertex->setVertexType( xAOD::VxType::SecVtx );
2231
2232 // Registering the vertex chi2 and Ndof
2233 int ndof = wrkvrt.ndof();
2234 vertex->setFitQuality( wrkvrt.Chi2, ndof );
2235
2236 // Registering the vertex covariance matrix
2237 std::vector<float> fCov(wrkvrt.vertexCov.cbegin(), wrkvrt.vertexCov.cend());
2238 vertex->setCovariance(fCov);
2239
2240 // Registering tracks comprising the vertex to xAOD::Vertex
2241 // loop over the tracks comprising the vertex
2242 for( auto trk_id : wrkvrt.selectedTrackIndices ) {
2243
2244 const xAOD::TrackParticle *trk = m_selectedTracks.at( trk_id );
2245
2246 // Acquire link the track to the vertex
2247 ElementLink<xAOD::TrackParticleContainer> link_trk( *( dynamic_cast<const xAOD::TrackParticleContainer*>( trk->container() ) ), static_cast<long unsigned int>(trk->index()) );
2248
2249 // Register the link to the vertex
2250 vertex->addTrackAtVertex( link_trk, 1. );
2251
2252 }
2253
2254 for( auto trk_id : wrkvrt.associatedTrackIndices ) {
2255
2256 const xAOD::TrackParticle *trk = m_associatedTracks.at( trk_id );
2257
2258 // Acquire link the track to the vertex
2259 ElementLink<xAOD::TrackParticleContainer> link_trk( *( dynamic_cast<const xAOD::TrackParticleContainer*>( trk->container() ) ), static_cast<long unsigned int>(trk->index()) );
2260
2261 // Register the link to the vertex
2262 vertex->addTrackAtVertex( link_trk, 1. );
2263
2264 }
2265 }
2266
2267 }
2268
2269
2270
2271 if( !m_jp.FillHist ) return StatusCode::SUCCESS;
2272
2273 printWrkSet( workVerticesContainer, Form("%s (step %u)", name.c_str(), m_vertexingAlgorithmStep) );
2274
2275 unsigned count = std::count_if( workVerticesContainer->begin(), workVerticesContainer->end(),
2276 []( WrkVrt& v ) { return ( v.selectedTrackIndices.size() + v.associatedTrackIndices.size() ) >= 2; } );
2277
2278 if( m_vertexingAlgorithmStep == 0 ) {
2279
2280 const auto compSize = m_selectedTracks.size()*(m_selectedTracks.size() - 1)/2 - m_incomp.size();
2281 m_hists["vertexYield"]->Fill( m_vertexingAlgorithmStep, compSize );
2282
2283 } else {
2284
2285 m_hists["vertexYield"]->Fill( m_vertexingAlgorithmStep, count );
2286
2287 }
2288
2289 m_hists["vertexYield"]->GetXaxis()->SetBinLabel( m_vertexingAlgorithmStep+1, name.c_str() );
2290
2291 for( auto& vertex : *workVerticesContainer ) {
2292 auto ntrk = vertex.selectedTrackIndices.size() + vertex.associatedTrackIndices.size();
2293 if( vertex.isGood && ntrk >= 2 ) {
2294 dynamic_cast<TH2F*>( m_hists["vertexYieldNtrk"] )->Fill( ntrk, m_vertexingAlgorithmStep );
2295 dynamic_cast<TH2F*>( m_hists["vertexYieldChi2"] )->Fill( vertex.Chi2/(vertex.ndof() + AlgConsts::infinitesimal), m_vertexingAlgorithmStep );
2296 }
2297 }
2298 m_hists["vertexYieldNtrk"]->GetYaxis()->SetBinLabel( m_vertexingAlgorithmStep+1, name.c_str() );
2299 m_hists["vertexYieldChi2"]->GetYaxis()->SetBinLabel( m_vertexingAlgorithmStep+1, name.c_str() );
2300
2301
2302 if( !final ) return StatusCode::SUCCESS;
2303
2304 for( auto& vertex : *workVerticesContainer ) {
2305 auto ntrk = vertex.selectedTrackIndices.size() + vertex.associatedTrackIndices.size();
2306 if( vertex.isGood && ntrk >= 2 ) {
2307 m_hists["finalVtxNtrk"] ->Fill( ntrk );
2308 m_hists["finalVtxR"] ->Fill( vertex.vertex.perp() );
2309 dynamic_cast<TH2F*>( m_hists["finalVtxNtrkR"] )->Fill( ntrk, vertex.vertex.perp() );
2310 }
2311 }
2312
2313 return StatusCode::SUCCESS;
2314 }
value_type emplace_back(value_type pElem)
Add an element to the end of the collection.
void printWrkSet(const std::vector< WrkVrt > *WrkVrtSet, const std::string &name)
print the contents of reconstructed vertices
float ndof(const U &p)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ nTrkCommon()

size_t VKalVrtAthena::VrtSecInclusive::nTrkCommon ( std::vector< WrkVrt > * WrkVrtSet,
const std::pair< unsigned, unsigned > & pairIndex )
staticprivate

returns the number of tracks commonly present in both vertices

Definition at line 662 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

663 {
664 //
665 // Number of common tracks for 2 vertices
666 //
667
668 auto& trackIndices1 = workVerticesContainer->at( pairIndex.first ).selectedTrackIndices;
669 auto& trackIndices2 = workVerticesContainer->at( pairIndex.second ).selectedTrackIndices;
670
671 if( trackIndices1.size() < 2 ) return 0;
672 if( trackIndices2.size() < 2 ) return 0;
673
674 size_t nTrkCom = 0;
675
676 for( auto& index : trackIndices1 ) {
677 if( std::find(trackIndices2.begin(),trackIndices2.end(), index) != trackIndices2.end()) nTrkCom++;
678 }
679
680 return nTrkCom;
681 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ passedFakeReject()

bool VKalVrtAthena::VrtSecInclusive::passedFakeReject ( const Amg::Vector3D & FitVertex,
const xAOD::TrackParticle * itrk,
const xAOD::TrackParticle * jtrk )
private

Flag false if the consistituent tracks are not consistent with the vertex position.

Definition at line 2323 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2326 {
2327
2328 const bool& check_itrk = ( this->*m_patternStrategyFuncs[m_checkPatternStrategy] )( itrk, FitVertex );
2329 const bool& check_jtrk = ( this->*m_patternStrategyFuncs[m_checkPatternStrategy] )( jtrk, FitVertex );
2330
2331 return ( check_itrk && check_jtrk );
2332
2333 }

◆ patternCheck()

bool VKalVrtAthena::VrtSecInclusive::patternCheck ( const uint32_t & pattern,
const Amg::Vector3D & vertex )
private

Definition at line 2159 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2159 {
2160 bool flag = false;
2161
2162 if( m_jp.geoModel == VKalVrtAthena::GeoModel::Run2 ) {
2163 flag = patternCheckRun2( pattern, vertex );
2164 } else if( m_jp.geoModel == VKalVrtAthena::GeoModel::Run1 ) {
2165 flag = patternCheckRun1( pattern, vertex );
2166 }
2167
2168 return flag;
2169 }
static bool patternCheckRun1(const uint32_t &pattern, const Amg::Vector3D &vertex)
static bool patternCheckRun2(const uint32_t &pattern, const Amg::Vector3D &vertex)
bool flag
Definition master.py:29

◆ patternCheckOuterOnly()

bool VKalVrtAthena::VrtSecInclusive::patternCheckOuterOnly ( const uint32_t & pattern,
const Amg::Vector3D & vertex )
private

Definition at line 2172 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2172 {
2173 bool flag = false;
2174
2175 if( m_jp.geoModel == VKalVrtAthena::GeoModel::Run2 ) {
2176 flag = patternCheckRun2OuterOnly( pattern, vertex );
2177 } else if( m_jp.geoModel == VKalVrtAthena::GeoModel::Run1 ) {
2178 flag = patternCheckRun1OuterOnly( pattern, vertex );
2179 }
2180
2181 return flag;
2182 }
static bool patternCheckRun1OuterOnly(const uint32_t &pattern, const Amg::Vector3D &vertex)
static bool patternCheckRun2OuterOnly(const uint32_t &pattern, const Amg::Vector3D &vertex)

◆ patternCheckRun1()

bool VKalVrtAthena::VrtSecInclusive::patternCheckRun1 ( const uint32_t & pattern,
const Amg::Vector3D & vertex )
staticprivate

Definition at line 1849 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

1849 {
1850 //
1851 // rough guesses for active layers:
1852 // BeamPipe: 25.0
1853 // Pix0 (BLayer): 47.7-54.4, Pix1: 85.5-92.2, Pix2: 119.3-126.1
1854 // Sct0: 290-315, Sct1: 360-390, Sct2: 430-460, Sct3:500-530
1855 //
1856
1857 const double rad = vertex.perp();
1858 const double absz = fabs( vertex.z() );
1859
1860 // vertex area classification
1861 enum vertexArea {
1862 insideBeamPipe,
1863
1864 insidePixelBarrel1,
1865 aroundPixelBarrel1,
1866
1867 outsidePixelBarrel1_and_insidePixelBarrel2,
1868 aroundPixelBarrel2,
1869
1870 outsidePixelBarrel2_and_insidePixelBarrel3,
1871 aroundPixelBarrel3,
1872
1873 outsidePixelBarrel3_and_insideSctBarrel0,
1874 aroundSctBarrel0,
1875
1876 outsideSctBarrel0_and_insideSctBarrel1,
1877 aroundSctBarrel1,
1878 };
1879
1880 // Mutually exclusive vertex position pattern
1881 Int_t vertex_pattern = 0;
1882 if( rad < 25.00 ) {
1883 vertex_pattern = insideBeamPipe;
1884
1885 } else if( rad < 47.7 && absz < 400.5 ) {
1886 vertex_pattern = insidePixelBarrel1;
1887
1888 } else if( rad < 54.4 && absz < 400.5 ) {
1889 vertex_pattern = aroundPixelBarrel1;
1890
1891 } else if( rad < 85.5 && absz < 400.5 ) {
1892 vertex_pattern = outsidePixelBarrel1_and_insidePixelBarrel2;
1893
1894 } else if( rad < 92.2 && absz < 400.5 ) {
1895 vertex_pattern = aroundPixelBarrel2;
1896
1897 } else if( rad < 119.3 && absz < 400.5 ) {
1898 vertex_pattern = outsidePixelBarrel2_and_insidePixelBarrel3;
1899
1900 } else if( rad < 126.1 && absz < 400.5 ) {
1901 vertex_pattern = aroundPixelBarrel3;
1902
1903 } else if( rad < 290 && absz < 749.0 ) {
1904 vertex_pattern = outsidePixelBarrel3_and_insideSctBarrel0;
1905
1906 } else if( rad < 315 && absz < 749.0 ) {
1907 vertex_pattern = aroundSctBarrel0;
1908
1909 } else if( rad < 360 && absz < 749.0 ) {
1910 vertex_pattern = outsideSctBarrel0_and_insideSctBarrel1;
1911
1912 } else if( rad < 390 && absz < 749.0 ) {
1913 vertex_pattern = aroundSctBarrel1;
1914
1915 } else {
1916 }
1917
1918
1920 if( vertex_pattern == insideBeamPipe ) {
1921
1922 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1923
1924 }
1925
1926
1927 else if( vertex_pattern == insidePixelBarrel1 ) {
1928
1929 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1930 }
1931
1932
1933 else if( vertex_pattern == aroundPixelBarrel1 ) {
1934
1935 // require nothing for PixelBarrel1
1936 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1937 }
1938
1939
1940 else if( vertex_pattern == outsidePixelBarrel1_and_insidePixelBarrel2 ) {
1941
1942 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1943 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1944 }
1945
1946
1947 else if( vertex_pattern == aroundPixelBarrel2 ) {
1948
1949 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1950 // require nothing for PixelBarrel2
1951 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1952 }
1953
1954
1955 else if( vertex_pattern == outsidePixelBarrel2_and_insidePixelBarrel3 ) {
1956
1957 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1958 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1959 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1960 }
1961
1962 else if( vertex_pattern == aroundPixelBarrel3 ) {
1963
1964 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1965 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1966 // require nothing for PixelBarrel3
1967 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
1968 }
1969
1970
1971 else if( vertex_pattern == outsidePixelBarrel3_and_insideSctBarrel0 ) {
1972
1973 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1974 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1975 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1976 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
1977 }
1978
1979
1980 else if( vertex_pattern == aroundSctBarrel0 ) {
1981
1982 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1983 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1984 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1985 // require nothing for SctBarrel0
1986 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1987 }
1988
1989
1990 else if( vertex_pattern == outsideSctBarrel0_and_insideSctBarrel1 ) {
1991
1992 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1993 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1994 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1995 if( (pattern & (1<<Trk::sctBarrel0)) ) return false;
1996 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1997 }
1998
1999
2000 else if( vertex_pattern == aroundSctBarrel1 ) {
2001 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
2002 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
2003 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
2004 if( (pattern & (1<<Trk::sctBarrel0)) ) return false;
2005 // require nothing for SctBarrel1
2006 if( ! (pattern & (1<<Trk::sctBarrel2)) ) return false;
2007 }
2009
2010 return true;
2011 }

◆ patternCheckRun1OuterOnly()

bool VKalVrtAthena::VrtSecInclusive::patternCheckRun1OuterOnly ( const uint32_t & pattern,
const Amg::Vector3D & vertex )
staticprivate

Definition at line 2014 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2014 {
2015 //
2016 // rough guesses for active layers:
2017 // BeamPipe: 25.0
2018 // Pix0 (BLayer): 47.7-54.4, Pix1: 85.5-92.2, Pix2: 119.3-126.1
2019 // Sct0: 290-315, Sct1: 360-390, Sct2: 430-460, Sct3:500-530
2020 //
2021
2022 const double rad = vertex.perp();
2023 const double absz = fabs( vertex.z() );
2024
2025 // vertex area classification
2026 enum vertexArea {
2027 insideBeamPipe,
2028
2029 insidePixelBarrel1,
2030 aroundPixelBarrel1,
2031
2032 outsidePixelBarrel1_and_insidePixelBarrel2,
2033 aroundPixelBarrel2,
2034
2035 outsidePixelBarrel2_and_insidePixelBarrel3,
2036 aroundPixelBarrel3,
2037
2038 outsidePixelBarrel3_and_insideSctBarrel0,
2039 aroundSctBarrel0,
2040
2041 outsideSctBarrel0_and_insideSctBarrel1,
2042 aroundSctBarrel1,
2043 };
2044
2045 // Mutually exclusive vertex position pattern
2046 Int_t vertex_pattern = 0;
2047 if( rad < 25.00 ) {
2048 vertex_pattern = insideBeamPipe;
2049
2050 } else if( rad < 47.7 && absz < 400.5 ) {
2051 vertex_pattern = insidePixelBarrel1;
2052
2053 } else if( rad < 54.4 && absz < 400.5 ) {
2054 vertex_pattern = aroundPixelBarrel1;
2055
2056 } else if( rad < 85.5 && absz < 400.5 ) {
2057 vertex_pattern = outsidePixelBarrel1_and_insidePixelBarrel2;
2058
2059 } else if( rad < 92.2 && absz < 400.5 ) {
2060 vertex_pattern = aroundPixelBarrel2;
2061
2062 } else if( rad < 119.3 && absz < 400.5 ) {
2063 vertex_pattern = outsidePixelBarrel2_and_insidePixelBarrel3;
2064
2065 } else if( rad < 126.1 && absz < 400.5 ) {
2066 vertex_pattern = aroundPixelBarrel3;
2067
2068 } else if( rad < 290 && absz < 749.0 ) {
2069 vertex_pattern = outsidePixelBarrel3_and_insideSctBarrel0;
2070
2071 } else if( rad < 315 && absz < 749.0 ) {
2072 vertex_pattern = aroundSctBarrel0;
2073
2074 } else if( rad < 360 && absz < 749.0 ) {
2075 vertex_pattern = outsideSctBarrel0_and_insideSctBarrel1;
2076
2077 } else if( rad < 390 && absz < 749.0 ) {
2078 vertex_pattern = aroundSctBarrel1;
2079
2080 } else {
2081 }
2082
2083
2085 if( vertex_pattern == insideBeamPipe ) {
2086
2087 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
2088
2089 }
2090
2091
2092 else if( vertex_pattern == insidePixelBarrel1 ) {
2093
2094 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
2095 }
2096
2097
2098 else if( vertex_pattern == aroundPixelBarrel1 ) {
2099
2100 // require nothing for PixelBarrel1
2101 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
2102 }
2103
2104
2105 else if( vertex_pattern == outsidePixelBarrel1_and_insidePixelBarrel2 ) {
2106
2107 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
2108 }
2109
2110
2111 else if( vertex_pattern == aroundPixelBarrel2 ) {
2112
2113 // require nothing for PixelBarrel2
2114 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
2115 }
2116
2117
2118 else if( vertex_pattern == outsidePixelBarrel2_and_insidePixelBarrel3 ) {
2119
2120 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
2121 }
2122
2123 else if( vertex_pattern == aroundPixelBarrel3 ) {
2124
2125 // require nothing for PixelBarrel3
2126 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
2127 }
2128
2129
2130 else if( vertex_pattern == outsidePixelBarrel3_and_insideSctBarrel0 ) {
2131
2132 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
2133 }
2134
2135
2136 else if( vertex_pattern == aroundSctBarrel0 ) {
2137
2138 // require nothing for SctBarrel0
2139 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
2140 }
2141
2142
2143 else if( vertex_pattern == outsideSctBarrel0_and_insideSctBarrel1 ) {
2144
2145 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
2146 }
2147
2148
2149 else if( vertex_pattern == aroundSctBarrel1 ) {
2150 // require nothing for SctBarrel1
2151 if( ! (pattern & (1<<Trk::sctBarrel2)) ) return false;
2152 }
2154
2155 return true;
2156 }

◆ patternCheckRun2()

bool VKalVrtAthena::VrtSecInclusive::patternCheckRun2 ( const uint32_t & pattern,
const Amg::Vector3D & vertex )
staticprivate

Definition at line 1439 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

1439 {
1440
1441 //
1442 // rough guesses for active layers:
1443 // BeamPipe: 23.5-24.3
1444 // IBL: 31.0-38.4
1445 // Pix0 (BLayer): 47.7-54.4, Pix1: 85.5-92.2, Pix2: 119.3-126.1
1446 // Sct0: 290-315, Sct1: 360-390, Sct2: 430-460, Sct3:500-530
1447 //
1448
1449 const double rad = vertex.perp();
1450 const double absz = fabs( vertex.z() );
1451
1452 // vertex area classification
1453 enum vertexArea {
1454 insideBeamPipe,
1455
1456 insidePixelBarrel0,
1457 aroundPixelBarrel0,
1458
1459 outsidePixelBarrel0_and_insidePixelBarrel1,
1460 aroundPixelBarrel1,
1461
1462 outsidePixelBarrel1_and_insidePixelBarrel2,
1463 aroundPixelBarrel2,
1464
1465 outsidePixelBarrel2_and_insidePixelBarrel3,
1466 aroundPixelBarrel3,
1467
1468 outsidePixelBarrel3_and_insideSctBarrel0,
1469 aroundSctBarrel0,
1470
1471 outsideSctBarrel0_and_insideSctBarrel1,
1472 aroundSctBarrel1,
1473 };
1474
1475 // Mutually exclusive vertex position pattern
1476 int vertex_pattern = 0;
1477 if( rad < 23.50 ) {
1478 vertex_pattern = insideBeamPipe;
1479
1480 } else if( rad < 31.0 && absz < 331.5 ) {
1481 vertex_pattern = insidePixelBarrel0;
1482
1483 } else if( rad < 38.4 && absz < 331.5 ) {
1484 vertex_pattern = aroundPixelBarrel0;
1485
1486 } else if( rad < 47.7 && absz < 400.5 ) {
1487 vertex_pattern = outsidePixelBarrel0_and_insidePixelBarrel1;
1488
1489 } else if( rad < 54.4 && absz < 400.5 ) {
1490 vertex_pattern = aroundPixelBarrel1;
1491
1492 } else if( rad < 85.5 && absz < 400.5 ) {
1493 vertex_pattern = outsidePixelBarrel1_and_insidePixelBarrel2;
1494
1495 } else if( rad < 92.2 && absz < 400.5 ) {
1496 vertex_pattern = aroundPixelBarrel2;
1497
1498 } else if( rad < 119.3 && absz < 400.5 ) {
1499 vertex_pattern = outsidePixelBarrel2_and_insidePixelBarrel3;
1500
1501 } else if( rad < 126.1 && absz < 400.5 ) {
1502 vertex_pattern = aroundPixelBarrel3;
1503
1504 } else if( rad < 290 && absz < 749.0 ) {
1505 vertex_pattern = outsidePixelBarrel3_and_insideSctBarrel0;
1506
1507 } else if( rad < 315 && absz < 749.0 ) {
1508 vertex_pattern = aroundSctBarrel0;
1509
1510 } else if( rad < 360 && absz < 749.0 ) {
1511 vertex_pattern = outsideSctBarrel0_and_insideSctBarrel1;
1512
1513 } else if( rad < 390 && absz < 749.0 ) {
1514 vertex_pattern = aroundSctBarrel1;
1515
1516 } else {
1517 }
1518
1519 unsigned nPixelLayers { 0 };
1520 {
1521 if ( pattern & (1 << Trk::pixelBarrel0) ) nPixelLayers++;
1522 if ( pattern & (1 << Trk::pixelBarrel1) ) nPixelLayers++;
1523 if ( pattern & (1 << Trk::pixelBarrel2) ) nPixelLayers++;
1524 if ( pattern & (1 << Trk::pixelBarrel3) ) nPixelLayers++;
1525 if ( pattern & (1 << Trk::pixelEndCap0) ) nPixelLayers++;
1526 if ( pattern & (1 << Trk::pixelEndCap1) ) nPixelLayers++;
1527 if ( pattern & (1 << Trk::pixelEndCap2) ) nPixelLayers++;
1528 }
1529
1531 if( vertex_pattern == insideBeamPipe ) {
1532
1533 if( ! (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1534 if( nPixelLayers < 3 ) return false;
1535
1536
1537 } else if( vertex_pattern == insidePixelBarrel0 ) {
1538
1539 if( ! (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1540 if( nPixelLayers < 3 ) return false;
1541 }
1542
1543
1544 else if( vertex_pattern == aroundPixelBarrel0 ) {
1545
1546 // require nothing for PixelBarrel0
1547 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1548 if( nPixelLayers < 2 ) return false;
1549 }
1550
1551
1552 else if( vertex_pattern == outsidePixelBarrel0_and_insidePixelBarrel1 ) {
1553
1554 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1555 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1556 if( nPixelLayers < 2 ) return false;
1557 }
1558
1559
1560 else if( vertex_pattern == aroundPixelBarrel1 ) {
1561
1562 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1563 // require nothing for PixelBarrel
1564 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1565 if( nPixelLayers < 2 ) return false;
1566 }
1567
1568
1569 else if( vertex_pattern == outsidePixelBarrel1_and_insidePixelBarrel2 ) {
1570
1571 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1572 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1573 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1574 if( nPixelLayers < 2 ) return false;
1575 }
1576
1577
1578 else if( vertex_pattern == aroundPixelBarrel2 ) {
1579
1580 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1581 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1582 // require nothing for PixelBarrel2
1583 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1584 }
1585
1586
1587 else if( vertex_pattern == outsidePixelBarrel2_and_insidePixelBarrel3 ) {
1588
1589 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1590 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1591 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1592 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1593 }
1594
1595 else if( vertex_pattern == aroundPixelBarrel3 ) {
1596
1597 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1598 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1599 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1600 // require nothing for PixelBarrel3
1601 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
1602 }
1603
1604
1605 else if( vertex_pattern == outsidePixelBarrel3_and_insideSctBarrel0 ) {
1606
1607 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1608 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1609 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1610 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1611 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
1612 }
1613
1614
1615 else if( vertex_pattern == aroundSctBarrel0 ) {
1616
1617 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1618 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1619 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1620 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1621 // require nothing for SctBarrel0
1622 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1623 }
1624
1625
1626 else if( vertex_pattern == outsideSctBarrel0_and_insideSctBarrel1 ) {
1627
1628 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1629 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1630 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1631 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1632 if( (pattern & (1<<Trk::sctBarrel0)) ) return false;
1633 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1634 }
1635
1636
1637 else if( vertex_pattern == aroundSctBarrel1 ) {
1638 if( (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1639 if( (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1640 if( (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1641 if( (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1642 if( (pattern & (1<<Trk::sctBarrel0)) ) return false;
1643 // require nothing for SctBarrel1
1644 if( ! (pattern & (1<<Trk::sctBarrel2)) ) return false;
1645 }
1647
1648 return true;
1649
1650 }

◆ patternCheckRun2OuterOnly()

bool VKalVrtAthena::VrtSecInclusive::patternCheckRun2OuterOnly ( const uint32_t & pattern,
const Amg::Vector3D & vertex )
staticprivate

Definition at line 1653 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

1653 {
1654
1655 //
1656 // rough guesses for active layers:
1657 // BeamPipe: 23.5-24.3
1658 // IBL: 31.0-38.4
1659 // Pix0 (BLayer): 47.7-54.4, Pix1: 85.5-92.2, Pix2: 119.3-126.1
1660 // Sct0: 290-315, Sct1: 360-390, Sct2: 430-460, Sct3:500-530
1661 //
1662
1663 const double rad = vertex.perp();
1664 const double absz = fabs( vertex.z() );
1665
1666 // vertex area classification
1667 enum vertexArea {
1668 insideBeamPipe,
1669
1670 insidePixelBarrel0,
1671 aroundPixelBarrel0,
1672
1673 outsidePixelBarrel0_and_insidePixelBarrel1,
1674 aroundPixelBarrel1,
1675
1676 outsidePixelBarrel1_and_insidePixelBarrel2,
1677 aroundPixelBarrel2,
1678
1679 outsidePixelBarrel2_and_insidePixelBarrel3,
1680 aroundPixelBarrel3,
1681
1682 outsidePixelBarrel3_and_insideSctBarrel0,
1683 aroundSctBarrel0,
1684
1685 outsideSctBarrel0_and_insideSctBarrel1,
1686 aroundSctBarrel1,
1687 };
1688
1689 // Mutually exclusive vertex position pattern
1690 int vertex_pattern = 0;
1691 if( rad < 23.50 ) {
1692 vertex_pattern = insideBeamPipe;
1693
1694 } else if( rad < 31.0 && absz < 331.5 ) {
1695 vertex_pattern = insidePixelBarrel0;
1696
1697 } else if( rad < 38.4 && absz < 331.5 ) {
1698 vertex_pattern = aroundPixelBarrel0;
1699
1700 } else if( rad < 47.7 && absz < 400.5 ) {
1701 vertex_pattern = outsidePixelBarrel0_and_insidePixelBarrel1;
1702
1703 } else if( rad < 54.4 && absz < 400.5 ) {
1704 vertex_pattern = aroundPixelBarrel1;
1705
1706 } else if( rad < 85.5 && absz < 400.5 ) {
1707 vertex_pattern = outsidePixelBarrel1_and_insidePixelBarrel2;
1708
1709 } else if( rad < 92.2 && absz < 400.5 ) {
1710 vertex_pattern = aroundPixelBarrel2;
1711
1712 } else if( rad < 119.3 && absz < 400.5 ) {
1713 vertex_pattern = outsidePixelBarrel2_and_insidePixelBarrel3;
1714
1715 } else if( rad < 126.1 && absz < 400.5 ) {
1716 vertex_pattern = aroundPixelBarrel3;
1717
1718 } else if( rad < 290 && absz < 749.0 ) {
1719 vertex_pattern = outsidePixelBarrel3_and_insideSctBarrel0;
1720
1721 } else if( rad < 315 && absz < 749.0 ) {
1722 vertex_pattern = aroundSctBarrel0;
1723
1724 } else if( rad < 360 && absz < 749.0 ) {
1725 vertex_pattern = outsideSctBarrel0_and_insideSctBarrel1;
1726
1727 } else if( rad < 390 && absz < 749.0 ) {
1728 vertex_pattern = aroundSctBarrel1;
1729
1730 } else {
1731 }
1732
1733
1734 unsigned nPixelLayers { 0 };
1735 {
1736 nPixelLayers += ( pattern & (1 << Trk::pixelBarrel0) );
1737 nPixelLayers += ( pattern & (1 << Trk::pixelBarrel1) );
1738 nPixelLayers += ( pattern & (1 << Trk::pixelBarrel2) );
1739 nPixelLayers += ( pattern & (1 << Trk::pixelBarrel3) );
1740 nPixelLayers += ( pattern & (1 << Trk::pixelEndCap0) );
1741 nPixelLayers += ( pattern & (1 << Trk::pixelEndCap1) );
1742 nPixelLayers += ( pattern & (1 << Trk::pixelEndCap2) );
1743 }
1744
1746 if( vertex_pattern == insideBeamPipe ) {
1747
1748 if( ! (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1749 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1750 if( nPixelLayers < 3 ) return false;
1751
1752 } else if( vertex_pattern == insidePixelBarrel0 ) {
1753
1754 if( ! (pattern & (1<<Trk::pixelBarrel0)) ) return false;
1755 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1756 if( nPixelLayers < 3 ) return false;
1757
1758 }
1759
1760
1761 else if( vertex_pattern == aroundPixelBarrel0 ) {
1762
1763 // require nothing for PixelBarrel0
1764 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1765 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1766 if( nPixelLayers < 3 ) return false;
1767 }
1768
1769
1770 else if( vertex_pattern == outsidePixelBarrel0_and_insidePixelBarrel1 ) {
1771
1772 if( ! (pattern & (1<<Trk::pixelBarrel1)) ) return false;
1773 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1774 if( nPixelLayers < 3 ) return false;
1775 }
1776
1777
1778 else if( vertex_pattern == aroundPixelBarrel1 ) {
1779
1780 // require nothing for PixelBarrel1
1781 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1782 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1783 if( nPixelLayers < 2 ) return false;
1784 }
1785
1786
1787 else if( vertex_pattern == outsidePixelBarrel1_and_insidePixelBarrel2 ) {
1788
1789 if( ! (pattern & (1<<Trk::pixelBarrel2)) ) return false;
1790 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1791 if( nPixelLayers < 2 ) return false;
1792 }
1793
1794
1795 else if( vertex_pattern == aroundPixelBarrel2 ) {
1796
1797 // require nothing for PixelBarrel2
1798 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1799 }
1800
1801
1802 else if( vertex_pattern == outsidePixelBarrel2_and_insidePixelBarrel3 ) {
1803
1804 if( ! (pattern & (1<<Trk::pixelBarrel3)) ) return false;
1805 }
1806
1807 else if( vertex_pattern == aroundPixelBarrel3 ) {
1808
1809 // require nothing for PixelBarrel3
1810 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
1811 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1812 }
1813
1814
1815 else if( vertex_pattern == outsidePixelBarrel3_and_insideSctBarrel0 ) {
1816
1817 if( ! (pattern & (1<<Trk::sctBarrel0)) ) return false;
1818 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1819 }
1820
1821
1822 else if( vertex_pattern == aroundSctBarrel0 ) {
1823
1824 // require nothing for SctBarrel0
1825 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1826 if( ! (pattern & (1<<Trk::sctBarrel2)) ) return false;
1827 }
1828
1829
1830 else if( vertex_pattern == outsideSctBarrel0_and_insideSctBarrel1 ) {
1831
1832 if( ! (pattern & (1<<Trk::sctBarrel1)) ) return false;
1833 if( ! (pattern & (1<<Trk::sctBarrel2)) ) return false;
1834 }
1835
1836
1837 else if( vertex_pattern == aroundSctBarrel1 ) {
1838 // require nothing for SctBarrel1
1839 if( ! (pattern & (1<<Trk::sctBarrel2)) ) return false;
1840 if( ! (pattern & (1<<Trk::sctBarrel3)) ) return false;
1841 }
1843
1844 return true;
1845
1846 }

◆ printWrkSet()

void VKalVrtAthena::VrtSecInclusive::printWrkSet ( const std::vector< WrkVrt > * WrkVrtSet,
const std::string & name )
private

print the contents of reconstructed vertices

Definition at line 1001 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

1002 {
1003 ATH_MSG_DEBUG( " >> " << __FUNCTION__ << ": ===============================================================" );
1004 ATH_MSG_DEBUG( " >> " << __FUNCTION__ << ": " << name << ": #vertices = " << workVerticesContainer->size() );
1005
1006 std::set<const xAOD::TrackParticle*> usedTracks;
1007
1008 auto concatenateIndicesToString = []( auto indices, auto& collection ) -> std::string {
1009 if( 0 == indices.size() ) return "";
1010 return std::accumulate( std::next(indices.begin()), indices.end(), std::to_string( indices.at(0) ),
1011 [&collection]( const std::string& str, auto& index ) { return str + ", " + std::to_string( collection.at(index)->index() ); } );
1012 };
1013
1014 std::map<const xAOD::TruthVertex*, bool> previous;
1015
1016 for( auto& pair : m_matchMap ) { previous.emplace( pair.first, pair.second ); }
1017
1018 m_matchMap.clear();
1019 for( const auto* truthVertex : m_tracingTruthVertices ) { m_matchMap.emplace( truthVertex, false ); }
1020
1021 for(size_t iv=0; iv<workVerticesContainer->size(); iv++) {
1022 const auto& wrkvrt = workVerticesContainer->at(iv);
1023
1024 if( wrkvrt.nTracksTotal() < 2 ) continue;
1025
1026 std::string sels = concatenateIndicesToString( wrkvrt.selectedTrackIndices, m_selectedTracks );
1027 std::string assocs = concatenateIndicesToString( wrkvrt.associatedTrackIndices, m_associatedTracks );
1028
1029 for( const auto& index : wrkvrt.selectedTrackIndices ) { usedTracks.insert( m_selectedTracks.at(index) ); }
1030 for( const auto& index : wrkvrt.associatedTrackIndices ) { usedTracks.insert( m_associatedTracks.at(index) ); }
1031
1032 ATH_MSG_DEBUG( " >> " << __FUNCTION__ << ": " << name << " vertex [" << iv << "]: " << &wrkvrt
1033 << ", isGood = " << (wrkvrt.isGood? "true" : "false")
1034 << ", #ntrks(tot, sel, assoc) = (" << wrkvrt.nTracksTotal() << ", " << wrkvrt.selectedTrackIndices.size() << ", " << wrkvrt.associatedTrackIndices.size() << "), "
1035 << ", chi2/ndof = " << wrkvrt.fitQuality()
1036 << ", (r, z) = (" << wrkvrt.vertex.perp()
1037 << ", " << wrkvrt.vertex.z() << ")"
1038 << ", sels = { " << sels << " }"
1039 << ", assocs = { " << assocs << " }" );
1040
1041 // Truth match condition
1042 for( const auto* truthVertex : m_tracingTruthVertices ) {
1043
1044
1045 Amg::Vector3D vTruth( truthVertex->x(), truthVertex->y(), truthVertex->z() );
1046 Amg::Vector3D vReco ( wrkvrt.vertex.x(), wrkvrt.vertex.y(), wrkvrt.vertex.z() );
1047
1048 const auto distance = vReco - vTruth;
1049
1050 AmgSymMatrix(3) cov;
1051 cov.fillSymmetric( 0, 0, wrkvrt.vertexCov.at(0) );
1052 cov.fillSymmetric( 1, 0, wrkvrt.vertexCov.at(1) );
1053 cov.fillSymmetric( 1, 1, wrkvrt.vertexCov.at(2) );
1054 cov.fillSymmetric( 2, 0, wrkvrt.vertexCov.at(3) );
1055 cov.fillSymmetric( 2, 1, wrkvrt.vertexCov.at(4) );
1056 cov.fillSymmetric( 2, 2, wrkvrt.vertexCov.at(5) );
1057
1058 const double s2 = distance.transpose() * cov.inverse() * distance;
1059
1060 if( distance.norm() < 2.0 || s2 < 100. ) m_matchMap.at( truthVertex ) = true;
1061
1062 }
1063
1064 }
1065
1066 ATH_MSG_DEBUG( " >> " << __FUNCTION__ << ": number of used tracks = " << usedTracks.size() );
1067
1068 if( !previous.empty() && previous.size() == m_matchMap.size() ) {
1069 for( auto& pair : m_matchMap ) {
1070 if( previous.find( pair.first ) == previous.end() ) continue;
1071 if( pair.second != previous.at( pair.first ) ) {
1072 ATH_MSG_DEBUG( " >> " << __FUNCTION__ << ": Match flag has changed: (r, z) = (" << pair.first->perp() << ", " << pair.first->z() << ")" );
1073 }
1074 }
1075 }
1076
1077 if( m_jp.FillHist ) {
1078 for( auto& pair : m_matchMap ) {
1079 if( pair.second ) m_hists["nMatchedTruths"]->Fill( m_vertexingAlgorithmStep+2, pair.first->perp() );
1080 }
1081 }
1082
1083 std::string msg;
1084 for( const auto* trk : usedTracks ) { msg += Form("%ld, ", trk->index() ); }
1085
1086 ATH_MSG_DEBUG( " >> " << __FUNCTION__ << ": used tracks = " << msg );
1087 ATH_MSG_DEBUG( " >> " << __FUNCTION__ << ": ===============================================================" );
1088
1089 }
static const Attributes_t empty
std::map< const xAOD::TruthVertex *, bool > m_matchMap
@ previous
Definition BinningData.h:32
std::pair< long int, long int > indices

◆ processPrimaryVertices()

StatusCode VKalVrtAthena::VrtSecInclusive::processPrimaryVertices ( )
private

Definition at line 825 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

825 {
826
827 //--------------------------------------------------------
828 // Primary vertex extraction from TES
829 //
830
831 ATH_CHECK( evtStore()->retrieve( m_primaryVertices, "PrimaryVertices") );
832
833 if( m_jp.FillNtuple ) m_ntupleVars->get<unsigned int>( "NumPV" ) = 0;
834 m_thePV = nullptr;
835
836 ATH_MSG_DEBUG( "processPrimaryVertices(): pv_size = " << m_primaryVertices->size() );
837
838 // Loop over PV container and get number of tracks of each PV
839
840 for( const auto *vertex : *m_primaryVertices ) {
841
842 // Hide (2015-04-21): xAOD::Vertex may contain several types of vertices
843 // e.g. if VertexType==NoVtx, this is a dummy vertex.
844 // We only need to extract primary vertices here, and skip otherwise.
845
846 if( xAOD::VxType::PriVtx != vertex->vertexType() ) continue;
847
848 // Not considering pile-up; pick-up the first PV
849 m_thePV = vertex;
850
851 if( m_jp.FillNtuple ) {
852
853 if( 0 == m_ntupleVars->get<unsigned int>( "NumPV" ) ) {
854
855 m_ntupleVars->get<double>( "PVX" ) = vertex->x();
856 m_ntupleVars->get<double>( "PVY" ) = vertex->y();
857 m_ntupleVars->get<double>( "PVZ" ) = vertex->z();
858 m_ntupleVars->get<unsigned int>( "PVType" ) = vertex->vertexType();
859
860 // number of tracks associated to the PV
861 m_ntupleVars->get<unsigned int>( "NTrksPV" ) = vertex->nTrackParticles();
862 }
863
864 m_ntupleVars->get<unsigned int>( "NumPV" )++;
865
866 m_ntupleVars->get< vector<int> > ( "NdofTrksPV" ) .emplace_back( vertex->numberDoF() );
867 m_ntupleVars->get< vector<double> >( "PVZpile" ) .emplace_back( vertex->position().z() );
868 }
869
870 ATH_MSG_DEBUG("PrimVertex x/y/z/nDOF "
871 << vertex->x() << ","
872 << vertex->y() << ","
873 << vertex->z() << ","
874 << vertex->numberDoF() );
875
876 }
877
878 // Use the dummy PV if no PV is composed
879 if( !m_thePV ) {
880 ATH_MSG_DEBUG("No Reconstructed PV was found. Using the dummy PV instead.");
881 for( const auto *vertex : *m_primaryVertices ) {
882 if( xAOD::VxType::NoVtx != vertex->vertexType() ) continue;
883
884 if( m_jp.FillNtuple ) {
885 // Not considering pile-up; pick-up the first PV
886 if( 0 == m_ntupleVars->get<unsigned int>( "NumPV" ) ) {
887 m_thePV = vertex;
888
889 m_ntupleVars->get<double>( "PVX" ) = vertex->x();
890 m_ntupleVars->get<double>( "PVY" ) = vertex->y();
891 m_ntupleVars->get<double>( "PVZ" ) = vertex->z();
892 m_ntupleVars->get<unsigned int>( "PVType" ) = vertex->vertexType();
893
894 // number of tracks associated to the PV
895 m_ntupleVars->get<unsigned int>( "NTrksPV" ) = vertex->nTrackParticles();
896 }
897 }
898 }
899 }
900
901 // if thePV is null, the PV is not found.
902 if( !m_thePV ) {
903 ATH_MSG_DEBUG("No PV is found in the PV collection!");
904 return StatusCode::FAILURE;
905 }
906
907 ATH_MSG_DEBUG(" Primary vertex successful. thePV = " << m_thePV );
908
909 return StatusCode::SUCCESS;
910 }
@ PriVtx
Primary vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.

◆ rearrangeTracks()

StatusCode VKalVrtAthena::VrtSecInclusive::rearrangeTracks ( std::vector< WrkVrt > * workVerticesContainer)
private

Definition at line 754 of file VertexingAlgs.cxx.

755 {
756 if(m_jp.doDisappearingTrackVertexing){
757 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": skip");
758 return StatusCode::SUCCESS;
759 }
760 //
761 // Rearrangement of solutions
762 //
763
764 std::vector<long int> processedTracks;
765
766 unsigned mergeCounter { 0 };
767 unsigned brokenCounter { 0 };
768 unsigned removeTrackCounter { 0 };
769
770 while( true ) {
771
772 // worstChi2: unit in [chi2 per track]
773 long int maxSharedTrack;
774 long int worstMatchingVertex;
775 std::pair<unsigned, unsigned> indexPair { AlgConsts::invalidUnsigned, AlgConsts::invalidUnsigned };
776
777
778 // trackToVertexMap has IDs of each track which can contain array of vertices.
779 // e.g. TrkInVrt->at( track_id ).size() gives the number of vertices which use the track [track_id].
780
781 std::map<long int, std::vector<long int> > trackToVertexMap;
782
783 // Fill trackToVertexMap with vertex IDs of each track
784 trackClassification( workVerticesContainer, trackToVertexMap );
785
786
787 auto worstChi2 = findWorstChi2ofMaximallySharedTrack( workVerticesContainer, trackToVertexMap, maxSharedTrack, worstMatchingVertex );
788
789 if( worstChi2 == AlgConsts::invalidFloat ) {
790 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": no shared tracks are found --> exit the while loop." );
791 break;
792 }
793
794 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": vertex [" << worstMatchingVertex << "]: maximally shared track index = " << maxSharedTrack
795 << ", multiplicity = " << trackToVertexMap.at( maxSharedTrack ).size()
796 << ", worst chi2_trk = " << worstChi2 );
797
798 //Choice of action
799 if( worstChi2 < m_jp.TrackDetachCut ) {
800
801 // Here, the max-shared track is well-associated and cannot be detached.
802 // The closest vertex should be merged.
803
804 std::vector< std::pair<unsigned, unsigned> > badPairs;
805
806 while( true ) {
807
808 // find the closest vertices pair that share the track of interest
809 double minSignificance { AlgConsts::maxValue };
810 unsigned nShared { 0 };
811
812 {
813 auto& vrtList = trackToVertexMap.at( maxSharedTrack );
814
815 auto nGood = std::count_if( vrtList.begin(), vrtList.end(), [&]( auto& v ) { return workVerticesContainer->at(v).isGood; } );
816 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": size of good vertices = " << nGood );
817
818 std::vector< std::tuple< std::pair<unsigned, unsigned>, double, unsigned> > significanceTuple;
819 enum { kIndexPair, kSignificance, kNshared };
820
821 for( auto ivrt = vrtList.begin(); ivrt != vrtList.end(); ++ivrt ) {
822 for( auto jvrt = std::next( ivrt ); jvrt != vrtList.end(); ++jvrt ) {
823 auto pair = std::pair<unsigned, unsigned>( *ivrt, *jvrt );
824
825 if( !( workVerticesContainer->at(*ivrt).isGood ) ) continue;
826 if( !( workVerticesContainer->at(*jvrt).isGood ) ) continue;
827
828 // skip known bad pairs
829 if( std::find( badPairs.begin(), badPairs.end(), pair ) != badPairs.end() ) continue;
830
831 auto signif = significanceBetweenVertices( workVerticesContainer->at( *ivrt ), workVerticesContainer->at( *jvrt ) );
832
833 auto& ivrtTrks = workVerticesContainer->at(*ivrt).selectedTrackIndices;
834 auto& jvrtTrks = workVerticesContainer->at(*jvrt).selectedTrackIndices;
835
836 auto nSharedTracks = std::count_if( ivrtTrks.begin(), ivrtTrks.end(),
837 [&]( auto& index ) {
838 return std::find( jvrtTrks.begin(), jvrtTrks.end(), index ) != jvrtTrks.end();
839 } );
840
841 significanceTuple.emplace_back( pair, signif, nSharedTracks );
842 }
843 }
844
845 if( significanceTuple.empty() ) {
846 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": no vertex pairs are found --> exit the while loop." );
847 break;
848 }
849
850 auto minSignificanceTuple = std::min_element( significanceTuple.begin(), significanceTuple.end(), [&]( auto& t1, auto&t2 ) { return std::get<kSignificance>(t1) < std::get<kSignificance>(t2); } );
851
852 indexPair = std::get<kIndexPair> ( *minSignificanceTuple );
853 minSignificance = std::get<kSignificance> ( *minSignificanceTuple );
854 nShared = std::get<kNshared> ( *minSignificanceTuple );
855 }
856
857 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": minSignificance = " << minSignificance );
858
859 if( minSignificance < m_jp.VertexMergeCut || nShared >= 2 ) {
860
861 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": attempt to merge vertices " << indexPair.first << " and " << indexPair.second );
862
863 WrkVrt vertex_backup1 = workVerticesContainer->at( indexPair.first );
864 WrkVrt vertex_backup2 = workVerticesContainer->at( indexPair.second );
865
866 StatusCode sc = mergeVertices( workVerticesContainer->at( indexPair.first ), workVerticesContainer->at( indexPair.second ) );
867
868 if( m_jp.FillHist ) { m_hists["mergeType"]->Fill( RECONSTRUCT_NTRK ); }
869
870 if( sc.isFailure() ) {
871 // revert to the original
872 workVerticesContainer->at( indexPair.first ) = vertex_backup1;
873 workVerticesContainer->at( indexPair.second ) = vertex_backup2;
874 badPairs.emplace_back( indexPair );
875 }
876
877 // The second vertex is merged to the first.
878 // Explicity flag the second vertex is invalid.
879 workVerticesContainer->at( indexPair.second ).isGood = false;
880
881 // Now the vertex is merged and the bad pair record is outdated.
882 badPairs.clear();
883
884 mergeCounter++;
885
886 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Merged vertices " << indexPair.first << " and " << indexPair.second << ". merged vertex multiplicity = " << workVerticesContainer->at( indexPair.first ).selectedTrackIndices.size() );
887
888 } else {
889
890 // Here, the significance between closest vertices sharing the track is sufficiently distant
891 // and cannot be merged, while the track-association chi2 is small as well.
892 // In order to resolve the ambiguity anyway, remove the track from the worst-associated vertex.
893
894 auto& wrkvrt = workVerticesContainer->at( worstMatchingVertex );
895
896 auto end = std::remove_if( wrkvrt.selectedTrackIndices.begin(), wrkvrt.selectedTrackIndices.end(), [&]( auto& index ) { return index == maxSharedTrack; } );
897 wrkvrt.selectedTrackIndices.erase( end, wrkvrt.selectedTrackIndices.end() );
898
899 removeTrackCounter++;
900
901 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": removed track " << maxSharedTrack << " from vertex " << worstMatchingVertex );
902
903 if( wrkvrt.selectedTrackIndices.size() < 2 ) {
904 wrkvrt.isGood = false;
905 brokenCounter++;
906 break;
907 }
908
909 StatusCode sc = refitVertex( wrkvrt );
910 if( sc.isFailure() ) {
911 ATH_MSG_WARNING(" > " << __FUNCTION__ << ": detected vertex fitting failure!" );
912 }
913
914 break;
915
916 }
917 }
918
919 } else {
920
921 // Here, a bad track association is detected
922 // The track is detached from the worst-associated vertex and refit.
923
924 auto& wrkvrt = workVerticesContainer->at( worstMatchingVertex );
925
926 auto end = std::remove_if( wrkvrt.selectedTrackIndices.begin(), wrkvrt.selectedTrackIndices.end(), [&]( auto& index ) { return index == maxSharedTrack; } );
927 wrkvrt.selectedTrackIndices.erase( end, wrkvrt.selectedTrackIndices.end() );
928
929 if( wrkvrt.nTracksTotal() >=2 ) {
930
931 auto wrkvrt_backup = wrkvrt;
932 StatusCode sc = refitVertex( wrkvrt );
933 if( sc.isFailure() ) {
934 ATH_MSG_WARNING(" > " << __FUNCTION__ << ": detected vertex fitting failure!" );
935 wrkvrt = wrkvrt_backup;
936 }
937
938 } else {
939 wrkvrt.isGood = false;
940 brokenCounter++;
941 }
942
943 removeTrackCounter++;
944
945 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": removed track " << maxSharedTrack << " from vertex " << worstMatchingVertex );
946
947 }
948
949 }
950
951 //
952 // Try to improve vertices with big Chi2
953 for( auto& wrkvrt : *workVerticesContainer ) {
954
955 if(!wrkvrt.isGood ) continue; //don't work on wrkvrt which is already bad
956 if( wrkvrt.selectedTrackIndices.size() < 3 ) continue;
957
958 WrkVrt backup = wrkvrt;
959 improveVertexChi2( wrkvrt );
960 if( wrkvrt.fitQuality() > backup.fitQuality() ) wrkvrt = backup;
961
962 if( wrkvrt.nTracksTotal() < 2 ) wrkvrt.isGood = false;
963
964 }
965
966 if( m_jp.FillNtuple ) {
967 m_ntupleVars->get<unsigned int>( "NumRearrSecVrt" )=workVerticesContainer->size();
968 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Size of Solution Set: "<< m_ntupleVars->get<unsigned int>( "NumRearrSecVrt" ));
969 }
970
971 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
972 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Number of merges = " << mergeCounter << ", Number of track removal = " << removeTrackCounter << ", broken vertices = " << brokenCounter );
973 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
974
975 return StatusCode::SUCCESS;
976 }
void trackClassification(std::vector< WrkVrt > *, std::map< long int, std::vector< long int > > &)
double findWorstChi2ofMaximallySharedTrack(std::vector< WrkVrt > *, std::map< long int, std::vector< long int > > &, long int &, long int &)
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.

◆ reassembleVertices()

StatusCode VKalVrtAthena::VrtSecInclusive::reassembleVertices ( std::vector< WrkVrt > * workVerticesContainer)
private

attempt to merge vertices when all tracks of a vertex A is close to vertex B in terms of impact parameter

Definition at line 980 of file VertexingAlgs.cxx.

981 {
982 // Here, the supposed issue is that, the position of the reconstructed vertex may be significantly
983 // displaced from its truth position, even if the constituent tracks are all from that truth.
984 // The fundamental reason of this is speculated that the VKalVrt vertex fitting could fall in
985 // a local minimum. This function attempts to improve the situation, given that N-track vertices
986 // are already reconstructed, by attempting to asociate a track of a small multiplicity vertex
987 // to another large multiplicity vertex.
988
989 unsigned reassembleCounter { 0 };
990
991 // First, sort WrkVrt by the track multiplicity
992 std::sort( workVerticesContainer->begin(), workVerticesContainer->end(), [](WrkVrt& v1, WrkVrt& v2) { return v1.selectedTrackIndices.size() < v2.selectedTrackIndices.size(); } );
993
994 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": #vertices = " << workVerticesContainer->size() );
995 // Loop over vertices (small -> large Ntrk order)
996 for( auto& wrkvrt : *workVerticesContainer ) {
997 if( !wrkvrt.isGood ) continue;
998 if( wrkvrt.selectedTrackIndices.size() <= 1 ) continue;
999
1000 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": vertex " << &wrkvrt << " #tracks = " << wrkvrt.selectedTrackIndices.size() );
1001 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": candidate vertex: "
1002 << " isGood = " << (wrkvrt.isGood? "true" : "false")
1003 << ", #ntrks = " << wrkvrt.nTracksTotal()
1004 << ", #selectedTracks = " << wrkvrt.selectedTrackIndices.size()
1005 << ", #associatedTracks = " << wrkvrt.associatedTrackIndices.size()
1006 << ", chi2/ndof = " << wrkvrt.fitQuality()
1007 << ", (r, z) = (" << wrkvrt.vertex.perp()
1008 <<", " << wrkvrt.vertex.z() << ")" );
1009
1010 std::map<unsigned, std::vector<WrkVrt>::reverse_iterator> mergiableVertex;
1011 std::set<std::vector<WrkVrt>::reverse_iterator> mergiableVerticesSet;
1012
1013 for( auto& index : wrkvrt.selectedTrackIndices ) {
1014
1015 const xAOD::TrackParticle* trk = m_selectedTracks.at( index );
1016
1017 mergiableVertex[index] = workVerticesContainer->rend();
1018
1019 std::vector<double> distances;
1020
1021 // Reverse iteration: large Ntrk -> small Ntrk order
1022 for( auto ritr = workVerticesContainer->rbegin(); ritr != workVerticesContainer->rend(); ++ritr ) {
1023 auto& targetVertex = *ritr;
1024
1025 if( &wrkvrt == &targetVertex ) continue;
1026 if( wrkvrt.selectedTrackIndices.size() >= targetVertex.selectedTrackIndices.size() ) continue;
1027
1028 // Get the closest approach
1029 std::vector<double> impactParameters;
1030 std::vector<double> impactParErrors;
1031
1032 if( !getSVImpactParameters(trk,targetVertex.vertex,impactParameters,impactParErrors) ) continue;
1033
1034 const auto& distance = hypot( impactParameters.at(0), impactParameters.at(1) );
1035 distances.emplace_back( distance );
1036
1037 if( std::abs( impactParameters.at(0) ) > m_jp.reassembleMaxImpactParameterD0 ) continue;
1038 if( std::abs( impactParameters.at(1) ) > m_jp.reassembleMaxImpactParameterZ0 ) continue;
1039
1040 mergiableVertex[index] = ritr;
1041 mergiableVerticesSet.emplace( ritr );
1042
1043 }
1044
1045 auto min_distance = !distances.empty() ? *(std::min_element( distances.begin(), distances.end() )) : AlgConsts::invalidFloat;
1046
1047 if( mergiableVertex[index] == workVerticesContainer->rend() ) {
1048 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": track " << trk << " --> none : min distance = " << min_distance );
1049 } else {
1050 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": track " << trk << " --> " << &( *(mergiableVertex[index]) ) << " --> size = " << mergiableVertex[index]->selectedTrackIndices.size() << ": min distance = " << min_distance );
1051 }
1052
1053 }
1054
1055 size_t count_mergiable = std::count_if( mergiableVertex.begin(), mergiableVertex.end(),
1056 [&](const std::pair<unsigned, std::vector<WrkVrt>::reverse_iterator>& p ) {
1057 return p.second != workVerticesContainer->rend(); } );
1058
1059 if( mergiableVerticesSet.size() == 1 && count_mergiable == wrkvrt.selectedTrackIndices.size() ) {
1060
1061 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": identified a unique association destination vertex" );
1062
1063 WrkVrt& destination = *( mergiableVertex.begin()->second );
1064 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": destination #tracks before merging = " << destination.selectedTrackIndices.size() );
1065
1066 StatusCode sc = mergeVertices( destination, wrkvrt );
1067 if( sc.isFailure() ) {
1068 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failure in vertex merging" );
1069 }
1070
1071 improveVertexChi2( destination );
1072
1073 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": merged destination vertex: "
1074 << " isGood = " << (destination.isGood? "true" : "false")
1075 << ", #ntrks = " << destination.nTracksTotal()
1076 << ", #selectedTracks = " << destination.selectedTrackIndices.size()
1077 << ", #associatedTracks = " << destination.associatedTrackIndices.size()
1078 << ", chi2/ndof = " << destination.fitQuality()
1079 << ", (r, z) = (" << destination.vertex.perp()
1080 <<", " << destination.vertex.z() << ")" );
1081
1082 if( m_jp.FillHist ) { m_hists["mergeType"]->Fill( REASSEMBLE ); }
1083
1084 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": destination #tracks after merging = " << destination.selectedTrackIndices.size() );
1085
1086 reassembleCounter++;
1087
1088 }
1089
1090 }
1091
1092 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1093 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": reassembled vertices = " << reassembleCounter );
1094 ATH_MSG_DEBUG(" > " << __FUNCTION__ << "----------------------------------------------" );
1095
1096 return StatusCode::SUCCESS;
1097 }

◆ refitAndSelectGoodQualityVertices()

StatusCode VKalVrtAthena::VrtSecInclusive::refitAndSelectGoodQualityVertices ( std::vector< WrkVrt > * workVerticesContainer)
private

finalization of the vertex and store to xAOD::VertexContainer

Definition at line 1514 of file VertexingAlgs.cxx.

1515 {
1516
1517 // Output SVs as xAOD::Vertex
1518 // Needs a conversion function from workVerticesContainer to xAOD::Vertex here.
1519 // The supposed form of the function will be as follows:
1520
1521 try {
1522
1523 xAOD::VertexContainer *secondaryVertexContainer( nullptr );
1524 ATH_CHECK( evtStore()->retrieve( secondaryVertexContainer, "VrtSecInclusive_" + m_jp.secondaryVerticesContainerName + m_jp.augVerString ) );
1525
1526 const xAOD::TrackParticleContainer* trackParticleContainer ( nullptr );
1527 ATH_CHECK( evtStore()->retrieve( trackParticleContainer, m_jp.TrackLocation) );
1528
1529 enum { kPt, kEta, kPhi, kD0, kZ0, kErrP, kErrD0, kErrZ0, kChi2SV };
1530 if( m_trkDecors.empty() ) {
1531 m_trkDecors.emplace( kPt, SG::AuxElement::Decorator<float>("pt_wrtSV" + m_jp.augVerString) );
1532 m_trkDecors.emplace( kEta, SG::AuxElement::Decorator<float>("eta_wrtSV" + m_jp.augVerString) );
1533 m_trkDecors.emplace( kPhi, SG::AuxElement::Decorator<float>("phi_wrtSV" + m_jp.augVerString) );
1534 m_trkDecors.emplace( kD0, SG::AuxElement::Decorator<float>("d0_wrtSV" + m_jp.augVerString) );
1535 m_trkDecors.emplace( kZ0, SG::AuxElement::Decorator<float>("z0_wrtSV" + m_jp.augVerString) );
1536 m_trkDecors.emplace( kErrP, SG::AuxElement::Decorator<float>("errP_wrtSV" + m_jp.augVerString) );
1537 m_trkDecors.emplace( kErrD0, SG::AuxElement::Decorator<float>("errd0_wrtSV" + m_jp.augVerString) );
1538 m_trkDecors.emplace( kErrZ0, SG::AuxElement::Decorator<float>("errz0_wrtSV" + m_jp.augVerString) );
1539 m_trkDecors.emplace( kChi2SV, SG::AuxElement::Decorator<float>("chi2_toSV" + m_jp.augVerString) );
1540 }
1541 if( !m_decor_is_svtrk_final ) {
1542 m_decor_is_svtrk_final.emplace ( "is_svtrk_final" + m_jp.augVerString );
1543 }
1544
1545 std::map<const WrkVrt*, const xAOD::Vertex*> wrkvrtLinkMap;
1546
1547 //----------------------------------------------------------
1548 const auto& ctx = Gaudi::Hive::currentContext();
1549
1550 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": input #vertices = " << workVerticesContainer->size() );
1551
1552 // Loop over vertices
1553 for( auto& wrkvrt : *workVerticesContainer ) {
1554
1555 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": candidate vertex: "
1556 << " isGood = " << (wrkvrt.isGood? "true" : "false")
1557 << ", #ntrks = " << wrkvrt.nTracksTotal()
1558 << ", #selectedTracks = " << wrkvrt.selectedTrackIndices.size()
1559 << ", #associatedTracks = " << wrkvrt.associatedTrackIndices.size()
1560 << ", chi2/ndof = " << wrkvrt.Chi2 / ( wrkvrt.ndof() + AlgConsts::infinitesimal )
1561 << ", (r, z) = (" << wrkvrt.vertex.perp()
1562 <<", " << wrkvrt.vertex.z() << ")" );
1563
1564 if( m_jp.FillHist ) m_hists["finalCutMonitor"]->Fill( 0 );
1565
1566 if( m_jp.removeFakeVrt && m_jp.removeFakeVrtLate ) {
1567 removeInconsistentTracks( wrkvrt );
1568 }
1569
1570 if( wrkvrt.nTracksTotal() < 2 ) {
1571 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": ntrk < 2 --> rejected." );
1572 continue; /* Bad vertices */
1573 }
1574
1575 if( m_jp.FillHist ) m_hists["finalCutMonitor"]->Fill( 1 );
1576
1577
1578 // Remove track if the vertex is inner than IBL and the track does not have pixel hits!
1579 if( wrkvrt.vertex.perp() < 31.0 ) {
1580
1581 // for selected tracks
1582 wrkvrt.selectedTrackIndices.erase( std::remove_if( wrkvrt.selectedTrackIndices.begin(), wrkvrt.selectedTrackIndices.end(),
1583 [&]( auto& index ) {
1584 auto* trk = m_selectedTracks.at( index );
1585 uint8_t nPixelHits { 0 }; trk->summaryValue( nPixelHits, xAOD::numberOfPixelHits );
1586 return ( nPixelHits < 3 );
1587 } ),
1588 wrkvrt.selectedTrackIndices.end() );
1589
1590 // for associated tracks
1591 wrkvrt.associatedTrackIndices.erase( std::remove_if( wrkvrt.associatedTrackIndices.begin(), wrkvrt.associatedTrackIndices.end(),
1592 [&]( auto& index ) {
1593 auto* trk = m_associatedTracks.at( index );
1594 uint8_t nPixelHits { 0 }; trk->summaryValue( nPixelHits, xAOD::numberOfPixelHits );
1595 return ( nPixelHits < 3 );
1596 } ),
1597 wrkvrt.associatedTrackIndices.end() );
1598
1599 auto statusCode = refitVertex( wrkvrt );
1600 if( statusCode.isFailure() ) {}
1601
1602 }
1603
1604
1605 if( m_jp.doFinalImproveChi2 ) {
1606
1607 WrkVrt backup = wrkvrt;
1608
1609 improveVertexChi2( wrkvrt );
1610
1611 if( wrkvrt.fitQuality() > backup.fitQuality() ) wrkvrt = backup;
1612
1613 }
1614
1615 // If the number of remaining tracks is less than 2, drop.
1616 if( wrkvrt.nTracksTotal() < 2 ) continue;
1617
1618 // Select only vertices with keeping more than 2 selectedTracks
1619 if( wrkvrt.selectedTrackIndices.size() < 2 ) continue;
1620
1621
1622 if( m_jp.FillHist ) m_hists["finalCutMonitor"]->Fill( 2 );
1623
1624
1625 {
1626 WrkVrt backup = wrkvrt;
1627
1628 StatusCode sc = refitVertex( wrkvrt );
1629 if( sc.isFailure() ) {
1630
1631 auto indices = wrkvrt.associatedTrackIndices;
1632
1633 wrkvrt.associatedTrackIndices.clear();
1634 sc = refitVertex( wrkvrt );
1635 if( sc.isFailure() ) {
1636 ATH_MSG_WARNING(" > " << __FUNCTION__ << ": detected vertex fitting failure!" );
1637 wrkvrt = backup;
1638 }
1639 if( wrkvrt.fitQuality() > backup.fitQuality() ) wrkvrt = backup;
1640
1641 for( auto& index : indices ) {
1642 backup = wrkvrt;
1643 wrkvrt.associatedTrackIndices.emplace_back( index );
1644 sc = refitVertex( wrkvrt );
1645 if( sc.isFailure() || TMath::Prob( wrkvrt.Chi2, wrkvrt.ndof() ) < m_jp.improveChi2ProbThreshold ) {
1646 ATH_MSG_WARNING(" > " << __FUNCTION__ << ": detected vertex fitting failure!" );
1647 wrkvrt = backup;
1648 continue;
1649 }
1650 }
1651
1652 } else {
1653 if( wrkvrt.fitQuality() > backup.fitQuality() ) wrkvrt = backup;
1654 }
1655 }
1656
1657 if( m_jp.FillHist ) m_hists["finalCutMonitor"]->Fill( 3 );
1658
1659 //
1660 // Store good vertices into StoreGate
1661 //
1662 if( m_jp.FillNtuple ) m_ntupleVars->get<unsigned int>( "NumSecVrt" )++;
1663
1664 TLorentzVector sumP4_pion;
1665 TLorentzVector sumP4_electron;
1666 TLorentzVector sumP4_proton;
1667
1668 // Pre-check before storing vertex if the SV perigee is available
1669 bool good_flag = true;
1670
1671 std::map<const std::deque<long int>*, const std::vector<const xAOD::TrackParticle*>&> indicesSet
1672 = {
1673 { &(wrkvrt.selectedTrackIndices), m_selectedTracks },
1674 { &(wrkvrt.associatedTrackIndices), m_associatedTracks }
1675 };
1676
1677 for( auto& pair : indicesSet ) {
1678
1679 const auto* indices = pair.first;
1680 const auto& tracks = pair.second;
1681
1682 for( const auto& itrk : *indices ) {
1683 const auto* trk = tracks.at( itrk );
1684 auto sv_perigee = m_trackToVertexTool->perigeeAtVertex(ctx, *trk, wrkvrt.vertex );
1685 if( !sv_perigee ) {
1686 ATH_MSG_INFO(" > " << __FUNCTION__ << ": > Track index " << trk->index() << ": Failed in obtaining the SV perigee!" );
1687 good_flag = false;
1688 }
1689 }
1690
1691 }
1692
1693 if( !good_flag ) {
1694 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": sv perigee could not be obtained --> rejected" );
1695 continue;
1696 }
1697
1698 if( m_jp.FillHist ) m_hists["finalCutMonitor"]->Fill( 4 );
1699
1700
1701 std::vector<const xAOD::TrackParticle*> tracks;
1702 std::vector< std::pair<const xAOD::TrackParticle*, double> > trackChi2Pairs;
1703
1704 {
1705
1706 for( auto& pair : indicesSet ) {
1707 for( const auto& index : *pair.first ) tracks.emplace_back( pair.second.at( index ) );
1708 }
1709
1710 auto trkitr = tracks.begin();
1711 auto chi2itr = wrkvrt.Chi2PerTrk.begin();
1712
1713 for( ; ( trkitr!=tracks.end() && chi2itr!=wrkvrt.Chi2PerTrk.end() ); ++trkitr, ++chi2itr ) {
1714 trackChi2Pairs.emplace_back( *trkitr, *chi2itr );
1715 }
1716
1717 }
1718
1719
1720 TLorentzVector sumP4_selected;
1721
1722 bool badIPflag { false };
1723
1724 // loop over vertex tracks
1725 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Track loop: size = " << tracks.size() );
1726 for( auto& pair : trackChi2Pairs ) {
1727
1728 const auto* trk = pair.first;
1729 const auto& chi2AtSV = pair.second;
1730
1731 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": > Track index " << trk->index() << ": start." );
1732
1733 track_summary trk_summary;
1734 fillTrackSummary( trk_summary, trk );
1735
1736 //
1737 // calculate mass/pT of tracks and track parameters
1738 //
1739
1740 double trk_pt = trk->pt();
1741 double trk_eta = trk->eta();
1742 double trk_phi = trk->phi();
1743
1744 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": > Track index " << trk->index() << ": in vrt chg/pt/phi/eta = "
1745 << trk->charge() <<","
1746 <<trk_pt<<","
1747 <<trk_phi<<","
1748 <<trk_eta);
1749
1751 // Get the perigee of the track at the vertex
1752 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": > Track index " << trk->index() << ": Get the prigee of the track at the vertex." );
1753
1754 auto sv_perigee = m_trackToVertexTool->perigeeAtVertex(ctx, *trk, wrkvrt.vertex );
1755 if( !sv_perigee ) {
1756 ATH_MSG_WARNING(" > " << __FUNCTION__ << ": > Track index " << trk->index() << ": Failed in obtaining the SV perigee!" );
1757
1758 for( auto& pair : m_trkDecors ) {
1759 pair.second( *trk ) = AlgConsts::invalidFloat;
1760 }
1761 (*m_decor_is_svtrk_final)( *trk ) = true;
1762 continue;
1763 }
1764
1765 double qOverP_wrtSV = sv_perigee->parameters() [Trk::qOverP];
1766 double theta_wrtSV = sv_perigee->parameters() [Trk::theta];
1767 double p_wrtSV = 1.0 / std::abs( qOverP_wrtSV );
1768 double pt_wrtSV = p_wrtSV * sin( theta_wrtSV );
1769 double eta_wrtSV = -log( tan( theta_wrtSV/2. ) );
1770 double phi_wrtSV = sv_perigee->parameters() [Trk::phi];
1771 double d0_wrtSV = sv_perigee->parameters() [Trk::d0];
1772 double z0_wrtSV = sv_perigee->parameters() [Trk::z0];
1773 double errd0_wrtSV = (*sv_perigee->covariance())( Trk::d0, Trk::d0 );
1774 double errz0_wrtSV = (*sv_perigee->covariance())( Trk::z0, Trk::z0 );
1775 double errP_wrtSV = (*sv_perigee->covariance())( Trk::qOverP, Trk::qOverP );
1776
1777 // xAOD::Track augmentation
1778 ( m_trkDecors.at(kPt) )( *trk ) = pt_wrtSV;
1779 ( m_trkDecors.at(kEta) )( *trk ) = eta_wrtSV;
1780 ( m_trkDecors.at(kPhi) )( *trk ) = phi_wrtSV;
1781 ( m_trkDecors.at(kD0) )( *trk ) = d0_wrtSV;
1782 ( m_trkDecors.at(kZ0) )( *trk ) = z0_wrtSV;
1783 ( m_trkDecors.at(kErrP) )( *trk ) = errP_wrtSV;
1784 ( m_trkDecors.at(kErrD0) )( *trk ) = errd0_wrtSV;
1785 ( m_trkDecors.at(kErrZ0) )( *trk ) = errz0_wrtSV;
1786 ( m_trkDecors.at(kChi2SV))( *trk ) = chi2AtSV;
1787
1788 (*m_decor_is_svtrk_final)( *trk ) = true;
1789
1790 TLorentzVector p4wrtSV_pion;
1791 TLorentzVector p4wrtSV_electron;
1792 TLorentzVector p4wrtSV_proton;
1793
1794 p4wrtSV_pion .SetPtEtaPhiM( pt_wrtSV, eta_wrtSV, phi_wrtSV, PhysConsts::mass_chargedPion );
1795 p4wrtSV_electron.SetPtEtaPhiM( pt_wrtSV, eta_wrtSV, phi_wrtSV, PhysConsts::mass_electron );
1796
1797 // for selected tracks only
1798 static const SG::ConstAccessor<char> is_associatedAcc("is_associated" + m_jp.augVerString);
1799 if( is_associatedAcc.isAvailable(*trk) ) {
1800 if( !is_associatedAcc(*trk) ) {
1801 sumP4_selected += p4wrtSV_pion;
1802 }
1803 } else {
1804 sumP4_selected += p4wrtSV_pion;
1805 }
1806
1807 sumP4_pion += p4wrtSV_pion;
1808 sumP4_electron += p4wrtSV_electron;
1809 sumP4_proton += p4wrtSV_proton;
1810
1811 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": > Track index " << trk->index() << ": end." );
1812 } // loop over tracks in vertex
1813
1814 ATH_MSG_VERBOSE(" > " << __FUNCTION__ << ": Track loop end. ");
1815
1816 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Final Sec.Vertex=" << wrkvrt.nTracksTotal() <<", "
1817 <<wrkvrt.vertex.perp() <<", "<<wrkvrt.vertex.z() <<", "
1818 <<wrkvrt.vertex.phi() <<", mass = "<< sumP4_pion.M() << "," << sumP4_electron.M() );
1819
1820 // Save the perigee parameters for the first two tracks
1821 float perigee_x_trk1 = 0.0;
1822 float perigee_y_trk1 = 0.0;
1823 float perigee_z_trk1 = 0.0;
1824 float perigee_x_trk2 = 0.0;
1825 float perigee_y_trk2 = 0.0;
1826 float perigee_z_trk2 = 0.0;
1827 float perigee_px_trk1 = 0.0;
1828 float perigee_py_trk1 = 0.0;
1829 float perigee_pz_trk1 = 0.0;
1830 float perigee_px_trk2 = 0.0;
1831 float perigee_py_trk2 = 0.0;
1832 float perigee_pz_trk2 = 0.0;
1833 float perigee_cov_xx_trk1 = 0.0;
1834 float perigee_cov_xy_trk1 = 0.0;
1835 float perigee_cov_xz_trk1 = 0.0;
1836 float perigee_cov_yy_trk1 = 0.0;
1837 float perigee_cov_yz_trk1 = 0.0;
1838 float perigee_cov_zz_trk1 = 0.0;
1839 float perigee_cov_xx_trk2 = 0.0;
1840 float perigee_cov_xy_trk2 = 0.0;
1841 float perigee_cov_xz_trk2 = 0.0;
1842 float perigee_cov_yy_trk2 = 0.0;
1843 float perigee_cov_yz_trk2 = 0.0;
1844 float perigee_cov_zz_trk2 = 0.0;
1845 float perigee_d0_trk1 = 0.0;
1846 float perigee_d0_trk2 = 0.0;
1847 float perigee_z0_trk1 = 0.0;
1848 float perigee_z0_trk2 = 0.0;
1849 float perigee_qOverP_trk1 = 0.0;
1850 float perigee_qOverP_trk2 = 0.0;
1851 float perigee_theta_trk1 = 0.0;
1852 float perigee_theta_trk2 = 0.0;
1853 float perigee_phi_trk1 = 0.0;
1854 float perigee_phi_trk2 = 0.0;
1855 int perigee_charge_trk1 = 0;
1856 int perigee_charge_trk2 = 0;
1857 float perigee_distance = 9999.0;
1858
1859 Amg::Vector3D vDist = wrkvrt.vertex - m_thePV->position();
1860 float vPos = (vDist.x() * wrkvrt.vertexMom.Px() + vDist.y() * wrkvrt.vertexMom.Py() + vDist.z() * wrkvrt.vertexMom.Pz()) / wrkvrt.vertexMom.Rho();
1861 float vPosMomAngT = (vDist.x() * wrkvrt.vertexMom.Px() + vDist.y() * wrkvrt.vertexMom.Py()) / vDist.perp() / wrkvrt.vertexMom.Pt();
1862 float vPosMomAng3D = (vDist.x() * wrkvrt.vertexMom.Px() + vDist.y() * wrkvrt.vertexMom.Py() + vDist.z() * wrkvrt.vertexMom.Pz()) / (vDist.norm() * wrkvrt.vertexMom.Rho());
1863 float dphi_trk1 = 0.0;
1864 float dphi_trk2 = 0.0;
1865
1866 if (m_jp.doDisappearingTrackVertexing){
1867 // Process track1
1868 const auto* track1 = trackChi2Pairs[0].first;
1869 dphi_trk1 = TVector2::Phi_mpi_pi(vDist.phi() - track1->phi());
1870 auto sv_perigee1 = m_trackToVertexTool->perigeeAtVertex(ctx, *track1, wrkvrt.vertex);
1871 if (sv_perigee1) {
1872 perigee_x_trk1 = sv_perigee1->position().x();
1873 perigee_y_trk1 = sv_perigee1->position().y();
1874 perigee_z_trk1 = sv_perigee1->position().z();
1875 perigee_px_trk1 = sv_perigee1->momentum().x();
1876 perigee_py_trk1 = sv_perigee1->momentum().y();
1877 perigee_pz_trk1 = sv_perigee1->momentum().z();
1878 perigee_cov_xx_trk1 = (*sv_perigee1->covariance())(0, 0);
1879 perigee_cov_xy_trk1 = (*sv_perigee1->covariance())(0, 1);
1880 perigee_cov_xz_trk1 = (*sv_perigee1->covariance())(0, 2);
1881 perigee_cov_yy_trk1 = (*sv_perigee1->covariance())(1, 1);
1882 perigee_cov_yz_trk1 = (*sv_perigee1->covariance())(1, 2);
1883 perigee_cov_zz_trk1 = (*sv_perigee1->covariance())(2, 2);
1884 perigee_d0_trk1 = sv_perigee1->parameters()[Trk::d0];
1885 perigee_z0_trk1 = sv_perigee1->parameters()[Trk::z0];
1886 perigee_qOverP_trk1 = sv_perigee1->parameters()[Trk::qOverP];
1887 perigee_theta_trk1 = sv_perigee1->parameters()[Trk::theta];
1888 perigee_phi_trk1 = sv_perigee1->parameters()[Trk::phi];
1889 perigee_charge_trk1 = sv_perigee1->parameters()[Trk::qOverP] > 0 ? 1 : -1;
1890 }else{
1891 ATH_MSG_DEBUG("Failed to obtain perigee for track1 at vertex.");
1892 }
1893
1894 //Process track2
1895 const auto* track2 = trackChi2Pairs[1].first;
1896 dphi_trk2 = TVector2::Phi_mpi_pi(vDist.phi() - track2->phi());
1897 auto sv_perigee2 = m_trackToVertexTool->perigeeAtVertex(ctx, *track2, wrkvrt.vertex);
1898 if (sv_perigee2) {
1899 perigee_x_trk2 = sv_perigee2->position().x();
1900 perigee_y_trk2 = sv_perigee2->position().y();
1901 perigee_z_trk2 = sv_perigee2->position().z();
1902 perigee_px_trk2 = sv_perigee2->momentum().x();
1903 perigee_py_trk2 = sv_perigee2->momentum().y();
1904 perigee_pz_trk2 = sv_perigee2->momentum().z();
1905 perigee_cov_xx_trk2 = (*sv_perigee2->covariance())(0, 0);
1906 perigee_cov_xy_trk2 = (*sv_perigee2->covariance())(0, 1);
1907 perigee_cov_xz_trk2 = (*sv_perigee2->covariance())(0, 2);
1908 perigee_cov_yy_trk2 = (*sv_perigee2->covariance())(1, 1);
1909 perigee_cov_yz_trk2 = (*sv_perigee2->covariance())(1, 2);
1910 perigee_cov_zz_trk2 = (*sv_perigee2->covariance())(2, 2);
1911 perigee_d0_trk2 = sv_perigee2->parameters()[Trk::d0];
1912 perigee_z0_trk2 = sv_perigee2->parameters()[Trk::z0];
1913 perigee_qOverP_trk2 = sv_perigee2->parameters()[Trk::qOverP];
1914 perigee_theta_trk2 = sv_perigee2->parameters()[Trk::theta];
1915 perigee_phi_trk2 = sv_perigee2->parameters()[Trk::phi];
1916 perigee_charge_trk2 = sv_perigee2->parameters()[Trk::qOverP] > 0 ? 1 : -1;
1917 }else{
1918 ATH_MSG_DEBUG("Failed to obtain perigee for track2 at vertex.");
1919 }
1920
1921 if(sv_perigee1 && sv_perigee2){
1922 perigee_distance = sqrt(
1923 (perigee_x_trk1 - perigee_x_trk2) * (perigee_x_trk1 - perigee_x_trk2) +
1924 (perigee_y_trk1 - perigee_y_trk2) * (perigee_y_trk1 - perigee_y_trk2) +
1925 (perigee_z_trk1 - perigee_z_trk2) * (perigee_z_trk1 - perigee_z_trk2)
1926 );
1927 }
1928 if(perigee_distance > m_jp.twoTrVrtMaxPerigeeDist) continue;
1929 }
1930
1931 //
1932 // calculate opening angle between all 2-track pairs, and store the minimum
1933 //
1934 double minOpAng = AlgConsts::invalidFloat;
1935 std::vector<double> opAngles;
1936
1937 for( auto itr1 = tracks.begin(); itr1 != tracks.end(); ++itr1 ) {
1938 for( auto itr2 = std::next( itr1 ); itr2 != tracks.end(); ++itr2 ) {
1939 const auto& p1 = (*itr1)->p4().Vect();
1940 const auto& p2 = (*itr2)->p4().Vect();
1941 auto cos = p1 * p2 / p1.Mag() / p2.Mag();
1942 opAngles.emplace_back( cos );
1943 }
1944 }
1945 minOpAng = *( std::max_element( opAngles.begin(), opAngles.end() ) );
1946 if( m_jp.FillNtuple ) m_ntupleVars->get< vector<double> >( "SecVtx_MinOpAng" ).emplace_back(minOpAng);
1947
1948
1949 if( m_jp.FillHist ) m_hists["finalCutMonitor"]->Fill( 5 );
1950
1951 if( badIPflag ) {
1952 ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": Bad impact parameter signif wrt SV was flagged." );
1953 }
1954
1955 if (m_jp.doRemoveNonLeptonVertices) {
1956
1957 bool oneLepMatchTrack = false;
1958 for (const auto *trk: tracks) {
1959 if ( std::find(m_leptonicTracks.begin(), m_leptonicTracks.end(), trk) != m_leptonicTracks.end() ) {
1960 oneLepMatchTrack = true;
1961 break;
1962 }
1963 }
1964
1965 // If there are no tracks matched to leptons, do not save the container to the output.
1966 if (!oneLepMatchTrack) continue;
1967 }
1968
1970 // Data filling to xAOD container
1971
1972 wrkvrt.isGood = true;
1973
1974 // Firstly store the new vertex to the container before filling properties.
1975 // (This is the feature of xAOD.)
1977 secondaryVertexContainer->emplace_back( vertex );
1978
1979 // Registering the vertex position to xAOD::Vertex
1980 vertex->setPosition( wrkvrt.vertex );
1981
1982 // Registering the vertex type: SV
1983 vertex->setVertexType( xAOD::VxType::SecVtx );
1984
1985 // Registering the vertex chi2 and Ndof
1986 // Here, we register the core chi2 of the core (before track association)
1987 vertex->setFitQuality( wrkvrt.Chi2_core, wrkvrt.ndof_core() );
1988
1989 // Registering the vertex covariance matrix
1990 std::vector<float> fCov(wrkvrt.vertexCov.cbegin(), wrkvrt.vertexCov.cend());
1991 vertex->setCovariance(fCov);
1992
1993 // Registering the vertex momentum and charge
1994 static const SG::Accessor<float> vtx_pxAcc("vtx_px");
1995 static const SG::Accessor<float> vtx_pyAcc("vtx_py");
1996 static const SG::Accessor<float> vtx_pzAcc("vtx_pz");
1997 static const SG::Accessor<float> vtx_massAcc("vtx_mass");
1998 static const SG::Accessor<float> vtx_chargeAcc("vtx_charge");
1999 static const SG::Accessor<float> chi2_coreAcc("chi2_core");
2000 static const SG::Accessor<float> ndof_coreAcc("ndof_core");
2001 static const SG::Accessor<float> chi2_assocAcc("chi2_assoc");
2002 static const SG::Accessor<float> ndof_assocAcc("ndof_assoc");
2003 static const SG::Accessor<float> massAcc("mass");
2004 static const SG::Accessor<float> mass_eAcc("mass_e");
2005 static const SG::Accessor<float> mass_selectedTracksAcc("mass_selectedTracks");
2006 static const SG::Accessor<float> minOpAngAcc("minOpAng");
2007 static const SG::Accessor<int> num_trksAcc("num_trks");
2008 static const SG::Accessor<int> num_selectedTracksAcc("num_selectedTracks");
2009 static const SG::Accessor<int> num_associatedTracksAcc("num_associatedTracks");
2010 static const SG::Accessor<float> dCloseVrtAcc("dCloseVrt");
2011
2012 vtx_pxAcc(*vertex) = wrkvrt.vertexMom.Px();
2013 vtx_pyAcc(*vertex) = wrkvrt.vertexMom.Py();
2014 vtx_pzAcc(*vertex) = wrkvrt.vertexMom.Pz();
2015
2016 vtx_massAcc(*vertex) = wrkvrt.vertexMom.M();
2017 vtx_chargeAcc(*vertex) = wrkvrt.Charge;
2018
2019 chi2_coreAcc(*vertex) = wrkvrt.Chi2_core;
2020 ndof_coreAcc(*vertex) = wrkvrt.ndof_core();
2021 chi2_assocAcc(*vertex) = wrkvrt.Chi2;
2022 ndof_assocAcc(*vertex) = wrkvrt.ndof();
2023 // Other SV properties
2024 massAcc(*vertex) = sumP4_pion.M();
2025 mass_eAcc(*vertex) = sumP4_electron.M();
2026 mass_selectedTracksAcc(*vertex) = sumP4_selected.M();
2027 minOpAngAcc(*vertex) = minOpAng;
2028 num_trksAcc(*vertex) = wrkvrt.nTracksTotal();
2029 num_selectedTracksAcc(*vertex) = wrkvrt.selectedTrackIndices.size();
2030 num_associatedTracksAcc(*vertex) = wrkvrt.associatedTrackIndices.size();
2031 dCloseVrtAcc(*vertex) = wrkvrt.closestWrkVrtValue;
2032
2033 // Registering the vertex momentum and charge
2034 if (m_jp.doDisappearingTrackVertexing){
2035 static const SG::Accessor<float> perigee_x_trk1Acc("perigee_x_trk1");
2036 static const SG::Accessor<float> perigee_y_trk1Acc("perigee_y_trk1");
2037 static const SG::Accessor<float> perigee_z_trk1Acc("perigee_z_trk1");
2038 static const SG::Accessor<float> perigee_x_trk2Acc("perigee_x_trk2");
2039 static const SG::Accessor<float> perigee_y_trk2Acc("perigee_y_trk2");
2040 static const SG::Accessor<float> perigee_z_trk2Acc("perigee_z_trk2");
2041 static const SG::Accessor<float> perigee_px_trk1Acc("perigee_px_trk1");
2042 static const SG::Accessor<float> perigee_py_trk1Acc("perigee_py_trk1");
2043 static const SG::Accessor<float> perigee_pz_trk1Acc("perigee_pz_trk1");
2044 static const SG::Accessor<float> perigee_px_trk2Acc("perigee_px_trk2");
2045 static const SG::Accessor<float> perigee_py_trk2Acc("perigee_py_trk2");
2046 static const SG::Accessor<float> perigee_pz_trk2Acc("perigee_pz_trk2");
2047 static const SG::Accessor<float> perigee_cov_xx_trk1Acc("perigee_cov_xx_trk1");
2048 static const SG::Accessor<float> perigee_cov_xy_trk1Acc("perigee_cov_xy_trk1");
2049 static const SG::Accessor<float> perigee_cov_xz_trk1Acc("perigee_cov_xz_trk1");
2050 static const SG::Accessor<float> perigee_cov_yy_trk1Acc("perigee_cov_yy_trk1");
2051 static const SG::Accessor<float> perigee_cov_yz_trk1Acc("perigee_cov_yz_trk1");
2052 static const SG::Accessor<float> perigee_cov_zz_trk1Acc("perigee_cov_zz_trk1");
2053 static const SG::Accessor<float> perigee_cov_xx_trk2Acc("perigee_cov_xx_trk2");
2054 static const SG::Accessor<float> perigee_cov_xy_trk2Acc("perigee_cov_xy_trk2");
2055 static const SG::Accessor<float> perigee_cov_xz_trk2Acc("perigee_cov_xz_trk2");
2056 static const SG::Accessor<float> perigee_cov_yy_trk2Acc("perigee_cov_yy_trk2");
2057 static const SG::Accessor<float> perigee_cov_yz_trk2Acc("perigee_cov_yz_trk2");
2058 static const SG::Accessor<float> perigee_cov_zz_trk2Acc("perigee_cov_zz_trk2");
2059 static const SG::Accessor<float> perigee_d0_trk1Acc("perigee_d0_trk1");
2060 static const SG::Accessor<float> perigee_d0_trk2Acc("perigee_d0_trk2");
2061 static const SG::Accessor<float> perigee_z0_trk1Acc("perigee_z0_trk1");
2062 static const SG::Accessor<float> perigee_z0_trk2Acc("perigee_z0_trk2");
2063 static const SG::Accessor<float> perigee_qOverP_trk1Acc("perigee_qOverP_trk1");
2064 static const SG::Accessor<float> perigee_qOverP_trk2Acc("perigee_qOverP_trk2");
2065 static const SG::Accessor<float> perigee_theta_trk1Acc("perigee_theta_trk1");
2066 static const SG::Accessor<float> perigee_theta_trk2Acc("perigee_theta_trk2");
2067 static const SG::Accessor<float> perigee_phi_trk1Acc("perigee_phi_trk1");
2068 static const SG::Accessor<float> perigee_phi_trk2Acc("perigee_phi_trk2");
2069 static const SG::Accessor<int> perigee_charge_trk1Acc("perigee_charge_trk1");
2070 static const SG::Accessor<int> perigee_charge_trk2Acc("perigee_charge_trk2");
2071 static const SG::Accessor<float> vPosAcc("vPos");
2072 static const SG::Accessor<float> vPosMomAngTAcc("vPosMomAngT");
2073 static const SG::Accessor<float> vPosMomAng3DAcc("vPosMomAng3D");
2074 static const SG::Accessor<float> dphi_trk1Acc("dphi_trk1");
2075 static const SG::Accessor<float> dphi_trk2Acc("dphi_trk2");
2076 perigee_x_trk1Acc(*vertex) = perigee_x_trk1;
2077 perigee_y_trk1Acc(*vertex) = perigee_y_trk1;
2078 perigee_z_trk1Acc(*vertex) = perigee_z_trk1;
2079 perigee_x_trk2Acc(*vertex) = perigee_x_trk2;
2080 perigee_y_trk2Acc(*vertex) = perigee_y_trk2;
2081 perigee_z_trk2Acc(*vertex) = perigee_z_trk2;
2082 perigee_px_trk1Acc(*vertex) = perigee_px_trk1;
2083 perigee_py_trk1Acc(*vertex) = perigee_py_trk1;
2084 perigee_pz_trk1Acc(*vertex) = perigee_pz_trk1;
2085 perigee_px_trk2Acc(*vertex) = perigee_px_trk2;
2086 perigee_py_trk2Acc(*vertex) = perigee_py_trk2;
2087 perigee_pz_trk2Acc(*vertex) = perigee_pz_trk2;
2088 perigee_cov_xx_trk1Acc(*vertex) = perigee_cov_xx_trk1;
2089 perigee_cov_xy_trk1Acc(*vertex) = perigee_cov_xy_trk1;
2090 perigee_cov_xz_trk1Acc(*vertex) = perigee_cov_xz_trk1;
2091 perigee_cov_yy_trk1Acc(*vertex) = perigee_cov_yy_trk1;
2092 perigee_cov_yz_trk1Acc(*vertex) = perigee_cov_yz_trk1;
2093 perigee_cov_zz_trk1Acc(*vertex) = perigee_cov_zz_trk1;
2094 perigee_cov_xx_trk2Acc(*vertex) = perigee_cov_xx_trk2;
2095 perigee_cov_xy_trk2Acc(*vertex) = perigee_cov_xy_trk2;
2096 perigee_cov_xz_trk2Acc(*vertex) = perigee_cov_xz_trk2;
2097 perigee_cov_yy_trk2Acc(*vertex) = perigee_cov_yy_trk2;
2098 perigee_cov_yz_trk2Acc(*vertex) = perigee_cov_yz_trk2;
2099 perigee_cov_zz_trk2Acc(*vertex) = perigee_cov_zz_trk2;
2100 perigee_d0_trk1Acc(*vertex) = perigee_d0_trk1;
2101 perigee_d0_trk2Acc(*vertex) = perigee_d0_trk2;
2102 perigee_z0_trk1Acc(*vertex) = perigee_z0_trk1;
2103 perigee_z0_trk2Acc(*vertex) = perigee_z0_trk2;
2104 perigee_qOverP_trk1Acc(*vertex) = perigee_qOverP_trk1;
2105 perigee_qOverP_trk2Acc(*vertex) = perigee_qOverP_trk2;
2106 perigee_theta_trk1Acc(*vertex) = perigee_theta_trk1;
2107 perigee_theta_trk2Acc(*vertex) = perigee_theta_trk2;
2108 perigee_phi_trk1Acc(*vertex) = perigee_phi_trk1;
2109 perigee_phi_trk2Acc(*vertex) = perigee_phi_trk2;
2110 perigee_charge_trk1Acc(*vertex) = perigee_charge_trk1;
2111 perigee_charge_trk2Acc(*vertex) = perigee_charge_trk2;
2112 vPosAcc(*vertex) = vPos;
2113 vPosMomAngTAcc(*vertex) = vPosMomAngT;
2114 vPosMomAng3DAcc(*vertex) = vPosMomAng3D;
2115 dphi_trk1Acc(*vertex) = dphi_trk1;
2116 dphi_trk2Acc(*vertex) = dphi_trk2;
2117 }
2118
2119 // Registering tracks comprising the vertex to xAOD::Vertex
2120 // loop over the tracks comprising the vertex
2121 for( auto trk_id : wrkvrt.selectedTrackIndices ) {
2122
2123 const xAOD::TrackParticle *trk = m_selectedTracks.at( trk_id );
2124
2125 // Acquire link the track to the vertex
2126 ElementLink<xAOD::TrackParticleContainer> link_trk( *( dynamic_cast<const xAOD::TrackParticleContainer*>( trk->container() ) ), static_cast<long unsigned int>(trk->index()) );
2127
2128 // Register the link to the vertex
2129 vertex->addTrackAtVertex( link_trk, 1. );
2130
2131 }
2132
2133 for( auto trk_id : wrkvrt.associatedTrackIndices ) {
2134
2135 const xAOD::TrackParticle *trk = m_associatedTracks.at( trk_id );
2136
2137 // Acquire link the track to the vertex
2138 ElementLink<xAOD::TrackParticleContainer> link_trk( *( dynamic_cast<const xAOD::TrackParticleContainer*>( trk->container() ) ), static_cast<long unsigned int>(trk->index()) );
2139
2140 // Register the link to the vertex
2141 vertex->addTrackAtVertex( link_trk, 1. );
2142
2143 }
2144
2145
2146 if( m_jp.doMapToLocal ) {
2147 // Obtain the local mapping of the reconstructed vertex
2148 Trk::MappedVertex mappedVtx = m_vertexMapper->mapToLocal( wrkvrt.vertex );
2149 static const SG::Accessor<int> local_identifierHashAcc("local_identifierHash");
2150 static const SG::Accessor<int> local_layerIndexAcc("local_layerIndex");
2151 static const SG::Accessor<float> local_posXAcc("local_posX");
2152 static const SG::Accessor<float> local_posYAcc("local_posY");
2153 static const SG::Accessor<float> local_posZAcc("local_posZ");
2154 if( mappedVtx.valid ) {
2155 local_identifierHashAcc(*vertex) = mappedVtx.identifierHash;
2156 local_layerIndexAcc(*vertex) = mappedVtx.layerIndex;
2157 local_posXAcc(*vertex) = mappedVtx.localPosition.x();
2158 local_posYAcc(*vertex) = mappedVtx.localPosition.y();
2159 local_posZAcc(*vertex) = mappedVtx.localPosition.z();
2160 } else {
2161 local_identifierHashAcc(*vertex) = AlgConsts::invalidInt;
2162 local_layerIndexAcc(*vertex) = AlgConsts::invalidInt;
2163 local_posXAcc(*vertex) = AlgConsts::invalidFloat;
2164 local_posYAcc(*vertex) = AlgConsts::invalidFloat;
2165 local_posZAcc(*vertex) = AlgConsts::invalidFloat;
2166 }
2167 }
2168
2169
2170 // For MC, try to trace down to the truth particles,
2171 // and depending on the topology, categorize the label of the reconstructed vertex.
2172 if( m_jp.doTruth ) {
2174 }
2175
2176 // Keep the link between wrkvrt and vertex for later use
2177 wrkvrtLinkMap[&wrkvrt] = vertex;
2178
2179
2180 } // loop over vertices
2181
2182 if( m_jp.FillNtuple ) {
2183 ATH_CHECK( fillAANT_SecondaryVertices( secondaryVertexContainer ) );
2184 }
2185
2186
2187 // Post process -- Additional augmentations
2188 if( m_jp.doAugmentDVimpactParametersToMuons ) { ATH_CHECK( augmentDVimpactParametersToLeptons<xAOD::Muon> ( "Muons" ) ); }
2189 if( m_jp.doAugmentDVimpactParametersToElectrons ) { ATH_CHECK( augmentDVimpactParametersToLeptons<xAOD::Electron>( "Electrons" ) ); }
2190
2191 } catch (const std::out_of_range& e) {
2192
2193 ATH_MSG_WARNING( " > " << __FUNCTION__ << ": out of range error is detected: " << e.what() );
2194
2195 return StatusCode::SUCCESS;
2196
2197 } catch( ... ) {
2198
2199 ATH_MSG_WARNING( " > " << __FUNCTION__ << ": some other error is detected." );
2200
2201 return StatusCode::SUCCESS;
2202
2203 }
2204
2205 return StatusCode::SUCCESS;
2206 }
StatusCode categorizeVertexTruthTopology(xAOD::Vertex *vertex)
Definition TruthAlgs.cxx:44
void removeInconsistentTracks(WrkVrt &)
Remove inconsistent tracks from vertices.
StatusCode fillAANT_SecondaryVertices(xAOD::VertexContainer *)
Amg::Vector3D localPosition

◆ refitVertex() [1/2]

StatusCode VKalVrtAthena::VrtSecInclusive::refitVertex ( WrkVrt & workVertex)
private

refit the vertex.

Definition at line 496 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

497 {
498 std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState();
499 return refitVertex (workVertex, *state);
500 }

◆ refitVertex() [2/2]

StatusCode VKalVrtAthena::VrtSecInclusive::refitVertex ( WrkVrt & workVertex,
Trk::IVKalState & istate )
private

Definition at line 505 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

507 {
508
509 //
510 vector<const xAOD::NeutralParticle*> dummyNeutrals;
511
512 int nth = workVertex.selectedTrackIndices.size();
513
514 if(nth<2) {
515 workVertex.isGood = false;
516 return StatusCode::SUCCESS;
517 }
518
519 vector<const xAOD::TrackParticle*> ListBaseTracks;
520
521 workVertex.Chi2PerTrk.clear();
522
523 for( const auto& index : workVertex.selectedTrackIndices ) {
524 ListBaseTracks.emplace_back( m_selectedTracks.at( index ) );
525 workVertex.Chi2PerTrk.emplace_back( AlgConsts::chi2PerTrackInitValue );
526 }
527
528 for( const auto& index : workVertex.associatedTrackIndices ) {
529 ListBaseTracks.emplace_back( m_associatedTracks.at( index ) );
530 workVertex.Chi2PerTrk.emplace_back( AlgConsts::chi2PerTrackInitValue );
531 }
532
533 auto& vertexPos = workVertex.vertex;
534
535 m_fitSvc->setApproximateVertex( vertexPos.x(), vertexPos.y(), vertexPos.z(), istate );
536
537 ATH_MSG_VERBOSE( " >>> refitVertex: ListBaseTracks.size = " << ListBaseTracks.size()
538 << ", #selectedBaseTracks = " << workVertex.selectedTrackIndices.size()
539 << ", #assocTracks = " << workVertex.associatedTrackIndices.size() );
540 for( const auto *trk : ListBaseTracks ) {
541 ATH_MSG_VERBOSE( " >>> refitVertex: track index = " << trk->index() );
542 }
543
544 ATH_MSG_VERBOSE( " >>> refitVertex: m_fitSvc is reset." );
545
546 Amg::Vector3D initVertex;
547
548 StatusCode sc = m_fitSvc->VKalVrtFitFast( ListBaseTracks, initVertex, istate );/* Fast crude estimation */
549 if(sc.isFailure()) ATH_MSG_DEBUG(" >>> refitVertex: fast crude estimation failed.");
550 ATH_MSG_VERBOSE( " >>> refitVertex: Fast VKalVrtFit succeeded. vertex (r,z) = (" << initVertex.perp() << ", " << initVertex.z() << ", " << ")" );
551
552 if( vtxVtxDistance( initVertex, vertexPos ) > 10. ) {
553
554 m_fitSvc->setApproximateVertex( vertexPos.x(), vertexPos.y(), vertexPos.z(), istate );
555
556 } else {
557
558 m_fitSvc->setApproximateVertex( initVertex.x(), initVertex.y(), initVertex.z(), istate );
559
560 }
561
562 ATH_MSG_VERBOSE( " >>> refitVertex: approx vertex is set. Now going to perform fitting..." );
563
564 StatusCode SC=m_fitSvc->VKalVrtFit(ListBaseTracks,dummyNeutrals,
565 workVertex.vertex,
566 workVertex.vertexMom,
567 workVertex.Charge,
568 workVertex.vertexCov,
569 workVertex.Chi2PerTrk,
570 workVertex.TrkAtVrt,
571 workVertex.Chi2,
572 istate);
573
574 auto& cov = workVertex.vertexCov;
575
576 if(SC.isFailure()) ATH_MSG_DEBUG(" >>> refitVertex: SC in refitVertex returned failure ");
577 ATH_MSG_VERBOSE(" >>> refitVertex "<<SC<<", "<<ListBaseTracks.size()<<","<<workVertex.Chi2PerTrk.size());
578 ATH_MSG_VERBOSE( " >>> refitVertex: succeeded in fitting. New vertex pos (r,z) = (" << vertexPos.perp() << ", " << vertexPos.z() << ")" );
579 ATH_MSG_VERBOSE( " >>> refitVertex: New vertex cov = (" << cov.at(0) << ", " << cov.at(1) << ", " << cov.at(2) << ", " << cov.at(3) << ", " << cov.at(4) << ", " << cov.at(5) << ")" );
580
581 return SC;
582 }
const float SC[NC]
Cross sections for Carbon.

◆ refitVertexWithSuggestion() [1/2]

StatusCode VKalVrtAthena::VrtSecInclusive::refitVertexWithSuggestion ( WrkVrt & workVertex,
const Amg::Vector3D & suggestedPosition )
private

refit the vertex with suggestion

Definition at line 585 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

586 {
587 std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState();
588 return refitVertexWithSuggestion (workVertex, suggestedPosition, *state);
589 }

◆ refitVertexWithSuggestion() [2/2]

StatusCode VKalVrtAthena::VrtSecInclusive::refitVertexWithSuggestion ( WrkVrt & workVertex,
const Amg::Vector3D & suggestedPosition,
Trk::IVKalState & istate )
private

Definition at line 593 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

596 {
597
598 //
599 vector<const xAOD::NeutralParticle*> dummyNeutrals;
600
601 int nth = workVertex.selectedTrackIndices.size();
602
603 if(nth<2) {
604 workVertex.isGood = false;
605 return StatusCode::SUCCESS;
606 }
607
608 vector<const xAOD::TrackParticle*> ListBaseTracks;
609
610 workVertex.Chi2PerTrk.clear();
611
612 for( const auto& index : workVertex.selectedTrackIndices ) {
613 ListBaseTracks.emplace_back( m_selectedTracks.at( index ) );
614 workVertex.Chi2PerTrk.emplace_back( AlgConsts::chi2PerTrackInitValue );
615 }
616
617 for( const auto& index : workVertex.associatedTrackIndices ) {
618 ListBaseTracks.emplace_back( m_associatedTracks.at( index ) );
619 workVertex.Chi2PerTrk.emplace_back( AlgConsts::chi2PerTrackInitValue );
620 }
621
622 auto& vertexPos = workVertex.vertex;
623
624 m_fitSvc->setApproximateVertex( suggestedPosition.x(), suggestedPosition.y(), suggestedPosition.z(), istate );
625
626 ATH_MSG_VERBOSE( " >>> " << __FUNCTION__ <<": ListBaseTracks.size = " << ListBaseTracks.size()
627 << ", #selectedBaseTracks = " << workVertex.selectedTrackIndices.size()
628 << ", #assocTracks = " << workVertex.associatedTrackIndices.size() );
629 for( const auto *trk : ListBaseTracks ) {
630 ATH_MSG_VERBOSE( " >>> " << __FUNCTION__ << ": track index = " << trk->index() );
631 }
632
633 ATH_MSG_VERBOSE( " >>> " << __FUNCTION__ << ": m_fitSvc is reset." );
634
635 ATH_MSG_VERBOSE( " >>> " << __FUNCTION__ << ": approx vertex is set. Now going to perform fitting..." );
636
637 StatusCode SC=m_fitSvc->VKalVrtFit(ListBaseTracks,dummyNeutrals,
638 workVertex.vertex,
639 workVertex.vertexMom,
640 workVertex.Charge,
641 workVertex.vertexCov,
642 workVertex.Chi2PerTrk,
643 workVertex.TrkAtVrt,
644 workVertex.Chi2,
645 istate);
646
647 auto& cov = workVertex.vertexCov;
648
649 if( SC.isFailure() ) ATH_MSG_VERBOSE(" >>> " << __FUNCTION__ << ": SC in refitVertex returned failure ");
650 ATH_MSG_VERBOSE(" >>> " << __FUNCTION__ << ": "<<SC<<", "<<ListBaseTracks.size()<<","<<workVertex.Chi2PerTrk.size());
651
652 if( SC.isSuccess() ) {
653 ATH_MSG_VERBOSE( " >>> " << __FUNCTION__ << ": succeeded in fitting. New vertex pos = (" << vertexPos.x() << ", " << vertexPos.y() << ", " << vertexPos.z() << ")" );
654 ATH_MSG_VERBOSE( " >>> " << __FUNCTION__ << ": New vertex cov = (" << cov.at(0) << ", " << cov.at(1) << ", " << cov.at(2) << ", " << cov.at(3) << ", " << cov.at(4) << ", " << cov.at(5) << ")" );
655 }
656
657 return SC;
658 }

◆ removeInconsistentTracks()

void VKalVrtAthena::VrtSecInclusive::removeInconsistentTracks ( WrkVrt & wrkvrt)
private

Remove inconsistent tracks from vertices.

Definition at line 2337 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

2338 {
2339
2340 const auto& vertex = wrkvrt.vertex;
2341
2342 std::map< std::deque<long int>*, std::vector<const xAOD::TrackParticle*>& > indexMap
2343 {
2344 { &(wrkvrt.selectedTrackIndices), m_selectedTracks }, { &(wrkvrt.associatedTrackIndices), m_associatedTracks }
2345 };
2346
2347 for( auto& pair : indexMap ) {
2348
2349 auto* indices = pair.first;
2350 auto& tracks = pair.second;
2351
2352 auto newEnd = std::remove_if( indices->begin(), indices->end(),
2353 [&]( auto& index ) {
2354 bool isConsistent = (this->*m_patternStrategyFuncs[m_checkPatternStrategy] )( tracks.at(index), vertex );
2355 return !isConsistent;
2356 } );
2357
2358 indices->erase( newEnd, indices->end() );
2359
2360 }
2361
2362 }

◆ removeTrackFromVertex()

void VKalVrtAthena::VrtSecInclusive::removeTrackFromVertex ( std::vector< WrkVrt > * workVerticesContainer,
std::vector< std::deque< long int > > * TrkInVrt,
const long int & trackIndexToRemove,
const long int & SelectedVertex )
staticprivate

Definition at line 337 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

341 {
342
343 auto& wrkvrt = workVerticesContainer->at(SelectedVertex);
344 auto& tracks = wrkvrt.selectedTrackIndices;
345
346 {
347 auto end = std::remove_if( tracks.begin(), tracks.end(), [&](long int index) { return index == trackIndexToRemove; } );
348 tracks.erase( end, tracks.end() );
349 }
350
351 {
352 for( auto& trks : *TrkInVrt ) {
353 auto end = std::remove_if( trks.begin(), trks.end(), [&](long int index) { return index == trackIndexToRemove; } );
354 trks.erase( end, trks.end() );
355 }
356 }
357
358
359 // Check if track is removed from two-track vertex => then sharing of track left should also be decreased
360 if( wrkvrt.selectedTrackIndices.size() == 1 ) {
361
362 const auto& leftTrackIndex = *( tracks.begin() );
363 auto& list = TrkInVrt->at(leftTrackIndex);
364 auto end = std::remove_if( list.begin(), list.end(), [&](long int index) { return index == trackIndexToRemove; } );
365 list.erase( end, list.end() );
366
367 }
368
369 }
list(name, path='/')
Definition histSizes.py:38

◆ 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< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ selectInDetAndGSFTracks()

StatusCode VKalVrtAthena::VrtSecInclusive::selectInDetAndGSFTracks ( )
private

Definition at line 304 of file TrackSelectionAlgs.cxx.

304 {
305
306 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": begin" );
307
308 //--------------------------------------------------------
309 // Extract tracks from xAOD::TrackParticle container
310 //
311
312 const xAOD::TrackParticleContainer* IDtracks ( nullptr );
313 ATH_CHECK( evtStore()->retrieve( IDtracks, m_jp.TrackLocation) );
314
315 const xAOD::ElectronContainer *electrons( nullptr );
316 ATH_CHECK( evtStore()->retrieve( electrons, m_jp.ElectronLocation ) );
317
318 const xAOD::MuonContainer* muons ( nullptr );
319 ATH_CHECK( evtStore()->retrieve( muons, m_jp.MuonLocation) );
320
321 std::vector<const xAOD::TrackParticle*> IDTrksFromEls;
322
323 // Loop over electrons to select all GSF tracks
324 for( const auto *electron : *electrons ) {
325 if( 0 == electron->nTrackParticles() ) { continue; }
326 // The first track is the best-matched GSF track
327 const auto* el_trk = electron->trackParticle(0);
328 selectTrack( el_trk );
329 m_leptonicTracks.emplace_back(el_trk);
330 IDTrksFromEls.emplace_back(xAOD::EgammaHelpers::getOriginalTrackParticle(electron));
331 }
332
333 // Loop over ID tracks to select all non-el tracks
334 for( const auto *trk : *IDtracks ) {
335 // do not select ID track if matched to an electron
336 if ( std::find(IDTrksFromEls.begin(), IDTrksFromEls.end(), trk) != IDTrksFromEls.end() ) { continue; }
337 selectTrack( trk );
338 }
339
340 // Loop over muons to book-keep all ID tracks matched to muons
341 for (const auto *muon : *muons) {
342 if (m_jp.doRemoveCaloTaggedMuons && muon->muonType() == xAOD::Muon::CaloTagged) { continue; }
343 const auto* mu_trk = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
344 if(!mu_trk) { continue; }
345 m_leptonicTracks.emplace_back(mu_trk);
346 }
347
348 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of total ID tracks = " << IDtracks->size() );
349 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of total electrons = " << electrons->size() );
350 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of selected tracks = " << m_selectedTracks.size() );
351
352 return StatusCode::SUCCESS;
353 }
void selectTrack(const xAOD::TrackParticle *)
Vertexing Algorithm Member Functions.
const xAOD::TrackParticle * getOriginalTrackParticle(const xAOD::Electron *el)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.

◆ selectTrack()

void VKalVrtAthena::VrtSecInclusive::selectTrack ( const xAOD::TrackParticle * trk)
private

Vertexing Algorithm Member Functions.

select tracks which become seeds for vertex finding

Definition at line 136 of file TrackSelectionAlgs.cxx.

136 {
137
138 if( !m_decor_isSelected ) {
139 m_decor_isSelected.emplace( "is_selected" + m_jp.augVerString );
140 }
141
142 // Setup cut functions
143 if( m_trackSelectionFuncs.empty() && !m_jp.passThroughTrackSelection ) {
144
145 // These cuts are optional. Specified by JobProperty
147 if( m_jp.do_d0Cut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_d0Cut );
148 if( m_jp.do_z0Cut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_z0Cut );
149 if( m_jp.do_d0errCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_d0errCut );
150 if( m_jp.do_z0errCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_z0errCut );
151 if (m_jp.doSelectTracksWithLRTCuts) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_LRTR3Cut );
152 //if( m_jp.do_d0signifCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_d0signifCut ); // not implemented yet
153 //if( m_jp.do_z0signifCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_z0signifCut ); // not implemented yet
154
155 // These cuts are used by default
160
161 }
162
163 if( std::find( m_selectedTracks.begin(), m_selectedTracks.end(), trk ) != m_selectedTracks.end() ) return;
164
165 std::vector<bool> cutBits;
166
167 cutBits.reserve(m_trackSelectionFuncs.size());
168 for( auto func : m_trackSelectionFuncs ) cutBits.emplace_back( (this->*func)( trk ) );
169
170 if( m_jp.FillHist ) {
171 m_hists["trkSelCuts"]->Fill( 0 );
172 for( size_t ibit = 0; ibit < cutBits.size(); ibit++) {
173 if( cutBits.at(ibit) ) {
174 m_hists["trkSelCuts"]->Fill( ibit+1 );
175 } else {
176 break;
177 }
178 }
179 }
180
181 // Good track should not find any false bit
182 bool isGood_standard = ( std::find( cutBits.begin(), cutBits.end(), false ) == cutBits.end() );
183
184 if( isGood_standard ) {
185
186 // Store the selected track to the new m_selectedTracks
187 // Here we firstly need to register the empty pointer to the m_selectedTracks,
188 // then need to do deep copy after then. This is the feature of xAOD.
189
191
192 if( m_jp.doTruth ) {
193
194 const xAOD::TruthParticle *truth = getTrkGenParticle(trk);
195
196 if ( truth ) {
197 uniqueID = HepMC::uniqueID(truth);
198 }
199
200 }
201
202 (*m_decor_isSelected)( *trk ) = true;
203 if (m_jp.doSelectTracksFromElectrons || m_jp.doSelectIDAndGSFTracks) {
204 const xAOD::TrackParticle *id_tr;
206 if (id_tr != nullptr){
207 (*m_decor_isSelected)( *id_tr ) = true; }
208 }
209
210 m_selectedTracks.emplace_back( trk );
211
212 if( m_jp.FillNtuple ) m_ntupleVars->get< vector<int> >( "SelTrk_uniqueID" ).emplace_back(uniqueID);
213
214 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": Track index " << trk->index() << " has been selected." );
215 ATH_MSG_VERBOSE( " > " << __FUNCTION__ << ": Track index " << trk->index()
216 << " parameter:"
217 << " pt = " << trk->pt()
218 << " eta = " << trk->eta()
219 << " d0 = " << trk->d0()
220 << " z0 = " << trk->z0() << "." );
221
222 }
223
224 }
bool selectTrack_pTCut(const xAOD::TrackParticle *) const
bool selectTrack_chi2Cut(const xAOD::TrackParticle *) const
bool selectTrack_notPVassociated(const xAOD::TrackParticle *) const
track-by-track selection strategies
bool selectTrack_hitPatternTight(const xAOD::TrackParticle *) const
bool selectTrack_d0errCut(const xAOD::TrackParticle *) const
bool selectTrack_hitPattern(const xAOD::TrackParticle *) const
std::vector< CutFunc > m_trackSelectionFuncs
bool selectTrack_LRTR3Cut(const xAOD::TrackParticle *) const
bool selectTrack_d0Cut(const xAOD::TrackParticle *) const
bool selectTrack_z0Cut(const xAOD::TrackParticle *) const
bool selectTrack_z0errCut(const xAOD::TrackParticle *) const
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...

◆ selectTrack_chi2Cut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_chi2Cut ( const xAOD::TrackParticle * trk) const
private

Definition at line 35 of file TrackSelectionAlgs.cxx.

35{ return trk->chiSquared() / (trk->numberDoF()+AlgConsts::infinitesimal) < m_jp.TrkChi2Cut; }
float numberDoF() const
Returns the number of degrees of freedom of the overall track or vertex fit as float.
float chiSquared() const
Returns the of the overall track fit.

◆ selectTrack_d0Cut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_d0Cut ( const xAOD::TrackParticle * trk) const
private

Definition at line 28 of file TrackSelectionAlgs.cxx.

28{ return ( fabs( trk->d0() ) > m_jp.d0TrkPVDstMinCut && fabs( trk->d0() ) < m_jp.d0TrkPVDstMaxCut ); }

◆ selectTrack_d0errCut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_d0errCut ( const xAOD::TrackParticle * trk) const
private

Definition at line 30 of file TrackSelectionAlgs.cxx.

30{ const double cov11 = trk->definingParametersCovMatrix()(0,0); return cov11 < m_jp.d0TrkErrorCut*m_jp.d0TrkErrorCut; }

◆ selectTrack_d0signifCut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_d0signifCut ( const xAOD::TrackParticle * )
staticprivate

Definition at line 32 of file TrackSelectionAlgs.cxx.

32{ return true; }

◆ selectTrack_hitPattern()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_hitPattern ( const xAOD::TrackParticle * trk) const
private

Definition at line 38 of file TrackSelectionAlgs.cxx.

38 {
39
40 uint8_t PixelHits = 0;
41 uint8_t SCTHits = 0;
42 uint8_t BLayHits = 0;
43 uint8_t PixShare = 0;
44 uint8_t SCTShare = 0;
45 uint8_t TRTHits = 0;
46
47 if( !(trk->summaryValue( PixelHits, xAOD::numberOfPixelHits ) ) ) PixelHits =0;
48 if( !(trk->summaryValue( SCTHits, xAOD::numberOfSCTHits ) ) ) SCTHits =0;
49 if( !(trk->summaryValue( BLayHits, xAOD::numberOfInnermostPixelLayerHits ) ) ) BLayHits =0;
50 if( !(trk->summaryValue( PixShare, xAOD::numberOfPixelSharedHits ) ) ) PixShare =0;
51 if( !(trk->summaryValue( SCTShare, xAOD::numberOfSCTSharedHits ) ) ) SCTShare =0;
52 if( !(trk->summaryValue( TRTHits, xAOD::numberOfTRTHits ) ) ) TRTHits =0;
53
54 uint8_t SharedHits = PixShare + SCTShare;
55
56 // do Pixel/SCT/SiHits only if we exclude StandAlone TRT hits
57 if( !m_jp.SAloneTRT ) {
58 if(PixelHits < m_jp.CutPixelHits) return false;
59 if(SCTHits < m_jp.CutSctHits) return false;
60 if((PixelHits+SCTHits) < m_jp.CutSiHits) return false;
61 if(BLayHits < m_jp.CutBLayHits) return false;
62 if(SharedHits > m_jp.CutSharedHits) return false;
63 }
64
65 // The folloing part reproduces the track selection in RPVDixpVrt
66 if( m_jp.doTRTPixCut ) {
67 if(TRTHits == 0 && PixelHits < 2) return false;
68 }
69
70 if( PixelHits == 0 && SCTHits < 6 ) return false;
71
72 return true;
73 }
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].

◆ selectTrack_hitPatternTight()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_hitPatternTight ( const xAOD::TrackParticle * trk) const
private

Definition at line 76 of file TrackSelectionAlgs.cxx.

76 {
77 uint8_t PixelHits = 0;
78 uint8_t SCTHits = 0;
79 uint8_t TRTHits = 0;
80
81 if( !(trk->summaryValue( PixelHits, xAOD::numberOfPixelHits ) ) ) PixelHits =0;
82 if( !(trk->summaryValue( SCTHits, xAOD::numberOfSCTHits ) ) ) SCTHits =0;
83 if( !(trk->summaryValue( TRTHits, xAOD::numberOfTRTHits ) ) ) TRTHits =0;
84
85 if( trk->pt() > 20.e3 ) return true;
86
87 if( SCTHits < m_jp.CutTightSCTHits ) return false;
88
89 if( fabs( trk->eta() ) < 1.7 ) {
90 if( TRTHits < m_jp.CutTightTRTHits ) return false;
91 }
92
93 return true;
94 }

◆ selectTrack_LRTR3Cut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_LRTR3Cut ( const xAOD::TrackParticle * trk) const
private

Definition at line 102 of file TrackSelectionAlgs.cxx.

102 {
103 uint8_t npix = 0;
105 uint8_t nsct = 0;
107 uint8_t nSiHits = npix + nsct ;
109 trk->summaryValue(nSCTHoles, xAOD::numberOfSCTHoles);
110
111 double dTheta = std::fabs(TMath::ATan2(std::fabs(trk->d0()),trk->z0())-2*std::atan(std::exp(-1*trk->eta())));
112 bool geometric_cut = dTheta < 1. || std::fabs(trk->z0()) < 200. ;
113
114 bool z0_cut = trk->z0() <= 500. ;
115 bool chi2_cut = (trk->chiSquared()/ (trk->numberDoF()+AlgConsts::infinitesimal)) <= 9. ;
116 bool NSiHits_cut = nSiHits >=8 ;
117 bool NSCTHits_cut = nsct >= 7 ;
118 bool NSCTHoles_cut = nSCTHoles <= 1;
119
120 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": z0_cut, chi2_cut, NSiHits_cut, NSCTHits_cut, NSCTHoles_cut = " <<z0_cut<<", "<<chi2_cut<<", "<<NSiHits_cut<<", "<<NSCTHits_cut<<", "<< NSCTHoles_cut );
121 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": npix, nsct, nSiHits, nSCTHoles, dTheta, z0, d0, chi2 = " <<unsigned(npix)<<", "<<unsigned(nsct)<<", "<<unsigned(nSiHits)<<", "<<unsigned(nSCTHoles)<<", "<< dTheta<<", "<< trk->z0()<<", "<< trk->d0()<<", " <<trk->chiSquared() ) ;
122
123 const std::bitset<xAOD::NumberOfTrackRecoInfo> patternReco = trk->patternRecoInfo();
124 bool isLRT = patternReco.test(49) ;
125 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Track is LRT = " << isLRT ) ;
126 if (isLRT) { // apply all cuts to LRT tracks
127 return (z0_cut && chi2_cut && NSiHits_cut && NSCTHits_cut && NSCTHoles_cut && geometric_cut);
128 }
129 else{ // not LRT track; only apply SiHit cut
130 return NSiHits_cut ;
131 }
132 }
std::bitset< NumberOfTrackRecoInfo > patternRecoInfo() const
Access method for pattern recognition algorithm.
float nSCTHoles(const U &p)
float nSiHits(const U &p)
@ numberOfSCTHoles
number of SCT holes [unit8_t].

◆ selectTrack_notPVassociated()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_notPVassociated ( const xAOD::TrackParticle * trk) const
private

track-by-track selection strategies

Definition at line 97 of file TrackSelectionAlgs.cxx.

97 {
99 }
bool isAssociatedToVertices(const xAOD::TrackParticle *trk, const xAOD::VertexContainer *vertices)

◆ selectTrack_pTCut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_pTCut ( const xAOD::TrackParticle * trk) const
private

Definition at line 34 of file TrackSelectionAlgs.cxx.

34{ return trk->pt() > m_jp.TrkPtCut; }

◆ selectTrack_z0Cut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_z0Cut ( const xAOD::TrackParticle * trk) const
private

Definition at line 29 of file TrackSelectionAlgs.cxx.

29{ return ( fabs( trk->z0() ) > m_jp.z0TrkPVDstMinCut && fabs( trk->z0() ) < m_jp.z0TrkPVDstMaxCut ); }

◆ selectTrack_z0errCut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_z0errCut ( const xAOD::TrackParticle * trk) const
private

Definition at line 31 of file TrackSelectionAlgs.cxx.

31{ const double cov22 = trk->definingParametersCovMatrix()(1,1); return cov22 < m_jp.z0TrkErrorCut*m_jp.z0TrkErrorCut; }

◆ selectTrack_z0signifCut()

bool VKalVrtAthena::VrtSecInclusive::selectTrack_z0signifCut ( const xAOD::TrackParticle * )
staticprivate

Definition at line 33 of file TrackSelectionAlgs.cxx.

33{ return true; }

◆ selectTracksFromElectrons()

StatusCode VKalVrtAthena::VrtSecInclusive::selectTracksFromElectrons ( )
private

Definition at line 281 of file TrackSelectionAlgs.cxx.

281 {
282
283 const xAOD::ElectronContainer *electrons( nullptr );
284 ATH_CHECK( evtStore()->retrieve( electrons, m_jp.ElectronLocation ) );
285
286 for( const auto *const electron : *electrons ) {
287 if( 0 == electron->nTrackParticles() ) continue;
288
289 // The first track is the best-matched track
290 const auto* trk = electron->trackParticle(0);
291
292 if( !trk ) continue;
293 selectTrack( trk );
294 }
295
296 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of total electrons = " << electrons->size() );
297 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of selected tracks = " << m_selectedTracks.size() );
298
299 return StatusCode::SUCCESS;
300 }

◆ selectTracksFromMuons()

StatusCode VKalVrtAthena::VrtSecInclusive::selectTracksFromMuons ( )
private

Definition at line 255 of file TrackSelectionAlgs.cxx.

255 {
256
257 const xAOD::MuonContainer* muons ( nullptr );
258 ATH_CHECK( evtStore()->retrieve( muons, m_jp.MuonLocation) );
259
260
261 for( const auto *const muon : *muons ) {
262 const auto* trk = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
263
264 if( !trk ) continue;
265 // remove calo-tagged muons when selecting muons
266 if (m_jp.doRemoveCaloTaggedMuons) {
267 if (muon->muonType() == xAOD::Muon::CaloTagged) continue;
268 }
269 selectTrack( trk );
270
271 }
272
273 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of total muons = " << muons->size() );
274 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of selected tracks = " << m_selectedTracks.size() );
275
276 return StatusCode::SUCCESS;
277 }

◆ selectTracksInDet()

StatusCode VKalVrtAthena::VrtSecInclusive::selectTracksInDet ( )
private

Definition at line 227 of file TrackSelectionAlgs.cxx.

227 {
228
229 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": begin" );
230
231 //--------------------------------------------------------
232 // Extract tracks from xAOD::TrackParticle container
233 //
234
235 const xAOD::TrackParticleContainer* trackParticleContainer ( nullptr );
236 ATH_CHECK( evtStore()->retrieve( trackParticleContainer, m_jp.TrackLocation) );
237
238 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Extracted xAOD::TrackParticle number=" << trackParticleContainer->size() );
239
240 if( m_jp.FillNtuple )
241 m_ntupleVars->get<unsigned int>( "NumAllTrks" ) = static_cast<int>( trackParticleContainer->size() );
242
243
244 // Loop over tracks
245 for( const auto *trk : *trackParticleContainer ) { selectTrack( trk ); }
246
247 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of total ID tracks = " << trackParticleContainer->size() );
248 ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": Number of selected tracks = " << m_selectedTracks.size() );
249
250 return StatusCode::SUCCESS;
251 }

◆ setIntersection() [1/2]

template<class Track>
void VKalVrtAthena::VrtSecInclusive::setIntersection ( Track * trk,
IntersectionPos * bec,
const Trk::Perigee * per )
private

◆ setIntersection() [2/2]

template<class TrackT>
void VKalVrtAthena::VrtSecInclusive::setIntersection ( TrackT * trk,
IntersectionPos * layer,
const Trk::Perigee * per )

Definition at line 40 of file Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/details/Utilities.h.

43 {
44 const EventContext& ctx = Gaudi::Hive::currentContext();
45 std::unique_ptr<Trk::TrackParameters> Output;
46
47 if( layer->bec() == IntersectionPos::barrel ) {
48
49 IntersectionPos_barrel *barrel = dynamic_cast<IntersectionPos_barrel*>( layer );
50
51 ATH_MSG_VERBOSE( " >>> setIntersection: name = " << barrel->name() << ", Radius = " << barrel->radius() );
52
53 Amg::Transform3D trnsf;
54 trnsf.setIdentity();
55 Trk::CylinderSurface surfBorder(trnsf, barrel->radius(), 300000.); //
56 Output = m_extrapolator->extrapolateDirectly(ctx, *per,surfBorder,Trk::anyDirection,true,Trk::pion);
57
58 barrel->x()->push_back( Output? Output->position().x() : -10000 );
59 barrel->y()->push_back( Output? Output->position().y() : -10000 );
60 barrel->z()->push_back( Output? Output->position().z() : -10000 );
61
62
63 } else if( layer->bec() == IntersectionPos::endcap ) {
64
65 IntersectionPos_endcap *endcap = dynamic_cast<IntersectionPos_endcap*>( layer );
66
67 ATH_MSG_VERBOSE( " >>> setIntersection: name = " << endcap->name() <<
68 ", zpos = " << endcap->zpos() <<
69 ", Rmin = " << endcap->rmin() <<
70 ", Rmax = " << endcap->rmax() );
71
72 Amg::Transform3D trnsf;
73 trnsf.setIdentity();
74 trnsf.translate( Amg::Vector3D(0.,0.,endcap->zpos()) );
75 Trk::DiscSurface surfBorder(trnsf, endcap->rmin(), endcap->rmax() );
76 Output = m_extrapolator->extrapolateDirectly(ctx, *per, surfBorder, Trk::anyDirection, true, Trk::pion);
77
78 endcap->x()->push_back( Output? Output->position().x() : -10000 );
79 endcap->y()->push_back( Output? Output->position().y() : -10000 );
80 endcap->z()->push_back( Output? Output->position().z() : -10000 );
81
82 }
83
84
85 if( Output ) {
86 trk->template auxdecor<float>( Form("intersection_%s_x", layer->name().c_str()) ) = Output->position().x();
87 trk->template auxdecor<float>( Form("intersection_%s_y", layer->name().c_str()) ) = Output->position().y();
88 trk->template auxdecor<float>( Form("intersection_%s_z", layer->name().c_str()) ) = Output->position().z();
89 }
90 }
Eigen::Affine3d Transform3D
@ anyDirection

◆ setupNtuple()

StatusCode VKalVrtAthena::VrtSecInclusive::setupNtuple ( )
private

Definition at line 218 of file AANT_Tools.cxx.

218 {
219
220 m_ntupleVars->branchNtuple( m_tree_Vert );
221
222 return StatusCode::SUCCESS;
223 }

◆ setupNtupleVariables()

StatusCode VKalVrtAthena::VrtSecInclusive::setupNtupleVariables ( )
private

Definition at line 28 of file AANT_Tools.cxx.

28 {
29
30 m_ntupleVars->addNewVar<unsigned int> ( "RunNumber" );
31 m_ntupleVars->addNewVar<unsigned int> ( "Event" );
32 m_ntupleVars->addNewVar<unsigned int> ( "Time" );
33 m_ntupleVars->addNewVar<unsigned int> ( "LumiBlock" );
34 m_ntupleVars->addNewVar<unsigned int> ( "BCID" );
35 m_ntupleVars->addNewVar<unsigned int> ( "LVL1ID" );
36
37 m_ntupleVars->addNewVar<unsigned int> ( "NumAllTrks" );
38 m_ntupleVars->addNewVar<unsigned int> ( "NumSelTrks" );
39 m_ntupleVars->addNewVar<unsigned int> ( "SizeIncomp" );
40
41 m_ntupleVars->addNewVar<unsigned int> ( "NumPV" );
42 m_ntupleVars->addNewVar<unsigned int> ( "NTrksPV" );
43 m_ntupleVars->addNewVar<unsigned int> ( "PVType" );
44 m_ntupleVars->addNewVar<double> ( "PVX" );
45 m_ntupleVars->addNewVar<double> ( "PVY" );
46 m_ntupleVars->addNewVar<double> ( "PVZ" );
47
48 m_ntupleVars->addNewVar< vector<int> > ( "NdofTrksPV" );
49 m_ntupleVars->addNewVar< vector<double> > ( "PVZpile" );
50
51 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_id" );
52 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_pT" );
53 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_2dIPPV" );
54 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_ZIPPV" );
55 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_2dIP" );
56 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_ZIP" );
57 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_phi" );
58 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_eta" );
59 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_chi2" );
60 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_eta" );
61 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_BLayHits" );
62 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixHits" );
63 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_SCTHits" );
64 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_TRTHits" );
65 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixBar1" );
66 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixBar2" );
67 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_barcode" ); // FIXME barcode-based
68 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_matchPr" );
69 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_2dIPErr" );
70 m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_ZIPErr" );
71 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixShare" );
72 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_SCTShare" );
73 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_TrkAuth" );
74 m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_TrkLowPt" );
75
76 m_ntupleVars->addNewVar< vector<int> > ( "SelTrk_barcode" ); // FIXME barcode-based
77
78 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_id" );
79 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_pT" );
80 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_p" );
81 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_phi" );
82 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_eta" );
83 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_2dIP" );
84 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_ZIP" );
85 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_delp" );
86 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_del2dIP" );
87 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_delzIP" );
88 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_eta" );
89 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_BLayHits" );
90 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_PixHits" );
91 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_SCTHits" );
92 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_TRTHits" );
93 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_barcode" ); // FIXME barcode-based
94 m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_matchPr" );
95 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_TrkAuth" );
96 m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_TrkLowPt" );
97
98 m_ntupleVars->addNewVar< unsigned int > ( "All2TrkVrtNum" );
99 m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtMass" );
100 m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtPt" );
101 m_ntupleVars->addNewVar< vector<int> > ( "All2TrkVrtCharge" );
102 m_ntupleVars->addNewVar< vector<int> > ( "All2TrkSumBLHits" );
103 m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtX" );
104 m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtY" );
105 m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtZ" );
106 m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtChiSq" );
107
108 m_ntupleVars->addNewVar< unsigned int > ( "AfFakVrtNum" );
109 m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtMass" );
110 m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtPt" );
111 m_ntupleVars->addNewVar< vector<int> > ( "AfFakVrtCharge" );
112 m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtX" );
113 m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtY" );
114 m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtZ" );
115 m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtChiSq" );
116
117 m_ntupleVars->addNewVar< unsigned int > ( "NumInitSecVrt" );
118 m_ntupleVars->addNewVar< unsigned int > ( "NumRearrSecVrt" );
119 m_ntupleVars->addNewVar< unsigned int > ( "NumSecVrt" );
120 m_ntupleVars->addNewVar< vector<double> > ( "SecVtxX" );
121 m_ntupleVars->addNewVar< vector<double> > ( "SecVtxY" );
122 m_ntupleVars->addNewVar< vector<double> > ( "SecVtxZ" );
123 m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_NumTrks" );
124 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Mass" );
125 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Mass_electron" );
126 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Chi2" );
127 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_pT" );
128 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_pZ" );
129 m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_Charge" );
130 m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_SumBLayHits" );
131 m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_AllTrksBLayHits" );
132 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_MinOpAng" );
133
134 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPt" );
135 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPhi" );
136 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkEta" );
137 m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_TrkBLay" );
138 m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_TrkPixExclBLay" );
139 m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_TrkSCT" );
140 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trk2dIP" );
141 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkZIP" );
142 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelP" );
143 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trkdel2dIP" );
144 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelZIP" );
145 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPtWrtSV" );
146 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPhiWrtSV" );
147 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkEtaWrtSV" );
148 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trk2dIPWrtSV" );
149 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkZIPWrtSV" );
150 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelPWrtSV" );
151 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trkdel2dIPWrtSV" );
152 m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelZIPWrtSV" );
153
154 m_ntupleVars->addNewVar<double> ( "Truth_SV1X" );
155 m_ntupleVars->addNewVar<double> ( "Truth_SV1Y" );
156 m_ntupleVars->addNewVar<double> ( "Truth_SV1Z" );
157 m_ntupleVars->addNewVar<double> ( "Truth_PiEta" );
158 m_ntupleVars->addNewVar<double> ( "Truth_PiPhi" );
159 m_ntupleVars->addNewVar<double> ( "Truth_PiPt" );
160 m_ntupleVars->addNewVar<int> ( "Truth_PiInt" );
161 m_ntupleVars->addNewVar<int> ( "Truth_nSVHiPt" );
162 m_ntupleVars->addNewVar<int> ( "Truth_nSVLoPt" );
163 m_ntupleVars->addNewVar<int> ( "Truth_nSVGe1HiPt" );
164
165 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllVtxType" );
166 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVX" );
167 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVY" );
168 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVZ" );
169 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk1Pt" );
170 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk2Pt" );
171 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk3Pt" );
172 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk4Pt" );
173 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk5Pt" );
174 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVNumTrks" );
175 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVNumReTrks" );
176 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVCharge" );
177 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVSumTrksPt" );
178 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVSumTrksPz" );
179 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVHasLifetime" );
180 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVStrangeBaryon" );
181 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVIncomingPid" );
182 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVNumIncident" );
183 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVPtIncident" );
184 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVPzIncident" );
185 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVMinOpAng" );
186
187 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrk2dIP" );
188 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkZIP" );
189 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkPt" );
190 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkEta" );
191 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkPhi" );
192 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkR" );
193 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkZ" );
194 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllTrkBC" );
195
196 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllRefitSt" );
197 m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllRefitNTrk" );
198 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitChi2" );
199 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitSVX" );
200 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitSVY" );
201 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitSVZ" );
202 m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitMass" );
203
204 return StatusCode::SUCCESS;
205 }

◆ significanceBetweenVertices()

double VKalVrtAthena::VrtSecInclusive::significanceBetweenVertices ( const WrkVrt & v1,
const WrkVrt & v2 ) const
private

calculate the significance (Mahalanobis distance) between two reconstructed vertices

Definition at line 61 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

61 {
62 try {
63 const auto distance = v2.vertex - v1.vertex;
64 AmgSymMatrix(3) sumCov;
65
66 sumCov.fillSymmetric(0, 0, v1.vertexCov.at(0) + v2.vertexCov.at(0));
67 sumCov.fillSymmetric(1, 0, v1.vertexCov.at(1) + v2.vertexCov.at(1));
68 sumCov.fillSymmetric(1, 1, v1.vertexCov.at(2) + v2.vertexCov.at(2));
69 sumCov.fillSymmetric(2, 0, v1.vertexCov.at(3) + v2.vertexCov.at(3));
70 sumCov.fillSymmetric(2, 1, v1.vertexCov.at(4) + v2.vertexCov.at(4));
71 sumCov.fillSymmetric(2, 2, v1.vertexCov.at(5) + v2.vertexCov.at(5));
72
73 const double s2 = distance.transpose() * sumCov.inverse() * distance;
74
75 return s2 > 0. ? sqrt( s2 ) : AlgConsts::maxValue;
76 } catch(...) {
77 ATH_MSG_WARNING( " >>> " << __FUNCTION__ << ": detected covariance matrix broken exception" );
79 }
80 }
#define maxValue(current, test)

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ trackClassification()

void VKalVrtAthena::VrtSecInclusive::trackClassification ( std::vector< WrkVrt > * workVerticesContainer,
std::map< long int, std::vector< long int > > & trackToVertexMap )
private

Definition at line 914 of file Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx.

915 {
916 // Fill TrkInVrt with vertex IDs of each track
917
918 trackToVertexMap.clear();
919
920 for( size_t iv = 0; iv<workVerticesContainer->size(); iv++ ) {
921
922 WrkVrt& vertex = workVerticesContainer->at(iv);
923
924 auto& trackIndices = vertex.selectedTrackIndices;
925 if( !vertex.isGood ) continue;
926 if( trackIndices.size() < 2 ) continue;
927
928 for( auto& index : trackIndices ) {
929 trackToVertexMap[index].emplace_back( iv );
930 }
931 }
932
933 for( auto& pair: trackToVertexMap ) {
934 std::string msg = Form("track index [%ld]: vertices = (", pair.first);
935 for( auto& v : pair.second ) {
936 msg += Form("%ld, ", v);
937 }
938 msg += ")";
939 if( pair.second.size() >=2 ) ATH_MSG_VERBOSE(" >> " << __FUNCTION__ << ": " << msg );
940 }
941
942 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_associatedTracks

std::vector<const xAOD::TrackParticle*> VKalVrtAthena::VrtSecInclusive::m_associatedTracks
private

Definition at line 263 of file VrtSecInclusive.h.

◆ m_atlasId

const AtlasDetectorID* VKalVrtAthena::VrtSecInclusive::m_atlasId = nullptr
private

Definition at line 285 of file VrtSecInclusive.h.

◆ m_BeamPosition

std::vector<double> VKalVrtAthena::VrtSecInclusive::m_BeamPosition
private

Definition at line 265 of file VrtSecInclusive.h.

◆ m_checkPatternStrategy

std::string VKalVrtAthena::VrtSecInclusive::m_checkPatternStrategy
private

Definition at line 289 of file VrtSecInclusive.h.

◆ m_decor_is_svtrk_final

std::optional< SG::Decorator< char > > VKalVrtAthena::VrtSecInclusive::m_decor_is_svtrk_final
private

Definition at line 296 of file VrtSecInclusive.h.

◆ m_decor_isAssociated

std::optional< SG::Decorator< char > > VKalVrtAthena::VrtSecInclusive::m_decor_isAssociated
private

Definition at line 295 of file VrtSecInclusive.h.

◆ m_decor_isSelected

std::optional< SG::Decorator< char > > VKalVrtAthena::VrtSecInclusive::m_decor_isSelected
private

Definition at line 294 of file VrtSecInclusive.h.

◆ m_decor_svLink

std::optional< VertexELType > VKalVrtAthena::VrtSecInclusive::m_decor_svLink
private

Definition at line 307 of file VrtSecInclusive.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> VKalVrtAthena::VrtSecInclusive::m_eventInfoKey {this,"EventInfoKey", "EventInfo", "EventInfo name"}
private

Read/Write Handle Keys.

Definition at line 300 of file VrtSecInclusive.h.

300{this,"EventInfoKey", "EventInfo", "EventInfo name"};

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_extrapolatedPatternBank

PatternBank VKalVrtAthena::VrtSecInclusive::m_extrapolatedPatternBank
private

Definition at line 370 of file VrtSecInclusive.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> VKalVrtAthena::VrtSecInclusive::m_extrapolator
private

Definition at line 278 of file VrtSecInclusive.h.

◆ m_fitSvc

ToolHandle<Trk::ITrkVKalVrtFitter> VKalVrtAthena::VrtSecInclusive::m_fitSvc
private

Definition at line 272 of file VrtSecInclusive.h.

◆ m_hists

std::map<std::string, TH1*> VKalVrtAthena::VrtSecInclusive::m_hists
private

Definition at line 319 of file VrtSecInclusive.h.

◆ m_incomp

std::vector< std::pair<int, int> > VKalVrtAthena::VrtSecInclusive::m_incomp
private

Definition at line 372 of file VrtSecInclusive.h.

◆ m_ipDecors

std::vector< IPDecoratorType > VKalVrtAthena::VrtSecInclusive::m_ipDecors
private

Definition at line 304 of file VrtSecInclusive.h.

◆ m_jp

struct JobProperties VKalVrtAthena::VrtSecInclusive::m_jp
private

Definition at line 249 of file VrtSecInclusive.h.

◆ m_leptonicTracks

std::vector<const xAOD::TrackParticle*> VKalVrtAthena::VrtSecInclusive::m_leptonicTracks
private

Definition at line 264 of file VrtSecInclusive.h.

◆ m_matchMap

std::map<const xAOD::TruthVertex*, bool> VKalVrtAthena::VrtSecInclusive::m_matchMap
private

Definition at line 375 of file VrtSecInclusive.h.

◆ m_ntupleVars

std::unique_ptr<NtupleVars> VKalVrtAthena::VrtSecInclusive::m_ntupleVars
private

Definition at line 316 of file VrtSecInclusive.h.

◆ m_patternStrategyFuncs

std::map<std::string, PatternStrategyFunc> VKalVrtAthena::VrtSecInclusive::m_patternStrategyFuncs
private

Definition at line 291 of file VrtSecInclusive.h.

◆ m_pixelCondSummaryTool

ToolHandle<IInDetConditionsTool> VKalVrtAthena::VrtSecInclusive::m_pixelCondSummaryTool {this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}
private

Condition service.

Definition at line 282 of file VrtSecInclusive.h.

282{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"};

◆ m_pixelId

const PixelID* VKalVrtAthena::VrtSecInclusive::m_pixelId = nullptr
private

Definition at line 286 of file VrtSecInclusive.h.

◆ m_primaryVertices

const xAOD::VertexContainer* VKalVrtAthena::VrtSecInclusive::m_primaryVertices
private

Definition at line 260 of file VrtSecInclusive.h.

◆ m_sctCondSummaryTool

ToolHandle<IInDetConditionsTool> VKalVrtAthena::VrtSecInclusive::m_sctCondSummaryTool {this, "InDetSCT_ConditionsSummaryTool", "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool", "Tool to retrieve SCT conditions summary"}
private

Definition at line 283 of file VrtSecInclusive.h.

283{this, "InDetSCT_ConditionsSummaryTool", "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool", "Tool to retrieve SCT conditions summary"};

◆ m_sctId

const SCT_ID* VKalVrtAthena::VrtSecInclusive::m_sctId = nullptr
private

Definition at line 287 of file VrtSecInclusive.h.

◆ m_selectedTracks

std::vector<const xAOD::TrackParticle*> VKalVrtAthena::VrtSecInclusive::m_selectedTracks
private

Definition at line 262 of file VrtSecInclusive.h.

◆ m_thePV

const xAOD::Vertex* VKalVrtAthena::VrtSecInclusive::m_thePV
private

Definition at line 261 of file VrtSecInclusive.h.

◆ m_tracingTruthVertices

std::vector<const xAOD::TruthVertex*> VKalVrtAthena::VrtSecInclusive::m_tracingTruthVertices
private

Definition at line 564 of file VrtSecInclusive.h.

◆ m_trackSelectionAlgs

std::vector<TrackSelectionAlg> VKalVrtAthena::VrtSecInclusive::m_trackSelectionAlgs
private

Definition at line 390 of file VrtSecInclusive.h.

◆ m_trackSelectionFuncs

std::vector<CutFunc> VKalVrtAthena::VrtSecInclusive::m_trackSelectionFuncs
private

Definition at line 394 of file VrtSecInclusive.h.

◆ m_trackToVertexIPEstimatorTool

ToolHandle<Trk::ITrackToVertexIPEstimator> VKalVrtAthena::VrtSecInclusive::m_trackToVertexIPEstimatorTool
private

Definition at line 277 of file VrtSecInclusive.h.

◆ m_trackToVertexTool

ToolHandle< Reco::ITrackToVertex > VKalVrtAthena::VrtSecInclusive::m_trackToVertexTool
private

get a handle on the Track to Vertex tool

Definition at line 276 of file VrtSecInclusive.h.

◆ m_tree_Vert

TTree* VKalVrtAthena::VrtSecInclusive::m_tree_Vert
private

Definition at line 315 of file VrtSecInclusive.h.

◆ m_trkDecors

std::map< unsigned, SG::Decorator<float> > VKalVrtAthena::VrtSecInclusive::m_trkDecors
private

Definition at line 297 of file VrtSecInclusive.h.

◆ m_truthToTrack

ToolHandle<Trk::ITruthToTrack> VKalVrtAthena::VrtSecInclusive::m_truthToTrack
private

Definition at line 273 of file VrtSecInclusive.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexingAlgorithms

std::vector< std::pair<std::string, vertexingAlg> > VKalVrtAthena::VrtSecInclusive::m_vertexingAlgorithms
private

Definition at line 438 of file VrtSecInclusive.h.

◆ m_vertexingAlgorithmStep

unsigned VKalVrtAthena::VrtSecInclusive::m_vertexingAlgorithmStep = 0U
private

Definition at line 439 of file VrtSecInclusive.h.

◆ m_vertexingStatus

int VKalVrtAthena::VrtSecInclusive::m_vertexingStatus = 0
private

Definition at line 257 of file VrtSecInclusive.h.

◆ m_vertexingStatusKey

SG::WriteDecorHandleKey<xAOD::EventInfo> VKalVrtAthena::VrtSecInclusive::m_vertexingStatusKey
private

Definition at line 301 of file VrtSecInclusive.h.

◆ m_vertexMapper

ToolHandle<Trk::IVertexMapper> VKalVrtAthena::VrtSecInclusive::m_vertexMapper
private

Definition at line 279 of file VrtSecInclusive.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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