Skip to content
Snippets Groups Projects

TupleToolKinematic AtVtx changed

Merged Luis Miguel Garcia Martin requested to merge lgarciam-TTKinematic-run2 into run2-patches
2 files
+ 50
3
Compare changes
  • Side-by-side
  • Inline
Files
2
/*****************************************************************************\
* (c) Copyright 2000-2019 CERN for the benefit of the LHCb Collaboration *
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
@@ -77,8 +77,9 @@ StatusCode TupleToolKinematic::fill( const LHCb::Particle* mother, const LHCb::P
test &= tuple->column( prefix + "_MMERR", P->measuredMassErr() );
test &= tuple->column( prefix + "_M", P->momentum().M() );
// Compute momentum at origin vertex
if ( isVerbose() && mother && P->isBasicParticle() && P->charge() != 0 ) {
const LHCb::Vertex* originvtx = mother->endVertex();
const LHCb::Vertex* originvtx = originVertex( mother, P );
if ( originvtx ) {
double zvtx = originvtx->position().Z();
@@ -88,6 +89,23 @@ StatusCode TupleToolKinematic::fill( const LHCb::Particle* mother, const LHCb::P
test &= m_transporter->transport( P, zvtx, transParticle );
test &= tuple->column( prefix + "_AtVtx_P", transParticle.momentum() );
test &= tuple->column( prefix + "_AtVtx_P", transParticle.p() );
test &= tuple->column( prefix + "_AtVtx_PT", transParticle.pt() );
}
// Compute momentum at Secondary Vertex
const LHCb::Vertex* SV = mother->endVertex();
if ( SV ) {
double zSV = SV->position().Z();
LHCb::Particle transParticle_SV;
if ( !m_transporter )
Error( "null pointer m_transporter !!!!" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
test &= m_transporter->transport( P, zSV, transParticle_SV );
test &= tuple->column( prefix + "_AtSV_P", transParticle_SV.momentum() );
test &= tuple->column( prefix + "_AtSV_P", transParticle_SV.p() );
test &= tuple->column( prefix + "_AtSV_PT", transParticle_SV.pt() );
}
}
} else {
@@ -105,3 +123,30 @@ double TupleToolKinematic::preFitMass( const LHCb::Particle* p ) const {
}
return Mom.M();
}
// =====================================================
// find origin vertex in the decay chain
// =====================================================
const LHCb::Vertex* TupleToolKinematic::originVertex( const LHCb::Particle* top, const LHCb::Particle* P ) const {
// this used to pass back zero if P was a basic particle.
if ( top == P || top->isBasicParticle() ) return nullptr;
const auto& dau = top->daughters();
if ( dau.empty() ) return nullptr;
for ( const auto d : dau ) {
if ( P == d ) { // I found the daughter
if ( msgLevel( MSG::VERBOSE ) ) verbose() << "It's a daughter, returning mother's endvertex : " << endmsg;
return top->endVertex();
}
}
// vertex not yet found, get deeper in the decay:
for ( const auto d : dau ) {
const auto vv = originVertex( d, P );
if ( !vv ) continue;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << "Went up : " << vv << endmsg;
return vv;
}
return nullptr;
}
Loading