Skip to content
Snippets Groups Projects
Commit 5a7dee9b authored by Rosen Matev's avatar Rosen Matev :sunny:
Browse files

Merge branch 'move-rich-ddl-scaling-to-pid-object' into 'master'

Move Rich DLL scaling to static / class functions.

See merge request !4301
parents 24bccebf 658c7ca9
No related branches found
No related tags found
2 merge requests!4386Merge master into FTRetinaSeedRawBanks,!4301Move Rich DLL scaling to static / class functions.
Pipeline #6299666 passed
......@@ -142,6 +142,22 @@ void ProtoParticlePacker::unpack( const PackedData& pproto, Data& proto, const P
for ( const auto& [k, v] : with_carry( pprotos.extras(), pproto.firstExtra, pproto.lastExtra ) ) {
proto.addInfo( k, StandardPacker::fltPacked( v ) );
}
// Work around for time when RichDLL el/mu values where removed from additional Info.
// If missing, but RichPID is linked, add them back.
// See https://gitlab.cern.ch/lhcb/LHCb/-/merge_requests/4301 for more details
if ( proto.richPID() ) {
if ( !proto.hasInfo( LHCb::ProtoParticle::additionalInfo::RichDLLe ) ) {
parent().debug() << "Adding missing RichDLLe additional Info" << endmsg;
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLe, //
proto.richPID()->particleDeltaLL( Rich::Electron ) );
}
if ( !proto.hasInfo( LHCb::ProtoParticle::additionalInfo::RichDLLmu ) ) {
parent().debug() << "Adding missing RichDLLmu additional Info" << endmsg;
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLmu, //
proto.richPID()->particleDeltaLL( Rich::Muon ) );
}
}
}
void ProtoParticlePacker::unpack( const PackedDataVector& pprotos, DataVector& protos ) const {
......
......@@ -92,8 +92,6 @@ namespace LHCb {
RichPIDStatus = 105, // The RichPID bit packed PID status word
RichDLLbt = 106, // The RICH delta log likelihood value for the 'Below Threshold' hypothesis
RichDLLd = 107, // The RICH delta log likelihood value for the deuteron hypothesis
RichCalibratedDLLe = 108, // RichDLLe, but calibrated to form a (more) true likelihood (for comb DLLs)
RichCalibratedDLLmu = 109, // RichDLLmu, but calibrated to form a (more) true likelihood (for comb DLLs)
MuonMuLL = 200, // The log likelihood from the MUON system for the ProtoParticle to be a muon
MuonBkgLL = 201, // The log likelihood from the MUON system for the ProtoParticle to be background
MuonNShared = 202, // The number of MUON hits that are shared with other ProtoParticles
......@@ -364,10 +362,6 @@ namespace LHCb {
return s << "RichDLLbt";
case LHCb::ProtoParticle::RichDLLd:
return s << "RichDLLd";
case LHCb::ProtoParticle::RichCalibratedDLLe:
return s << "RichCalibratedDLLe";
case LHCb::ProtoParticle::RichCalibratedDLLmu:
return s << "RichCalibratedDLLmu";
case LHCb::ProtoParticle::MuonMuLL:
return s << "MuonMuLL";
case LHCb::ProtoParticle::MuonBkgLL:
......@@ -591,8 +585,6 @@ LHCb::ProtoParticle::s_additionalInfoTypMap() {
{"RichPIDStatus", RichPIDStatus},
{"RichDLLbt", RichDLLbt},
{"RichDLLd", RichDLLd},
{"RichCalibratedDLLe", RichCalibratedDLLe},
{"RichCalibratedDLLmu", RichCalibratedDLLmu},
{"MuonMuLL", MuonMuLL},
{"MuonBkgLL", MuonBkgLL},
{"MuonNShared", MuonNShared},
......
......@@ -231,6 +231,27 @@ namespace LHCb {
friend std::ostream& operator<<( std::ostream& str, const RichPID& obj ) { return obj.fillStream( str ); }
public:
// For Combined DLLs
/// Apply scaling to given DLL value for given PID type
inline static float scaledDLLForCombDLL( const Rich::ParticleIDType type, const float dll ) {
// Ad-hoc scalings for DLLs when combined with other systems in CombDLLs
switch ( type ) {
case Rich::Electron:
return ( 7.0 * tanh( dll / 40.0 ) );
case Rich::Muon:
return ( 7.0 * tanh( dll / 5.0 ) );
default:
return dll;
}
}
/// Access the 'scaled for CombDLL' value for a given PID type
inline float scaledDLLForCombDLL( const Rich::ParticleIDType type ) const {
return scaledDLLForCombDLL( type, particleDeltaLL( type ) );
}
private:
template <unsigned int mask>
void set( bool value ) {
......
......@@ -112,8 +112,6 @@ LHCb::ProtoParticle::ExtraInfo::size_type LHCb::ProtoParticle::removeRichInfo()
erased += this->eraseInfo( LHCb::ProtoParticle::additionalInfo::RichDLLp );
erased += this->eraseInfo( LHCb::ProtoParticle::additionalInfo::RichDLLbt );
erased += this->eraseInfo( LHCb::ProtoParticle::additionalInfo::RichDLLd );
erased += this->eraseInfo( LHCb::ProtoParticle::additionalInfo::RichCalibratedDLLe );
erased += this->eraseInfo( LHCb::ProtoParticle::additionalInfo::RichCalibratedDLLmu );
erased += this->eraseInfo( LHCb::ProtoParticle::additionalInfo::RichPIDStatus );
// Set RichPID pointer to NULL
this->setRichPID( nullptr );
......
......@@ -19,6 +19,7 @@
//-----------------------------------------------------------------------------
#include "Event/ProtoParticle.h"
#include "Event/RichPID.h"
#include "GaudiAlg/GaudiTool.h"
#include "Interfaces/IProtoParticleTool.h"
......@@ -38,12 +39,12 @@ namespace LHCb::Rec::ProtoParticle::Charged {
/// Standard constructor with initialisation value
CombinedLL( double init = 0 )
: elDLL( init ), muDLL( init ), piDLL( init ), kaDLL( init ), prDLL( init ), deDLL( init ){};
double elDLL; ///< Electron Log Likelihood
double muDLL; ///< Muon Log Likelihood
double piDLL; ///< Pion Log Likelihood
double kaDLL; ///< Kaon Log Likelihood
double prDLL; ///< Proton Log Likelihood
double deDLL; ///< Deuteron Log Likelihood
double elDLL{0}; ///< Electron Log Likelihood
double muDLL{0}; ///< Muon Log Likelihood
double piDLL{0}; ///< Pion Log Likelihood
double kaDLL{0}; ///< Kaon Log Likelihood
double prDLL{0}; ///< Proton Log Likelihood
double deDLL{0}; ///< Deuteron Log Likelihood
public:
/// Implement ostream << method
friend std::ostream& operator<<( std::ostream& s, const CombinedLL& dlls ) {
......@@ -229,17 +230,23 @@ namespace LHCb::Rec::ProtoParticle::Charged {
// Eventually, should make these tunable job options ....
const int rTechnique = m_maskTechnique.at( "RICH" );
if ( 0 != ( m_elCombDll & rTechnique ) )
combDLL.elDLL += proto->info( LHCb::ProtoParticle::additionalInfo::RichCalibratedDLLe, 0 );
combDLL.elDLL += LHCb::RichPID::scaledDLLForCombDLL(
Rich::Electron, proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLe, 0 ) );
if ( 0 != ( m_muCombDll & rTechnique ) )
combDLL.muDLL += proto->info( LHCb::ProtoParticle::additionalInfo::RichCalibratedDLLmu, 0 );
combDLL.muDLL += LHCb::RichPID::scaledDLLForCombDLL(
Rich::Muon, proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLmu, 0 ) );
if ( 0 != ( m_piCombDll & rTechnique ) )
combDLL.piDLL += proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLpi, 0 );
combDLL.piDLL += LHCb::RichPID::scaledDLLForCombDLL(
Rich::Pion, proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLpi, 0 ) );
if ( 0 != ( m_kaCombDll & rTechnique ) )
combDLL.kaDLL += proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLk, 0 );
combDLL.kaDLL += LHCb::RichPID::scaledDLLForCombDLL(
Rich::Kaon, proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLk, 0 ) );
if ( 0 != ( m_prCombDll & rTechnique ) )
combDLL.prDLL += proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLp, 0 );
combDLL.prDLL += LHCb::RichPID::scaledDLLForCombDLL(
Rich::Proton, proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLp, 0 ) );
if ( 0 != ( m_deCombDll & rTechnique ) )
combDLL.deDLL += proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLd, 0 );
combDLL.deDLL += LHCb::RichPID::scaledDLLForCombDLL(
Rich::Deuteron, proto->info( LHCb::ProtoParticle::additionalInfo::RichDLLd, 0 ) );
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " -> Adding RICH info " << combDLL << endmsg;
}
return ok;
......
......@@ -100,19 +100,14 @@ namespace LHCb::Rec::ProtoParticle::Charged {
proto.setRichPID( richPID );
// Store the raw RICH PID info
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLe, richPID->particleDeltaLL( Rich::Electron ) );
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLmu, richPID->particleDeltaLL( Rich::Muon ) );
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLpi, richPID->particleDeltaLL( Rich::Pion ) );
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLk, richPID->particleDeltaLL( Rich::Kaon ) );
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLp, richPID->particleDeltaLL( Rich::Proton ) );
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLbt, richPID->particleDeltaLL( Rich::BelowThreshold ) );
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichDLLd, richPID->particleDeltaLL( Rich::Deuteron ) );
// in case of muon and electron DLLs, do a rough calibration (for combined likelihoods with Calo/Muon)
// TODO should be done properly before the RichPID object creation!
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichCalibratedDLLe,
7.0 * tanh( richPID->particleDeltaLL( Rich::Electron ) / 40.0 ) );
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichCalibratedDLLmu,
7.0 * tanh( richPID->particleDeltaLL( Rich::Muon ) / 5.0 ) );
// Store History
proto.addInfo( LHCb::ProtoParticle::additionalInfo::RichPIDStatus, richPID->pidResultCode() );
}
......
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