Skip to content
Snippets Groups Projects
Commit dac0e8ec authored by Hideyuki Oide's avatar Hideyuki Oide
Browse files

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

Feature vrt sec inclusive new features integrated 21.0

See merge request atlas-phys-susy-secondary-vertex/athena!9

Former-commit-id: 598de2af453d07907becd23c69f151d1efae4acc
parents 197356e4 c9e64e07
No related branches found
No related tags found
No related merge requests found
......@@ -111,18 +111,25 @@ namespace VKalVrtAthena {
const LeptonContainer *leptonContainer( nullptr );
ATH_CHECK( evtStore()->retrieve( leptonContainer, containerName ) );
static SG::AuxElement::Decorator< std::vector< std::vector<float> > > decor_d0wrtSV( "d0_wrtSVs" );
static SG::AuxElement::Decorator< std::vector< std::vector<float> > > decor_z0wrtSV( "z0_wrtSVs" );
using IPDecoratorType = SG::AuxElement::Decorator< std::vector< std::vector<float> > >;
static IPDecoratorType decor_d0wrtSV ( "d0_wrtSVs" );
static IPDecoratorType decor_z0wrtSV ( "z0_wrtSVs" );
static IPDecoratorType decor_ptwrtSV ( "pt_wrtSVs" );
static IPDecoratorType decor_etawrtSV ( "eta_wrtSVs" );
static IPDecoratorType decor_phiwrtSV ( "phi_wrtSVs" );
static IPDecoratorType decor_d0errWrtSV ( "d0err_wrtSVs" );
static IPDecoratorType decor_z0errWrtSV ( "z0err_wrtSVs" );
// Grouping decorators
std::vector< IPDecoratorType > decor_ipWrtSVs { decor_d0wrtSV, decor_z0wrtSV, decor_ptwrtSV, decor_etawrtSV, decor_phiwrtSV, decor_d0errWrtSV, decor_z0errWrtSV };
enum { k_ip_d0, k_ip_z0, k_ip_pt, k_ip_eta, k_ip_phi, k_ip_d0err, k_ip_z0err };
static SG::AuxElement::Decorator< std::vector<ElementLink< xAOD::VertexContainer > > > decor_svLink("svLinks");
std::vector< std::vector<float> > d0wrtSVs;
std::vector< std::vector<float> > z0wrtSVs;
// Loop over muons
// Loop over leptons
for( const auto& lepton : *leptonContainer ) {
d0wrtSVs.clear();
z0wrtSVs.clear();
std::vector< std::vector< std::vector<float> > > ip_wrtSVs( decor_ipWrtSVs.size() ); // triple nest of { ip parameters, tracks, DVs }
bool linkFlag { false };
......@@ -132,8 +139,7 @@ namespace VKalVrtAthena {
// Loop over lepton types
for( auto& trackType : trackTypes ) {
std::vector<float> d0wrtSV;
std::vector<float> z0wrtSV;
std::vector< std::vector<float> > ip_wrtSV( decor_ipWrtSVs.size() ); // nest of { tracks, DVs }
const auto* trk = getLeptonTrackParticle<LeptonFlavor>( lepton, trackType );
......@@ -142,18 +148,32 @@ namespace VKalVrtAthena {
std::map< const xAOD::Vertex*, std::vector<double> > distanceMap;
std::vector<ElementLink< xAOD::VertexContainer > > links;
// Loop over vertices
for( const auto& vtx : *secondaryVertexContainer ) {
std::vector<double> impactParameters;
std::vector<double> impactParErrors;
m_fitSvc->VKalGetImpact( trk, vtx->position(), static_cast<int>( lepton->charge() ), impactParameters, impactParErrors);
m_fitSvc->VKalGetImpact( trk, vtx->position(), static_cast<int>( lepton->charge() ), impactParameters, impactParErrors );
enum { k_d0, k_z0, k_theta, k_phi, k_qOverP };
enum { k_d0, k_z0, k_theta, k_phi, k_qOverP }; // for the impact parameter
enum { k_d0d0, k_d0z0, k_z0z0 }; // for the par errors
d0wrtSV.emplace_back( impactParameters.at(k_d0) );
z0wrtSV.emplace_back( impactParameters.at(k_z0) );
const auto& theta = impactParameters.at( k_theta );
const auto& phi = impactParameters.at( k_phi );
const auto p = fabs( 1.0 / impactParameters.at(k_qOverP) );
const auto pt = fabs( p * sin( theta ) );
const auto eta = -log( tan(theta/2.) );
// filling the parameters to the corresponding container
ip_wrtSV.at( k_ip_d0 ) .emplace_back( impactParameters.at(k_d0) );
ip_wrtSV.at( k_ip_z0 ) .emplace_back( impactParameters.at(k_d0) );
ip_wrtSV.at( k_ip_pt ) .emplace_back( pt );
ip_wrtSV.at( k_ip_eta ) .emplace_back( eta );
ip_wrtSV.at( k_ip_phi ) .emplace_back( phi );
ip_wrtSV.at( k_ip_d0err ) .emplace_back( impactParErrors.at(k_d0d0) );
ip_wrtSV.at( k_ip_z0err ) .emplace_back( impactParErrors.at(k_z0z0) );
if( !linkFlag ) {
......@@ -162,22 +182,22 @@ namespace VKalVrtAthena {
}
}
} // end of vertex loop
// The linking to the vertices need to be done only once
if( !linkFlag ) {
decor_svLink ( *lepton ) = links;
linkFlag = true;
}
d0wrtSVs.emplace_back( d0wrtSV );
z0wrtSVs.emplace_back( z0wrtSV );
for( size_t ipar = 0; ipar < ip_wrtSVs.size(); ipar++ ) ip_wrtSVs.at( ipar ).emplace_back( ip_wrtSV.at( ipar ) );
}
} // end of track type loop
decor_d0wrtSV( *lepton ) = d0wrtSVs;
decor_z0wrtSV( *lepton ) = z0wrtSVs;
// decoration
for( size_t ipar = 0; ipar < decor_ipWrtSVs.size(); ipar++ ) decor_ipWrtSVs.at( ipar )( *lepton ) = ip_wrtSVs.at( ipar );
}
} // end of lepton container loop
return StatusCode::SUCCESS;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment