Commit 68b54015 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'cherry-pick-5d3df30b-2' into '21.0-mc16d'

Merge branch 'feature-VrtSecInclusive-newFeaturesIntegrated-21.0' into '21.0'

See merge request atlas/athena!13004

Former-commit-id: de859806a9f1227ae654ad01dbc327c6d483a807
parents 950a1bbf d3a4037c
......@@ -9,6 +9,7 @@ atlas_subdir( VrtSecInclusive )
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Control/StoreGate
Event/xAOD/xAODEventInfo
Event/xAOD/xAODTracking
Event/xAOD/xAODTruth
Event/xAOD/xAODMuon
......@@ -41,13 +42,13 @@ atlas_add_library( VrtSecInclusiveLib
src/*.cxx
PUBLIC_HEADERS VrtSecInclusive
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${LAPACK_INCLUDE_DIRS} ${BLAS_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} AthenaBaseComps xAODTracking xAODTruth xAODMuon xAODEgamma GaudiKernel GeneratorObjects ITrackToVertex TrkDetDescrInterfaces TrkSurfaces TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces StoreGateLib SGtests TrkVKalVrtFitterLib AtlasDetDescr InDetIdentifier
LINK_LIBRARIES ${ROOT_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} AthenaBaseComps xAODEventInfo xAODTracking xAODTruth xAODMuon xAODEgamma GaudiKernel GeneratorObjects ITrackToVertex TrkDetDescrInterfaces TrkSurfaces TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces StoreGateLib SGtests TrkVKalVrtFitterLib AtlasDetDescr InDetIdentifier
PRIVATE_LINK_LIBRARIES xAODEventInfo TrkTrackSummary VxVertex )
atlas_add_component( VrtSecInclusive
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${LAPACK_INCLUDE_DIRS} ${BLAS_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} AthenaBaseComps StoreGateLib SGtests xAODTracking xAODTruth xAODMuon xAODEgamma GaudiKernel GeneratorObjects ITrackToVertex TrkDetDescrInterfaces TrkSurfaces TrkExInterfaces TrkToolInterfaces TrkVKalVrtFitterLib TrkVertexFitterInterfaces xAODEventInfo TrkTrackSummary VxVertex VrtSecInclusiveLib AtlasDetDescr InDetIdentifier )
LINK_LIBRARIES ${ROOT_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} AthenaBaseComps StoreGateLib SGtests xAODEventInfo xAODTracking xAODTruth xAODMuon xAODEgamma GaudiKernel GeneratorObjects ITrackToVertex TrkDetDescrInterfaces TrkSurfaces TrkExInterfaces TrkToolInterfaces TrkVKalVrtFitterLib TrkVertexFitterInterfaces xAODEventInfo TrkTrackSummary VxVertex VrtSecInclusiveLib AtlasDetDescr InDetIdentifier )
# Install files from the package:
atlas_install_python_modules( python/*.py )
......
......@@ -107,7 +107,7 @@ namespace VKalVrtAthena {
// These cuts are optional. Specified by JobProperty
if( m_jp.do_PVvetoCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_notPVassociated );
if( m_jp.do_d0Cut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_d0Cut );
if( m_jp.do_z0Cut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_d0Cut );
if( m_jp.do_z0Cut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_z0Cut );
if( m_jp.do_d0errCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_d0errCut );
if( m_jp.do_z0errCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_z0errCut );
//if( m_jp.do_d0signifCut ) m_trackSelectionFuncs.emplace_back( &VrtSecInclusive::selectTrack_d0signifCut ); // not implemented yet
......
......@@ -9,6 +9,7 @@
#include "TrkTrackSummary/TrackSummary.h"
#include <xAODEventInfo/EventInfo.h>
#include <xAODTruth/TruthParticleContainer.h>
#include <xAODTruth/TruthVertexContainer.h>
......@@ -2320,9 +2321,17 @@ namespace VKalVrtAthena {
//____________________________________________________________________________________________________
void VrtSecInclusive::dumpTruthInformation() {
const xAOD::EventInfo* eventInfo { nullptr };
const xAOD::TruthParticleContainer* truthParticles { nullptr };
const xAOD::TruthVertexContainer* truthVertices { nullptr };
auto sc0 = evtStore()->retrieve( eventInfo, "EventInfo" );
if( sc0.isFailure() ) { return; }
if( eventInfo->eventType( xAOD::EventInfo::IS_SIMULATION ) ) {
return;
}
auto sc1 = evtStore()->retrieve( truthParticles, "TruthParticles" );
if( sc1.isFailure() ) { return; }
......
......@@ -1422,6 +1422,8 @@ namespace VKalVrtAthena {
// Output SVs as xAOD::Vertex
// Needs a conversion function from workVerticesContainer to xAOD::Vertex here.
// The supposed form of the function will be as follows:
try {
xAOD::VertexContainer *secondaryVertexContainer( nullptr );
ATH_CHECK( evtStore()->retrieve( secondaryVertexContainer, "VrtSecInclusive_" + m_jp.secondaryVerticesContainerName + m_jp.augVerString ) );
......@@ -1480,22 +1482,28 @@ namespace VKalVrtAthena {
// Remove track if the vertex is inner than IBL and the track does not have pixel hits!
if( wrkvrt.vertex.perp() < 31.0 ) {
for( auto& index : wrkvrt.selectedTrackIndices ) {
auto *trk = m_selectedTracks->at( index );
uint8_t nPixelHits { 0 }; trk->summaryValue( nPixelHits, xAOD::numberOfPixelHits );
if( nPixelHits < 3 ) {
wrkvrt.selectedTrackIndices.erase( wrkvrt.selectedTrackIndices.begin() + index ); //remove track
}
}
for( auto& index : wrkvrt.associatedTrackIndices ) {
auto *trk = m_associatedTracks->at( index );
uint8_t nPixelHits { 0 }; trk->summaryValue( nPixelHits, xAOD::numberOfPixelHits );
if( nPixelHits < 3 ) {
wrkvrt.associatedTrackIndices.erase( wrkvrt.associatedTrackIndices.begin() + index ); //remove track
}
}
// for selected tracks
wrkvrt.selectedTrackIndices.erase( std::remove_if( wrkvrt.selectedTrackIndices.begin(), wrkvrt.selectedTrackIndices.end(),
[&]( auto& index ) {
auto* trk = m_selectedTracks->at( index );
uint8_t nPixelHits { 0 }; trk->summaryValue( nPixelHits, xAOD::numberOfPixelHits );
return ( nPixelHits < 3 );
} ),
wrkvrt.selectedTrackIndices.end() );
// for associated tracks
wrkvrt.associatedTrackIndices.erase( std::remove_if( wrkvrt.associatedTrackIndices.begin(), wrkvrt.associatedTrackIndices.end(),
[&]( auto& index ) {
auto* trk = m_associatedTracks->at( index );
uint8_t nPixelHits { 0 }; trk->summaryValue( nPixelHits, xAOD::numberOfPixelHits );
return ( nPixelHits < 3 );
} ),
wrkvrt.associatedTrackIndices.end() );
auto statusCode = refitVertex( wrkvrt );
if( statusCode.isFailure() ) {}
}
......@@ -1853,7 +1861,21 @@ namespace VKalVrtAthena {
// Post process -- Additional augmentations
if( m_jp.doAugmentDVimpactParametersToMuons ) { ATH_CHECK( augmentDVimpactParametersToLeptons<xAOD::Muon> ( "Muons" ) ); }
if( m_jp.doAugmentDVimpactParametersToElectrons ) { ATH_CHECK( augmentDVimpactParametersToLeptons<xAOD::Electron>( "Electrons" ) ); }
} catch (const std::out_of_range& e) {
ATH_MSG_WARNING( " > " << __FUNCTION__ << ": out of range error is detected: " << e.what() );
return StatusCode::SUCCESS;
} catch( ... ) {
ATH_MSG_WARNING( " > " << __FUNCTION__ << ": some other error is detected." );
return StatusCode::SUCCESS;
}
return StatusCode::SUCCESS;
}
......
......@@ -372,10 +372,21 @@ namespace VKalVrtAthena {
}
// Perform track selection and store it to selectedBaseTracks
for( auto alg : m_trackSelectionAlgs ) {
ATH_CHECK( (this->*alg)() );
try {
for( auto alg : m_trackSelectionAlgs ) {
ATH_CHECK( (this->*alg)() );
}
} catch( ... ) {
ATH_MSG_WARNING( " > " << __FUNCTION__ << ": some other error is detected in the track selection scope." );
return StatusCode::SUCCESS;
}
if( m_jp.FillNtuple )
m_ntupleVars->get<unsigned int>( "NumSelTrks" ) = static_cast<int>( m_selectedTracks->size() );
......@@ -398,43 +409,53 @@ namespace VKalVrtAthena {
// Core part of Vertexing
//
m_vertexingAlgorithmStep = 0;
try {
m_vertexingAlgorithmStep = 0;
// set of vertices created in the following while loop.
auto* workVerticesContainer = new std::vector<WrkVrt>;
// set of vertices created in the following while loop.
auto* workVerticesContainer = new std::vector<WrkVrt>;
// the main sequence of the main vertexing algorithms
// see initialize() what kind of algorithms exist.
for( auto itr = m_vertexingAlgorithms.begin(); itr!=m_vertexingAlgorithms.end(); ++itr ) {
// the main sequence of the main vertexing algorithms
// see initialize() what kind of algorithms exist.
for( auto itr = m_vertexingAlgorithms.begin(); itr!=m_vertexingAlgorithms.end(); ++itr ) {
auto& name = itr->first;
auto alg = itr->second;
auto& name = itr->first;
auto alg = itr->second;
auto t_start = std::chrono::system_clock::now();
auto t_start = std::chrono::system_clock::now();
ATH_CHECK( (this->*alg)( workVerticesContainer ) );
ATH_CHECK( (this->*alg)( workVerticesContainer ) );
auto t_end = std::chrono::system_clock::now();
auto t_end = std::chrono::system_clock::now();
if( m_jp.FillHist ) {
auto sec = std::chrono::duration_cast<std::chrono::microseconds>( t_end - t_start ).count();
m_hists["CPUTime"]->Fill( m_vertexingAlgorithmStep, sec/1.e6 );
}
if( m_jp.FillHist ) {
auto sec = std::chrono::duration_cast<std::chrono::microseconds>( t_end - t_start ).count();
m_hists["CPUTime"]->Fill( m_vertexingAlgorithmStep, sec/1.e6 );
}
auto end = std::remove_if( workVerticesContainer->begin(), workVerticesContainer->end(),
[]( WrkVrt& wrkvrt ) {
return ( wrkvrt.isGood == false || wrkvrt.nTracksTotal() < 2 ); }
);
auto end = std::remove_if( workVerticesContainer->begin(), workVerticesContainer->end(),
[]( WrkVrt& wrkvrt ) {
return ( wrkvrt.isGood == false || wrkvrt.nTracksTotal() < 2 ); }
);
workVerticesContainer->erase( end, workVerticesContainer->end() );
workVerticesContainer->erase( end, workVerticesContainer->end() );
ATH_CHECK( monitorVertexingAlgorithmStep( workVerticesContainer, name, std::next( itr ) == m_vertexingAlgorithms.end() ) );
ATH_CHECK( monitorVertexingAlgorithmStep( workVerticesContainer, name, std::next( itr ) == m_vertexingAlgorithms.end() ) );
m_vertexingAlgorithmStep++;
m_vertexingAlgorithmStep++;
}
}
delete workVerticesContainer;
delete workVerticesContainer;
} catch(...) {
ATH_MSG_WARNING( " > " << __FUNCTION__ << ": some other error is detected in the vertexing scope." );
return StatusCode::SUCCESS;
}
// Fill AANT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment