diff --git a/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.cpp b/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.cpp index aa9b48f4b4ec065b66c4b65192b54f99f63c05af..e6359f7a955b487cb0f42675cdbc7953dc0cffab 100644 --- a/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.cpp +++ b/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.cpp @@ -66,13 +66,8 @@ TaggerElectronTool::TaggerElectronTool( const std::string& type, const std::stri declareProperty( "P1_e_scale", m_P1e = 1.7055 ); declareProperty( "P2_e_scale", m_P2e = -0.136785 ); declareProperty( "P3_e_scale", m_P3e = 0.646733 ); - - m_descend = 0; - m_electron = 0; } -TaggerElectronTool::~TaggerElectronTool() {} - //===================================================================== StatusCode TaggerElectronTool::initialize() { const StatusCode sc = GaudiTool::initialize(); @@ -229,7 +224,7 @@ Tagger TaggerElectronTool::tag( const Particle* AXB0, const RecVertex* RecVert, // calculate omega double sign = 1.; double pn = 1 - m_AverageOmega; - double rnet; + double rnet = 0; if ( m_CombinationTechnique == "NNet" ) { if ( msgLevel( MSG::DEBUG ) ) debug() << nPV << endmsg; diff --git a/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.h b/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.h index 1807e6d404eccd02fc16166c2ac118195a587e5b..0ceac5836308fd80fb715313a8da832001abb538 100644 --- a/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.h +++ b/Phys/FlavourTagging/src/Taggers/OSElectron/TaggerElectronTool.h @@ -20,7 +20,6 @@ #include "Kernel/ITagger.h" // from ROOT #include <TROOT.h> - // from local #include "FlavourTagging/ITaggingUtils.h" #include "Kernel/IParticleDescendants.h" @@ -42,8 +41,8 @@ class TaggerElectronTool : public GaudiTool, virtual public ITagger { public: /// Standard constructor TaggerElectronTool( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TaggerElectronTool(); ///< Destructor - StatusCode initialize() override; ///< initialization + virtual ~TaggerElectronTool() = default; ///< Destructor + StatusCode initialize() override; ///< initialization StatusCode finalize() override; LHCb::Tagger::TaggerType taggerType() const override { return LHCb::Tagger::TaggerType::OS_Electron; } @@ -59,38 +58,38 @@ private: Gaudi::Property<std::string> m_classifierFactoryName{this, "ClassifierFactoryName", "OSElectronClassifierFactory", "Name of the factory that creates the classifier."}; - ITaggingUtils* m_util; - IParticleDescendants* m_descend; - ICaloElectron* m_electron; + ITaggingUtils* m_util = nullptr; + IParticleDescendants* m_descend = nullptr; + ICaloElectron* m_electron = nullptr; std::string m_CombinationTechnique, m_NeuralNetName; // properties - double m_Pt_cut_ele; - double m_P_cut_ele; - double m_IPs_cut_ele; - double m_VeloChMin; - double m_VeloChMax; - double m_EoverP, m_EoverPmax, m_lcs_cut_ele; - double m_AverageOmega; - double m_ghost_cut_ele; - double m_PIDe_cut; - double m_ipPU_cut_ele; - double m_distPhi_cut_ele; - double m_ProbMin_ele; - double m_P0_Cal_ele; - double m_P1_Cal_ele; - double m_Eta_Cal_ele; - - double m_ghostProb_ele; - double m_PIDNNk_cut_ele; - double m_PIDNNp_cut_ele; - double m_PIDNNpi_cut_ele; - double m_PIDNNe_cut_ele; - double m_PIDNNepi_cut_ele; - - int m_isMonteCarlo; - double m_P0e, m_P1e, m_P2e, m_P3e; + double m_Pt_cut_ele{0}; + double m_P_cut_ele{0}; + double m_IPs_cut_ele{0}; + double m_VeloChMin{0}; + double m_VeloChMax{0}; + double m_EoverP{0}, m_EoverPmax{0}, m_lcs_cut_ele{0}; + double m_AverageOmega{0}; + double m_ghost_cut_ele{0}; + double m_PIDe_cut{0}; + double m_ipPU_cut_ele{0}; + double m_distPhi_cut_ele{0}; + double m_ProbMin_ele{0}; + double m_P0_Cal_ele{0}; + double m_P1_Cal_ele{0}; + double m_Eta_Cal_ele{0}; + + double m_ghostProb_ele{0}; + double m_PIDNNk_cut_ele{0}; + double m_PIDNNp_cut_ele{0}; + double m_PIDNNpi_cut_ele{0}; + double m_PIDNNe_cut_ele{0}; + double m_PIDNNepi_cut_ele{0}; + + int m_isMonteCarlo{0}; + double m_P0e{0}, m_P1e{0}, m_P2e, m_P3e{0}; }; //===============================================================// diff --git a/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.cpp b/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.cpp index c9a414995ccbaf1cf1144d384659a94be9a5a57f..3a0fb2cb318d95ca82fd8c52727cc4b2452e6339 100644 --- a/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.cpp +++ b/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.cpp @@ -52,8 +52,6 @@ TaggerProtonSameTool::TaggerProtonSameTool( const std::string& type, const std:: declareProperty( "ProtonSame_ProbMin", m_ProtonProbMin = 0.5 ); } -TaggerProtonSameTool::~TaggerProtonSameTool() {} - //===================================================================== StatusCode TaggerProtonSameTool::initialize() { const StatusCode sc = GaudiTool::initialize(); @@ -108,13 +106,12 @@ Tagger TaggerProtonSameTool::tag( const Particle* AXB0, const RecVertex* RecVert // select protonS sameside tagger(s) // if more than one satisfies cuts, take the highest BDT response - const Particle* iprotonS = nullptr; - double bestBDT = -99.0; - unsigned int ncand = 0; - Particle::ConstVector::const_iterator ipart, jpart; - for ( ipart = vtags.begin(); ipart != vtags.end(); ++ipart ) { + const Particle* iprotonS = nullptr; + double bestBDT = -99.0; + unsigned int ncand = 0; + for ( auto part : vtags ) { // PID cuts to select the proton - const ProtoParticle* proto = ( *ipart )->proto(); + const ProtoParticle* proto = part->proto(); const double PIDk = proto->info( ProtoParticle::CombDLLk, -1000.0 ); const double PIDp = proto->info( ProtoParticle::CombDLLp, -1000.0 ); @@ -128,11 +125,11 @@ Tagger TaggerProtonSameTool::tag( const Particle* AXB0, const RecVertex* RecVert const Track* track = proto->track(); // if( track->type() != Track::Long && track->type() != Track::Upstream ) continue; preselected already - const double Pt = ( *ipart )->pt(); + const double Pt = part->pt(); if ( msgLevel( MSG::DEBUG ) ) debug() << " Proton Pt=" << Pt << " cut is >" << m_Pt_cut_protonS << endmsg; if ( Pt < m_Pt_cut_protonS ) continue; - if ( msgLevel( MSG::DEBUG ) ) debug() << " Proton P=" << ( *ipart )->p() << " Pt=" << Pt << endmsg; + if ( msgLevel( MSG::DEBUG ) ) debug() << " Proton P=" << part->p() << " Pt=" << Pt << endmsg; // const double lcs = track->chi2PerDoF(); // if( lcs > m_lcs_cut ) continue; //looser cut than default @@ -141,16 +138,16 @@ Tagger TaggerProtonSameTool::tag( const Particle* AXB0, const RecVertex* RecVert if ( track->ghostProbability() > m_ghostprob_cut ) continue; double IP( 0 ), IPerr( 0 ); - m_util->calcIP( *ipart, RecVert, IP, IPerr ).ignore(); + m_util->calcIP( part, RecVert, IP, IPerr ).ignore(); if ( !IPerr ) continue; const double IPsig = std::fabs( IP / IPerr ); if ( IPsig > m_IPs_cut_protonS ) continue; // distphi - // if( m_util->isInTree( *ipart, axdaugh, distphi ) ) continue ;//exclude signal + // if( m_util->isInTree( part, axdaugh, distphi ) ) continue ;//exclude signal // if( distphi < m_distPhi_cut_pS ) continue; - Gaudi::LorentzVector ptot_pS = ( *ipart )->momentum(); + auto ptot_pS = part->momentum(); const double mp = 938.27; // PDG ptot_pS.SetE( std::sqrt( mp * mp + ptot_pS.P2() ) ); @@ -180,7 +177,7 @@ Tagger TaggerProtonSameTool::tag( const Particle* AXB0, const RecVertex* RecVert if ( dphi > m_phi_cut_protonS ) continue; Vertex vtx; - StatusCode sc = m_fitter->fit( vtx, *AXB0, **ipart ); + StatusCode sc = m_fitter->fit( vtx, *AXB0, *part ); if ( sc.isFailure() ) continue; if ( msgLevel( MSG::DEBUG ) ) debug() << " Vertex Fit Chi2=" << vtx.chi2() << "/" << vtx.nDoF() << " (cut is <" << m_Bp_vtxChi2_cut_protonS @@ -218,7 +215,7 @@ Tagger TaggerProtonSameTool::tag( const Particle* AXB0, const RecVertex* RecVert if ( BDT < bestBDT ) continue; // accept candidate - iprotonS = ( *ipart ); + iprotonS = ( part ); bestBDT = BDT; } if ( !iprotonS ) return tprotonS; diff --git a/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.h b/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.h index d84e86dd7c8439325dc45a2e8ecbff26dc3dff36..b90369e45a16cee68c2b9cc4dfa2b1e1237c9692 100644 --- a/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.h +++ b/Phys/FlavourTagging/src/Taggers/SSProton/TaggerProtonSameTool.h @@ -46,7 +46,7 @@ class TaggerProtonSameTool : public GaudiTool, virtual public ITagger { public: /// Standard constructor TaggerProtonSameTool( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TaggerProtonSameTool(); ///< Destructor + virtual ~TaggerProtonSameTool() = default; ///< Destructor StatusCode initialize() override; ///< initialization StatusCode finalize() override; ///< finalization @@ -69,24 +69,24 @@ private: ITaggingUtils* m_util = nullptr; // properties - double m_Pt_cut_protonS; - double m_Bp_Pt_cut_protonS; - double m_Bp_vtxChi2_cut_protonS; - // double m_P_cut_protonS; - double m_IPs_cut_protonS; - double m_eta_cut_protonS; - double m_phi_cut_protonS; - // double m_dR_cut_protonS; - double m_dQcut_protonS; - double m_BDT_cut_protonS; - double m_AverageOmega; - double m_ProtonProbMin, m_ghostprob_cut; + double m_Pt_cut_protonS{0}; + double m_Bp_Pt_cut_protonS{0}; + double m_Bp_vtxChi2_cut_protonS{0}; + // double m_P_cut_protonS{0}; + double m_IPs_cut_protonS{0}; + double m_eta_cut_protonS{0}; + double m_phi_cut_protonS{0}; + // double m_dR_cut_protonS{0}; + double m_dQcut_protonS{0}; + double m_BDT_cut_protonS{0}; + double m_AverageOmega{0}; + double m_ProtonProbMin{0}, m_ghostprob_cut{0}; - double m_PIDp_cut_protonS; - double m_P0_pol_protonS; - double m_P1_pol_protonS; - double m_P2_pol_protonS; - double m_P3_pol_protonS; + double m_PIDp_cut_protonS{0}; + double m_P0_pol_protonS{0}; + double m_P1_pol_protonS{0}; + double m_P2_pol_protonS{0}; + double m_P3_pol_protonS{0}; }; //===============================================================// #endif // PHYS_PHYS_FLAVOURTAGGING_TAGGERPROTONSAMETOOL_H diff --git a/Phys/FlavourTagging/src/Utils/TaggingUtils.cpp b/Phys/FlavourTagging/src/Utils/TaggingUtils.cpp index ba056fff764cf38cded80add7ae05f2c8f42dc22..52d92d1429952b1b60d55ded2e68ad383e128127 100644 --- a/Phys/FlavourTagging/src/Utils/TaggingUtils.cpp +++ b/Phys/FlavourTagging/src/Utils/TaggingUtils.cpp @@ -64,15 +64,13 @@ TaggingUtils::TaggingUtils( const std::string& type, const std::string& name, co declareProperty( "PVSelCriterion", m_PVSelCriterion = "PVbyIPs" ); - declareProperty( "PVReFitter", m_algNamePVReFitter = m_algNamePVReFitter ); - declareProperty( "LifetimeFitter", m_algNameLifetimeFitter = m_algNameLifetimeFitter ); - declareProperty( "VertexFitter", m_algNameVertexFitter = m_algNameVertexFitter ); - declareProperty( "DistanceCalculator", m_algNameDistanceCalculator = m_algNameDistanceCalculator ); - declareProperty( "ParticleDescendants", m_algNameParticleDescendants = m_algNameParticleDescendants ); + declareProperty( "PVReFitter", m_algNamePVReFitter ); + declareProperty( "LifetimeFitter", m_algNameLifetimeFitter ); + declareProperty( "VertexFitter", m_algNameVertexFitter ); + declareProperty( "DistanceCalculator", m_algNameDistanceCalculator ); + declareProperty( "ParticleDescendants", m_algNameParticleDescendants ); } -TaggingUtils::~TaggingUtils() {} - //===================================================================== StatusCode TaggingUtils::initialize() { StatusCode sc = GaudiTool::initialize(); @@ -137,10 +135,11 @@ StatusCode TaggingUtils::calcDOCAmin( const Particle* axp, const Particle* p1, c const StatusCode sc2 = m_DistanceCalculator->distance( axp, p2, doca2, err2 ); doca = std::min( doca1, doca2 ); - if ( doca == doca1 ) + if ( doca == doca1 ) { docaerr = err1; - else + } else { docaerr = err2; + } return StatusCode{sc1 && sc2}; } @@ -170,12 +169,12 @@ StatusCode TaggingUtils::calcIP( const Particle* axp, const RecVertex::ConstVect double& ipe ) { double ipmin = std::numeric_limits<double>::max(); double ipminerr = 0.0; - StatusCode sc, lastsc = StatusCode::SUCCESS; + StatusCode sc{StatusCode::SUCCESS}, lastsc{StatusCode::SUCCESS}; - for ( RecVertex::ConstVector::const_iterator iv = PileUpVtx.begin(); iv != PileUpVtx.end(); ++iv ) { + for ( auto v : PileUpVtx ) { double ipx = 0, ipex = 0; double ipC = 0, ipChi2 = 0; - sc = m_DistanceCalculator->distance( axp, *iv, ipC, ipChi2 ); + sc = m_DistanceCalculator->distance( axp, v, ipC, ipChi2 ); if ( ipChi2 ) { ipx = ipC; ipex = ipC / sqrt( ipChi2 ); @@ -242,18 +241,18 @@ bool TaggingUtils::qualitySort( const LHCb::Particle* p, const LHCb::Particle* q //============================================================================ bool TaggingUtils::isInTree( const LHCb::Particle* axp, const LHCb::Particle::ConstVector& sons ) { - for ( Particle::ConstVector::const_iterator ip = sons.begin(); ip != sons.end(); ++ip ) { + for ( auto p : sons ) { using TaggingHelpers::dphi; using TaggingHelpers::isSameTrack; using TaggingHelpers::SameTrackStatus; using TaggingHelpers::toString; - const SameTrackStatus isSame = isSameTrack( *axp, **ip ); + const SameTrackStatus isSame = isSameTrack( *axp, *p ); if ( isSame ) { if ( msgLevel( MSG::VERBOSE ) ) verbose() << " particle is: " << toString( isSame ) << " isInTree part: " << axp->particleID().pid() << " with p=" << axp->p() / Gaudi::Units::GeV << " pt=" << axp->pt() / Gaudi::Units::GeV - << " proto_axp,ip=" << axp->proto() << " " << ( *ip )->proto() << endmsg; + << " proto_axp,ip=" << axp->proto() << " " << p->proto() << endmsg; return true; } } @@ -263,19 +262,19 @@ bool TaggingUtils::isInTree( const LHCb::Particle* axp, const LHCb::Particle::Co //============================================================================ bool TaggingUtils::isInTree( const LHCb::Particle* axp, const LHCb::Particle::ConstVector& sons, double& dist_phi ) { dist_phi = std::numeric_limits<double>::max(); - for ( Particle::ConstVector::const_iterator ip = sons.begin(); ip != sons.end(); ++ip ) { + for ( auto p : sons ) { using TaggingHelpers::dphi; using TaggingHelpers::isSameTrack; using TaggingHelpers::SameTrackStatus; using TaggingHelpers::toString; - const double deltaphi = fabs( dphi( axp->momentum().phi(), ( *ip )->momentum().phi() ) ); + const double deltaphi = fabs( dphi( axp->momentum().phi(), p->momentum().phi() ) ); if ( dist_phi > deltaphi ) dist_phi = deltaphi; - const SameTrackStatus isSame = isSameTrack( *axp, **ip ); + const SameTrackStatus isSame = isSameTrack( *axp, *p ); if ( isSame ) { if ( msgLevel( MSG::VERBOSE ) ) verbose() << " particle is: " << toString( isSame ) << " isinTree part: " << axp->particleID().pid() << " with p=" << axp->p() / Gaudi::Units::GeV << " pt=" << axp->pt() / Gaudi::Units::GeV - << " proto_axp,ip=" << axp->proto() << " " << ( *ip )->proto() << endmsg; + << " proto_axp,ip=" << axp->proto() << " " << p->proto() << endmsg; return true; } } @@ -289,21 +288,17 @@ LHCb::Particle::ConstVector TaggingUtils::purgeCands( const LHCb::Particle::Rang Particle::ConstVector signalDaus = m_ParticleDescendants->descendants( &BS ); - Particle::ConstVector::const_iterator icand; - for ( icand = cands.begin(); icand != cands.end(); ++icand ) { + for ( auto cand : cands ) { - const Particle* cand = *icand; - Particle::ConstVector candDaus = m_ParticleDescendants->descendants( cand ); - bool isUsedForSignal = false; + auto candDaus = m_ParticleDescendants->descendants( cand ); + bool isUsedForSignal = false; - Particle::ConstVector::const_iterator icandDau; - for ( icandDau = candDaus.begin(); icandDau != candDaus.end(); ++icandDau ) { + for ( auto candDau : candDaus ) { - const LHCb::ProtoParticle* proto_candDau = ( *icandDau )->proto(); + const LHCb::ProtoParticle* proto_candDau = candDau->proto(); - Particle::ConstVector::const_iterator isignalDau; - for ( isignalDau = signalDaus.begin(); isignalDau != signalDaus.end(); ++isignalDau ) { - if ( proto_candDau == ( *isignalDau )->proto() ) isUsedForSignal = true; + for ( auto signalDau : signalDaus ) { + if ( proto_candDau == signalDau->proto() ) isUsedForSignal = true; if ( isUsedForSignal ) break; } @@ -351,8 +346,8 @@ double TaggingUtils::TPVIPCHI2( const LHCb::Particle* cand, const LHCb::RecVerte } bool TaggingUtils::isBestPV( const LHCb::Particle* cand, const RecVertex* vert ) { - const RecVertex* bpv = (const RecVertex*)m_dva->bestVertex( cand ); - VFun dist = LoKi::Cuts::VVDCHI2( vert ); + auto bpv = (const RecVertex*)m_dva->bestVertex( cand ); + VFun dist = LoKi::Cuts::VVDCHI2( vert ); return ( dist( bpv ) < 1 ); } @@ -361,8 +356,8 @@ CharmMode TaggingUtils::getCharmDecayMode( const LHCb::Particle* cand, int candT CharmMode mode = CharmMode::None; - const SmartRefVector<Particle>& daus = cand->daughters(); - int numDaus = daus.size(); + const auto& daus = cand->daughters(); + int numDaus = daus.size(); switch ( candType ) { diff --git a/Phys/FlavourTagging/src/Utils/TaggingUtils.h b/Phys/FlavourTagging/src/Utils/TaggingUtils.h index b1aea3b2649d1b29beb256bc255d6ba70e160f0f..ebea0a1fe376fc1bd6bbb09584b235d29fd43e62 100644 --- a/Phys/FlavourTagging/src/Utils/TaggingUtils.h +++ b/Phys/FlavourTagging/src/Utils/TaggingUtils.h @@ -36,7 +36,7 @@ public: /// Standard constructor TaggingUtils( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TaggingUtils(); + virtual ~TaggingUtils() = default; StatusCode initialize() override; //---------------------------------------------------------------------------- @@ -82,7 +82,7 @@ public: //------------------------------------------------------------- private: - IDVAlgorithm* m_dva; + IDVAlgorithm* m_dva = nullptr; std::string m_PVSelCriterion; @@ -92,15 +92,16 @@ private: std::string m_algNameDistanceCalculator; std::string m_algNameParticleDescendants; - const IPVReFitter* m_PVReFitter; - const ILifetimeFitter* m_LifetimeFitter; - const IVertexFit* m_VertexFitter; - const IDistanceCalculator* m_DistanceCalculator; - IParticleDescendants* m_ParticleDescendants; // cannot be const, as - // descendants() is not a const - // function. + const IPVReFitter* m_PVReFitter = nullptr; + const ILifetimeFitter* m_LifetimeFitter = nullptr; + const IVertexFit* m_VertexFitter = nullptr; + const IDistanceCalculator* m_DistanceCalculator = nullptr; + IParticleDescendants* m_ParticleDescendants = nullptr; // cannot be const, as + // descendants() is not a const + // function. - unsigned int lambda_pid, pi_pid, pi0_pid, k_pid, ks_pid, p_pid, e_pid, mu_pid, d0_pid, d_pid, lambdaC_pid; + unsigned int lambda_pid{0}, pi_pid{0}, pi0_pid{0}, k_pid{0}, ks_pid{0}; + unsigned int p_pid{0}, e_pid{0}, mu_pid{0}, d0_pid{0}, d_pid{0}, lambdaC_pid{0}; }; //===============================================================// diff --git a/Phys/LoKiPhys/dict/LoKiPhysDict.h b/Phys/LoKiPhys/dict/LoKiPhysDict.h index babc7aaf246984d9df32376281591334969200c9..ced490ed479f45fd5c4c732403e897edbb99a0e5 100644 --- a/Phys/LoKiPhys/dict/LoKiPhysDict.h +++ b/Phys/LoKiPhys/dict/LoKiPhysDict.h @@ -12,6 +12,15 @@ #ifndef LOKI_LOKIPHYSDICT_H # define LOKI_LOKIPHYSDICT_H 1 // ============================================================================ +// build/Phys/LoKiPhys/LoKiPhysDict.cpp:26369:38: warning: string literal of +// length 95823 exceeds maximum length 65536 +// that C++ compilers are required to support [-Woverlength-strings] +// static const char* fwdDeclCode = R"DICTFWDDCLS( +// See issue Phys#4 for further discussion +# if defined( __clang__ ) +# pragma clang diagnostic ignored "-Woverlength-strings" +# endif +// ============================================================================ // Include files // ============================================================================ // LoKi