From c752d0701b3c794c438aeb7df8e98ee5f3ab3c70 Mon Sep 17 00:00:00 2001 From: Patrick Koppenburg <Patrick Koppenburg patrick.koppenburg@cern.ch> Date: Fri, 19 Mar 2021 16:28:53 +0100 Subject: [PATCH 1/2] Implement issue 8 --- Phys/BBDecTreeTool/src/BBDTSimpleTool.cpp | 137 ------ Phys/BBDecTreeTool/src/BBDTSimpleTool.h | 128 ----- .../Kernel/IP2VVAngleCalculator.h | 53 -- .../Kernel/IP2VVPartAngleCalculator.h | 66 --- .../Kernel/IStandardParticleProvider.h | 52 -- .../dict/DaVinciInterfacesDict.h | 1 - .../dict/DaVinciInterfacesDict.xml | 3 - .../Kernel/IP2VVMCPartAngleCalculator.h | 75 --- .../dict/DaVinciMCKernelDict.h | 1 - .../dict/DaVinciMCKernelDict.xml | 1 - .../src/CheckVeloOverlap.cpp | 250 ---------- .../src/CheckVeloOverlap.h | 106 ---- .../src/HighPtIsoLeptonAndTagPV.cpp | 359 -------------- .../src/HighPtIsoLeptonAndTagPV.h | 143 ------ .../src/RelInfoVertexIsolationDetached.cpp | 356 -------------- .../src/RelInfoVertexIsolationDetached.h | 85 ---- Phys/TisTosTobbing/src/TESSelectionTisTos.cpp | 462 ------------------ Phys/TisTosTobbing/src/TESSelectionTisTos.h | 156 ------ Phys/TisTosTobbing/src/TESTisTos.cpp | 320 ------------ Phys/TisTosTobbing/src/TESTisTos.h | 97 ---- .../src/TriggerSelectionTisTosSummary.cpp | 333 ------------- .../src/TriggerSelectionTisTosSummary.h | 143 ------ .../src/TriggerTisTosSummary.cpp | 244 --------- Phys/TisTosTobbing/src/TriggerTisTosSummary.h | 91 ---- 24 files changed, 3662 deletions(-) delete mode 100644 Phys/BBDecTreeTool/src/BBDTSimpleTool.cpp delete mode 100644 Phys/BBDecTreeTool/src/BBDTSimpleTool.h delete mode 100644 Phys/DaVinciInterfaces/Kernel/IP2VVAngleCalculator.h delete mode 100644 Phys/DaVinciInterfaces/Kernel/IP2VVPartAngleCalculator.h delete mode 100644 Phys/DaVinciInterfaces/Kernel/IStandardParticleProvider.h delete mode 100644 Phys/DaVinciMCKernel/Kernel/IP2VVMCPartAngleCalculator.h delete mode 100644 Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.cpp delete mode 100644 Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.h delete mode 100644 Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.cpp delete mode 100644 Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.h delete mode 100644 Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.cpp delete mode 100644 Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.h delete mode 100644 Phys/TisTosTobbing/src/TESSelectionTisTos.cpp delete mode 100644 Phys/TisTosTobbing/src/TESSelectionTisTos.h delete mode 100644 Phys/TisTosTobbing/src/TESTisTos.cpp delete mode 100644 Phys/TisTosTobbing/src/TESTisTos.h delete mode 100644 Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.cpp delete mode 100644 Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.h delete mode 100644 Phys/TisTosTobbing/src/TriggerTisTosSummary.cpp delete mode 100644 Phys/TisTosTobbing/src/TriggerTisTosSummary.h diff --git a/Phys/BBDecTreeTool/src/BBDTSimpleTool.cpp b/Phys/BBDecTreeTool/src/BBDTSimpleTool.cpp deleted file mode 100644 index 8408f84a6..000000000 --- a/Phys/BBDecTreeTool/src/BBDTSimpleTool.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// ============================================================================ -#include "BBDTSimpleTool.h" -#include <algorithm> -// ============================================================================ -BBDTSimpleTool::BBDTSimpleTool( const std::string& type, const std::string& name, const IInterface* parent ) - : base_class( type, name, parent ), m_dictool_name( "LoKi::Hybrid::DictOfFunctors" ), m_hybrid_dicttool( 0 ) { - // declare configurable properties - declareProperty( "Cuts", m_cuts, "Simple tree of cuts" ); - declareProperty( "ParticleDictTool", m_dictool_name, "Type/Name for C++/Python hybrid dictionary of functors tool" ); -} -// =========================================================================== -StatusCode BBDTSimpleTool::initialize() { - // initialize the base class (the first action) - const StatusCode sc = GaudiTool::initialize(); - if ( sc.isFailure() ) return sc; - - // get tools - // Get the LoKi::Hybrid::DictOfFunctors tool that manages the interactions - // with the hybrid functors. - m_hybrid_dicttool = tool<IParticleDictTool>( m_dictool_name, this ); - - // display cuts - if ( msgLevel( MSG::DEBUG ) ) { - std::vector<std::map<std::string, std::pair<double, double>>>::const_iterator iter = m_cuts.begin(); - debug() << "Initialized w/ Cuts = ["; - while ( iter != m_cuts.end() ) { - debug() << "("; - std::map<std::string, std::pair<double, double>>::const_iterator it = iter->begin(); - while ( it != iter->end() ) { - double min_cut = it->second.first; - double max_cut = it->second.second; - if ( min_cut > 0 ) debug() << "(" << it->first << " > " << min_cut << ")"; - if ( max_cut > 0 ) { - if ( min_cut > 0 ) debug() << "&"; - debug() << "(" << it->first << " < " << max_cut << ")"; - } - it++; - if ( it != iter->end() ) debug() << "&"; - } - debug() << ")"; - iter++; - if ( iter != m_cuts.end() ) debug() << "|"; - } - debug() << "]" << endmsg; - } - - return sc; -} - -// =========================================================================== -StatusCode BBDTSimpleTool::finalize() { - // declare configurable properties - return GaudiTool::finalize(); -} - -// ============================================================================ -bool BBDTSimpleTool::operator()( const LHCb::Particle* p ) const { - - if ( 0 == p ) { - Error( "LHCb::Particle* points to NULL, return false" ).ignore(); - return false; - } - - // DICT is a typedef of GaudiUtils::VectorMap< std::string, double > - IParticleDictTool::DICT vals; // Map of functor values keyed by var name - - // Evaluate the functors - StatusCode sc = m_hybrid_dicttool->fill( p, vals ); - if ( !sc.isSuccess() ) { - Error( "Unable to fill map of functor values, return false" ).ignore(); - return false; - } - - bool passAny = false; - std::vector<std::map<std::string, std::pair<double, double>>>::const_iterator iter = m_cuts.begin(); - while ( !passAny && ( iter != m_cuts.end() ) ) { - bool passSet = true; - std::map<std::string, std::pair<double, double>>::const_iterator it = iter->begin(); - while ( passSet && ( it != iter->end() ) ) { - // Consider a harder failure state. - IParticleDictTool::DICT::iterator pval = vals.find( it->first ); - if ( pval == vals.end() ) { - Error( "Unable to find value for " + it->first + " in dictionary of functor values, returning false." ) - .ignore(); - passSet = false; - break; - } - - double min_cut = it->second.first; - double max_cut = it->second.second; - - double value = pval->second; - - // The use of negative values to indicate no cut can no longer work - // for a generalized variable handler. - // As a (hopefully) temporary generalization to remain compatible with - // the original function, do not apply an upper limit cut if the upper - // limit is less than the lower limit. - // Always apply a lower limit. Since the original variables are all - // positive definite, a negative lower limit is equivalent to no cut. - if ( value < min_cut ) passSet = false; - if ( max_cut > min_cut && value > max_cut ) passSet = false; - it++; - } - passAny = passSet; - - iter++; - } - return passAny; -} - -// ============================================================================ -/// declare & implement the factory -DECLARE_COMPONENT( BBDTSimpleTool ) -// ============================================================================ - -#include "GaudiKernel/ParsersFactory.h" - -namespace Gaudi { - namespace Parsers { - StatusCode parse( std::vector<std::map<std::string, std::pair<double, double>>>& result, - const std::string& input ) { - return parse_( result, input ); - } - } // namespace Parsers -} // namespace Gaudi -// ============================================================================ diff --git a/Phys/BBDecTreeTool/src/BBDTSimpleTool.h b/Phys/BBDecTreeTool/src/BBDTSimpleTool.h deleted file mode 100644 index 76267dac0..000000000 --- a/Phys/BBDecTreeTool/src/BBDTSimpleTool.h +++ /dev/null @@ -1,128 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// -*- C++ -*- -#ifndef BBDTSimpleTool_H -#define BBDTSimpleTool_H -// ============================================================================ -// Include files -#include <map> -#include <string> -#include <vector> -class StatusCode; -namespace Gaudi { - namespace Parsers { - StatusCode parse( std::vector<std::map<std::string, std::pair<double, double>>>& result, const std::string& input ); - } -} // namespace Gaudi -#include "GaudiAlg/GaudiTool.h" -#include "Kernel/IParticleDictTool.h" -#include "Kernel/IParticleFilter.h" -// ============================================================================ -/** @class BBDTSimpleTool - * This tool performs "easy" BBDT cuts for the HLT2 topological lines. - * It accepts particles that pass any of a set of collections of cuts. - * - * Its properties: - * - <c>"Cuts":</c> the sets of cuts. - * - <c>"ParticleDictTool":</c> name of the class to use for variable - * functor handling. It must inherit from <c>IParticleDictTool</c>. - * The default value is <c>"LoKi::Hybrid::DictOfFunctors"</c>. - * - * A set of cuts is a map associating to variable nicknames a pair of real - * values that define the <c>(min, max)</c> of the accepted range of the - * variable. If <c>max < min</c>, then only the lower limit, - * <c>var > min</c>, is applied. There is no equivalent functionality that - * would provide only an upper limit. - * - * The <c>Cuts</c> property of the tool contains a vector of such sets of - * cuts. If an input particle passes all of the cuts of at least one of the - * sets of cuts, then the particle is accepted by the filter. - * - * The tool uses a private <c>LoKi::Hybrid::DictOfFunctors</c> for evaluating - * the values of the input variables. It must be configured separately with - * a mapping of the variable nicknames as they appear in <c>Cuts</c> to - * the strings defining the corresponding LoKi functors for evaluating the - * variables. The tool can be used with LoKi/Bender functors. An example - * configuration in the context of a Hlt2 line follows: - * @code - * from Configurables import BBDTSimpleTool - * from Configurables import LoKi__Hybrid__DictOfFunctors - * from Configurables import FilterDesktop - * from HltLine.HltLine import Hlt2Member - * from HltLine.HltLine import Hlt1Tool - * - * varHandler = Hlt1Tool( type = LoKi__Hybrid__DictOfFunctors, name = "VarHandler", - * Variables = { "M" : "MM/MeV" - * , "DOCA" : "DOCAMAX_('',False)/mm" - * , "FDCHI2" : "BPVVDCHI2" - * , "PTSUM" : "SUMTREE(PT,ISBASIC,0.0)/MeV" - * } - * - * - * simpletool = Hlt1Tool(type=BBDTSimpleTool,name='TrgSimple', - * Cuts=[ { 'M' : (2500,7000) ## First set of cuts - * ,'DOCA' : (-1,0.2) - * ,'FDCHI2' : (1000,-1) - * ,'PTSUM':(7000,-1)} - * , { 'M' : (3000,7000) ## Second set of cuts - * ,'DOCA' : (-1,0.2) - * ,'FDCHI2' : (1000,-1) - * ,'PTSUM' : (8000,-1)} - * ] - * ParticleDictTool='LoKi::Hybrid::DictOfFunctors/'+varHandler.Name, - * tools=[varHandler]) - * - * cuts = "FILTER('BBDTSimpleTool/TrgSimple')" - * filter = Hlt2Member(FilterDesktop, 'FilterBDT', Inputs=..., - * Code=cuts,tools=[simpletool]) - * @endcode - * - * @see LoKi::Cuts::FILTER - * @see IParticleFilter - * @see IParticleDictTool - * @see LoKi::Hybrid::DictOfFunctors - * @author Mike Williams - * @date 2011-02-15 - * - * - */ -class BBDTSimpleTool : public extends<GaudiTool, IParticleFilter> { - -public: - /** initialize tool */ - StatusCode initialize() override; - - /** finalize tool */ - StatusCode finalize() override; - - /** performs the filtering based on the BBDT "easy" cuts - * @see IParticleFilter - */ - bool operator()( const LHCb::Particle* p ) const override; - - /** standard constructor - * @param type the actual tool type (?) - * @param name the tool instance name - * @param parent the tool parent - */ - BBDTSimpleTool( const std::string& type, const std::string& name, const IInterface* parent ); - -private: - // properties - /// Simple tree of cuts - std::vector<std::map<std::string, std::pair<double, double>>> m_cuts; - std::string m_dictool_name; ///< the typename of the DictOfFunctors tool - - // attributes - IParticleDictTool* m_hybrid_dicttool; -}; -// ============================================================================ -#endif /* BBDTSimpleTool_H */ diff --git a/Phys/DaVinciInterfaces/Kernel/IP2VVAngleCalculator.h b/Phys/DaVinciInterfaces/Kernel/IP2VVAngleCalculator.h deleted file mode 100644 index 4c4688f67..000000000 --- a/Phys/DaVinciInterfaces/Kernel/IP2VVAngleCalculator.h +++ /dev/null @@ -1,53 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef IP2VVANGLETOOL_H -#define IP2VVANGLETOOL_H 1 - -// Include files -// from STL -#include <string> -// from Gaudi -#include "Event/Particle.h" -#include "GaudiKernel/IAlgTool.h" - -/** @class IP2VVAngleCalculator IP2VVAngleCalculator.h - * - * Low-level tool that calculates the three angles between the four - * decay products of a P->VV decay. Use IP2VVPartAngleCalculator - * or IP2VVMCPartAngleCalculator instead. - * - * @author Thomas Blake, Greig Cowan - * @date 2007-08-22 - * @modified 2008-06-02 - */ -struct GAUDI_API IP2VVAngleCalculator : extend_interfaces<IAlgTool> { - - DeclareInterfaceID( IP2VVAngleCalculator, 2, 0 ); - - /// calculate the angle between two planes in the rest frame of the mother particle - virtual double calculatePlaneAngle( const Gaudi::LorentzVector&, const Gaudi::LorentzVector&, - const Gaudi::LorentzVector&, const Gaudi::LorentzVector&, - const Gaudi::LorentzVector& ) = 0; - - /// calculate the polar angle in the rest frame of the mother particle - virtual double calculatePolarAngle( const Gaudi::LorentzVector&, const Gaudi::LorentzVector&, - const Gaudi::LorentzVector& ) = 0; - - /// calculate the angle of the L+ wrt z-axis in dilepton frame - virtual double calculateThetaTr( const Gaudi::LorentzVector&, const Gaudi::LorentzVector&, - const Gaudi::LorentzVector&, const Gaudi::LorentzVector& ) = 0; - - /// calculate the azimuthal angle of the L+ in dilepton frame - virtual double calculatePhiTr( const Gaudi::LorentzVector&, const Gaudi::LorentzVector&, const Gaudi::LorentzVector&, - const Gaudi::LorentzVector& ) = 0; -}; - -#endif // IB2LLXANGLETOOL_H diff --git a/Phys/DaVinciInterfaces/Kernel/IP2VVPartAngleCalculator.h b/Phys/DaVinciInterfaces/Kernel/IP2VVPartAngleCalculator.h deleted file mode 100644 index 8552a3ec5..000000000 --- a/Phys/DaVinciInterfaces/Kernel/IP2VVPartAngleCalculator.h +++ /dev/null @@ -1,66 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef IP2VVPARTANGLECALCULATOR_H -#define IP2VVPARTANGLECALCULATOR_H 1 - -// Include files -// from STL -#include <string> - -// from Gaudi -#include "GaudiKernel/IAlgTool.h" - -namespace LHCb { - class Particle; -} - -/** @class IP2VVPartAngleCalculator IP2VVPartAngleCalculator.h - * - * Calculates the three angles in a P->VV decay in both the helicity - * and the transversity bases. The methods are called - * ThetaL, ThetaK and Phi to comply with the B->MuMuK* conventions and - * Theta_tr, Phi_tr and Theta_V (=phi,K*) to comply with the Bs->J/psi Phi - * conventions for the transversity basis. - * - * @author Thomas Blake, Greig Cowan - * @date 2007-08-02 - * @modified 2008-06-02 - */ -struct GAUDI_API IP2VVPartAngleCalculator : extend_interfaces<IAlgTool> { - - DeclareInterfaceID( IP2VVPartAngleCalculator, 2, 0 ); - - /// get theta_L (angle of the L+ wrt B in dilepton frame) - virtual double calculateThetaL( const LHCb::Particle* mother ) = 0; - - /// get theta_K (angle of the K+ wrt B in dilepton frame) - virtual double calculateThetaK( const LHCb::Particle* mother ) = 0; - - /// get phi (angle of the K* and LL decay planes in dilepton frame) - virtual double calculatePhi( const LHCb::Particle* mother ) = 0; - - /// get all three helicity angles - virtual StatusCode calculateAngles( const LHCb::Particle* mother, double& thetal, double& thetak, double& phi ) = 0; - - /// get Theta_tr (angle of the L+ wrt z-axis in dilepton frame) - virtual double calculateTransThetaTr( const LHCb::Particle* mother ) = 0; - - /// get Phi_tr (azimutal angle of the L+ in dilepton frame) - virtual double calculateTransPhiTr( const LHCb::Particle* mother ) = 0; - - /// get Theta_phi_tr (polar angle between the x'-axis and the decaying K+ in the dikaon frame) - virtual double calculateTransThetaV( const LHCb::Particle* mother ) = 0; - - /// get all three transversity angles - virtual StatusCode calculateTransversityAngles( const LHCb::Particle* mother, double& Theta_tr, double& Phi_tr, - double& Theta_V ) = 0; -}; -#endif // IP2VVPARTANGLECALCULATOR_H diff --git a/Phys/DaVinciInterfaces/Kernel/IStandardParticleProvider.h b/Phys/DaVinciInterfaces/Kernel/IStandardParticleProvider.h deleted file mode 100644 index 78935dd57..000000000 --- a/Phys/DaVinciInterfaces/Kernel/IStandardParticleProvider.h +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ - -#ifndef DAVINCIKERNEL_IStandardParticleProvider_H -#define DAVINCIKERNEL_IStandardParticleProvider_H 1 - -// from STL -#include <string> - -// from Gaudi -#include "GaudiKernel/IAlgTool.h" - -// Event Model -namespace LHCb { - class Particle; - class ParticleID; - class ProtoParticle; -} // namespace LHCb - -/** @class IStandardParticleProvider Kernel/IStandardParticleProvider.h - * - * Interface to tool that provides pointer to 'standard' Particles - * for a given ProtoParticle and PID hypothesis - * - * @author Chris Jones - * @date 26/02/2012 - */ - -class GAUDI_API IStandardParticleProvider : virtual public IAlgTool { - -public: - /// Declare the interface - DeclareInterfaceID( IStandardParticleProvider, 1, 0 ); - -public: - /** Get a Particle for a given ProtoParticle and PID - * @param proto Pointer to the ProtoParticle - * @param pid The PID hypothesis - * @return Pointer to the associated standard Particle - */ - virtual const LHCb::Particle* particle( const LHCb::ProtoParticle* proto, const LHCb::ParticleID& pid ) const = 0; -}; - -#endif // DAVINCIKERNEL_IStandardParticleProvider_H diff --git a/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h b/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h index bc407f374..1c3765deb 100644 --- a/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h +++ b/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h @@ -60,7 +60,6 @@ #include "Kernel/IRelatedPVFinder.h" #include "Kernel/ISecondaryVertexTool.h" #include "Kernel/ISetInputParticles.h" -#include "Kernel/IStandardParticleProvider.h" #include "Kernel/ITagger.h" #include "Kernel/ITisTos.h" #include "Kernel/ITrackIsolation.h" diff --git a/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.xml b/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.xml index 604122f01..3578ce0e1 100644 --- a/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.xml +++ b/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.xml @@ -26,8 +26,6 @@ <class name = "IJetMaker"/> <class name = "ILifetimeFitter"/> <class name = "IMassFit"/> - <class name = "IP2VVAngleCalculator"/> - <class name = "IP2VVPartAngleCalculator"/> <class name = "IParticleArrayFilter"/> <class name = "IParticle2State"/> <class name = "IParticleCombiner"/> @@ -57,7 +55,6 @@ <class name = "ISetInputParticles"/> <class name = "IJets2Jets"/> <class name = "IDecayTreeFit"/> - <class name = "IStandardParticleProvider"/> <class name = "IParticleVeto"/> <exclusion> diff --git a/Phys/DaVinciMCKernel/Kernel/IP2VVMCPartAngleCalculator.h b/Phys/DaVinciMCKernel/Kernel/IP2VVMCPartAngleCalculator.h deleted file mode 100644 index 5d9e08fec..000000000 --- a/Phys/DaVinciMCKernel/Kernel/IP2VVMCPartAngleCalculator.h +++ /dev/null @@ -1,75 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef IMCANGLECALCULATOR_H -#define IMCANGLECALCULATOR_H 1 - -// Include files -// from STL -#include <string> - -// from Gaudi -#include "GaudiKernel/IAlgTool.h" - -// Forward declarations -namespace LHCb { - class MCParticle; -} - -static const InterfaceID IID_IP2VVMCPartAngleCalculator( "IP2VVMCPartAngleCalculator", 2, 0 ); - -/** @class IP2VVMCPartAngleCalculator IP2VVMCPartAngleCalculator.h Kernel/IP2VVMCPartAngleCalculator.h - * - * Calculates the three angles in a P->VV decay. The methods are called - * ThetaL, ThetaK and Phi to comply with the B->MuMuK* conventions and - * Theta_tr, Phi_tr and Theta_phi_tr to comply with the Bs->J/psi Phi - * conventions for the transversity basis. - * - * @author Thomas Blake, Greig Cowan - * @date 2007-08-13 - * @modified 2008-06-02 - */ -class IP2VVMCPartAngleCalculator : virtual public IAlgTool { -public: - // Return the interface ID - static const InterfaceID& interfaceID() { return IID_IP2VVMCPartAngleCalculator; } - - /// get theta_L (angle of the L+ wrt B in dilepton frame) - virtual double calculateThetaL( const LHCb::MCParticle* mother ) = 0; - - /// get theta_K (angle of the K+ wrt B in dilepton frame) - virtual double calculateThetaK( const LHCb::MCParticle* mother ) = 0; - - /// get phi (angle of the K* and LL decay planes in dilepton frame) - virtual double calculatePhi( const LHCb::MCParticle* mother ) = 0; - - /// get all three - virtual StatusCode calculateAngles( const LHCb::MCParticle* mother, double& thetal, double& thetak, double& phi ) = 0; - - /// get intermediate state mass (eg dilepton mass) - virtual double calculateMass( const LHCb::MCParticle* mother ) = 0; - - /// get Theta_tr (angle of the L+ wrt z-axis in dilepton frame) - virtual double calculateTransThetaTr( const LHCb::MCParticle* mother ) = 0; - - /// get Phi_tr (azimutal angle of the L+ in dilepton frame) - virtual double calculateTransPhiTr( const LHCb::MCParticle* mother ) = 0; - - /// get Theta_phi_tr (polar angle between the x'-axis and the decaying K+ in the dikaon frame) - virtual double calculateTransThetaV( const LHCb::MCParticle* mother ) = 0; - - /// get all three transversity angles - virtual StatusCode calculateTransversityAngles( const LHCb::MCParticle* mother, double& Theta_tr, double& Phi_tr, - double& Theta_V ) = 0; - -protected: -private: -}; -#endif // IMCANGLECALCULATOR_H diff --git a/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.h b/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.h index 03863fe8c..378b78693 100644 --- a/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.h +++ b/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.h @@ -29,7 +29,6 @@ #include "Kernel/IMC2Collision.h" #include "Kernel/IMCParticleArrayFilter.h" #include "Kernel/IMCParticleTupleTool.h" -#include "Kernel/IP2VVMCPartAngleCalculator.h" #include "Kernel/IPV2MC.h" #include "Kernel/IParticle2MCAssociator.h" #include "Kernel/IParticle2MCWeightedAssociator.h" diff --git a/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.xml b/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.xml index 5a1e7f43c..f3c1158c1 100644 --- a/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.xml +++ b/Phys/DaVinciMCKernel/dict/DaVinciMCKernelDict.xml @@ -21,7 +21,6 @@ <class name = "IMC2Collision"/> <class name = "IParticle2MCAssociator"/> <class name = "IParticle2MCWeightedAssociator"/> - <class name = "IP2VVMCPartAngleCalculator"/> <class name = "IPrintDecayTreeTool"/> <class name = "IPV2MC"/> <function pattern = "Particle2MCParticle::*"/> diff --git a/Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.cpp b/Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.cpp deleted file mode 100644 index 383a8d847..000000000 --- a/Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ - -// Include files - -#include "Event/Measurement.h" -#include "Event/Track.h" -// #include "Event/VeloClusterOnStoredTrack.h" - -// local -#include "CheckVeloOverlap.h" - -//----------------------------------------------------------------------------- -// Implementation file for class : CheckVeloOverlap: CheckVeloOverlap.cpp -// -// 28/06/2002 -//----------------------------------------------------------------------------- - -// Declaration of the Tool Factory -DECLARE_COMPONENT( CheckVeloOverlap ) - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -CheckVeloOverlap::CheckVeloOverlap( const std::string& type, const std::string& name, const IInterface* parent ) - : GaudiTool( type, name, parent ) { - // Declaring implemented interfaces - declareInterface<ICheckOverlap>( this ); - - // declareProperty("MaxCommonClusters", m_maxClusters = 0 ); - declareProperty( "MaxCommonClusterFraction", m_maxClusterFraction = 0.75 ); -} - -//=========================================================================== -/// Check for duplicate use of a protoparticle to produce particles. -/// Continue a previous check using the contents of the vector of pointers -/// to protoparticles.(Most intended for internal use by the recursive calls). -/// Arguments: parts is a vector of pointer to particles. -/// proto is a vector of pointers to protoparticles. -// Real checking method. Scans the tree headed by parts. Add each -// protoparticle to proto if it is a new one. Return true otherwise. -// If called directly by the user, it will continue a previous check, -// not start a new one! -//=========================================================================== -bool CheckVeloOverlap::foundOverlap( const LHCb::Particle::ConstVector& parts, - std::vector<const LHCb::ProtoParticle*>& proto ) const { - verbose() << "foundOverlap(parts, tracks) " << parts.size() << " " << proto.size() << endmsg; - StatusCode sc = addOrigins( parts, proto ); - if ( !sc ) { Exception( "Unable to get origin vector of particle vector" ); } - verbose() << "searching overlap" << endmsg; - return searchOverlap( proto ); -} -//=========================================================================== -// Check duplicate entries -//=========================================================================== -bool CheckVeloOverlap::searchOverlap( std::vector<const LHCb::ProtoParticle*>& proto ) const { - - verbose() << "searchOverlap(protos)" << endmsg; - // It its a simple particle made from track. Check. - for ( std::vector<const LHCb::ProtoParticle*>::const_iterator i = proto.begin(); i != proto.end(); ++i ) { - verbose() << "In single loop" << endmsg; - for ( std::vector<const LHCb::ProtoParticle*>::const_iterator j = i; j != proto.end(); ++j ) { - if ( j == i ) continue; - verbose() << "In double loop" << endmsg; - if ( shareVeloClusters( *i, *j ) ) return true; - } - } - return false; -} - -//=========================================================================== -// Other interfaces to the same thing -//=========================================================================== -bool CheckVeloOverlap::foundOverlap( const LHCb::Particle::ConstVector& parts ) const { - - verbose() << "foundOverlap(ParticleVector)" << endmsg; - LHCb::Particle::ConstVector cparts; - for ( LHCb::Particle::ConstVector::const_iterator i = parts.begin(); i != parts.end(); ++i ) { - cparts.push_back( *i ); - } - std::vector<const LHCb::ProtoParticle*> protos( 0 ); - return foundOverlap( cparts, protos ); -} -//=========================================================================== -bool CheckVeloOverlap::foundOverlap( const LHCb::Particle* particle1 ) const { - verbose() << "foundOverlap(1)" << endmsg; - if ( !particle1 ) Exception( "Null pointer" ); - const LHCb::Particle::ConstVector parts( 1, particle1 ); - std::vector<const LHCb::ProtoParticle*> protos( 0 ); - return foundOverlap( parts, protos ); -} -//=========================================================================== -bool CheckVeloOverlap::foundOverlap( const LHCb::Particle* particle1, const LHCb::Particle* particle2 ) const { - verbose() << "foundOverlap(2)" << endmsg; - if ( !particle1 || !particle2 ) Exception( "Null pointer" ); - LHCb::Particle::ConstVector parts; - parts.push_back( particle1 ); - parts.push_back( particle2 ); - std::vector<const LHCb::ProtoParticle*> protos( 0 ); - return foundOverlap( parts, protos ); -} -//=========================================================================== -bool CheckVeloOverlap::foundOverlap( const LHCb::Particle* particle1, const LHCb::Particle* particle2, - const LHCb::Particle* particle3 ) const { - verbose() << "foundOverlap(3)" << endmsg; - if ( !particle1 || !particle2 || !particle3 ) Exception( "Null pointer" ); - LHCb::Particle::ConstVector parts; - parts.push_back( particle1 ); - parts.push_back( particle2 ); - parts.push_back( particle3 ); - std::vector<const LHCb::ProtoParticle*> protos( 0 ); - return foundOverlap( parts, protos ); -} -//=========================================================================== -bool CheckVeloOverlap::foundOverlap( const LHCb::Particle* particle1, const LHCb::Particle* particle2, - const LHCb::Particle* particle3, const LHCb::Particle* particle4 ) const { - verbose() << "foundOverlap(4)" << endmsg; - if ( !particle1 || !particle2 || !particle3 || !particle4 ) Exception( "Null pointer" ); - LHCb::Particle::ConstVector parts; - parts.push_back( particle1 ); - parts.push_back( particle2 ); - parts.push_back( particle3 ); - parts.push_back( particle4 ); - std::vector<const LHCb::ProtoParticle*> protos( 0 ); - return foundOverlap( parts, protos ); -} -//=========================================================================== -// Check for duplicate use of a protoparticle to produce decay tree of -// any particle in vector. Removes found particles from vector. -//=========================================================================== -StatusCode CheckVeloOverlap::removeOverlap( LHCb::Particle::ConstVector& PV ) const { - verbose() << "removeOverlap( ParticleVector)" << endmsg; - LHCb::Particle::ConstVector Out; - for ( LHCb::Particle::ConstVector::const_iterator i = PV.begin(); i != PV.end(); ++i ) { - if ( !foundOverlap( *i ) ) Out.push_back( *i ); - } - PV = Out; - return StatusCode::SUCCESS; -} -//=========================================================================== -StatusCode CheckVeloOverlap::removeOverlap( LHCb::Particle::Vector& PV ) const { - verbose() << "removeOverlap( ParticleVector)" << endmsg; - LHCb::Particle::Vector Out; - for ( LHCb::Particle::Vector::const_iterator i = PV.begin(); i != PV.end(); ++i ) { - if ( !foundOverlap( *i ) ) Out.push_back( *i ); - } - PV = Out; - return StatusCode::SUCCESS; -} -//============================================================================= -// Replace resonance by daughters in vector, helper to the Tree methods -//============================================================================= -StatusCode CheckVeloOverlap::addOrigins( const LHCb::Particle::ConstVector& parts, - std::vector<const LHCb::ProtoParticle*>& protos ) const { - verbose() << "addOrigins() " << parts.size() << endmsg; - for ( LHCb::Particle::ConstVector::const_iterator c = parts.begin(); c != parts.end(); ++c ) { - - verbose() << "Particle loop " << endmsg; - verbose() << "ParticleID " << ( *c )->particleID() << endmsg; - verbose() << "Particle PID " << ( *c )->particleID().pid() << endmsg; - if ( ( *c )->proto() ) { - const LHCb::ProtoParticle* p1 = ( *c )->proto(); - verbose() << "has an origin " << p1 << endmsg; - protos.push_back( p1 ); - } else if ( ( *c )->endVertex() ) { - - verbose() << "has a vertex" << ( *c )->endVertex() << endmsg; - verbose() << "has a daughters " << ( *c )->endVertex()->outgoingParticles().size() << endmsg; - const LHCb::Particle::ConstVector dau = toStdVector( ( *c )->endVertex()->outgoingParticles() ); - StatusCode sc = addOrigins( dau, protos ); - if ( !sc ) return sc; - } else { - err() << "Particle " << ( *c )->particleID().pid() << " has no origin nor endVertex" << endmsg; - return StatusCode::FAILURE; - } - } - verbose() << "addOrigins() left " << protos.size() << endmsg; - return StatusCode::SUCCESS; -} -//=========================================================================== -// Check for shared velo hits -//=========================================================================== -bool CheckVeloOverlap::shareVeloClusters( const LHCb::ProtoParticle* c1, const LHCb::ProtoParticle* c2 ) const { - - verbose() << "shareVeloClusters" << endmsg; - const LHCb::Track* const tr1 = c1->track(); - if ( 0 == tr1 ) Error( "First ProtoParticle has no LHCb::Track!" ).ignore(); - const LHCb::Track* const tr2 = c2->track(); - if ( 0 == tr2 ) Error( "Second ProtoParticle has no LHCb::Track!" ).ignore(); - ; - - if ( tr1 == tr2 ) return true; // same track! - - long nVelos1 = 0; - long nVelos2 = 0; - long veloclustercomun = 0; - - const std::vector<LHCb::LHCbID>& meas1 = tr1->lhcbIDs(); - const std::vector<LHCb::LHCbID>& meas2 = tr2->lhcbIDs(); - - if ( meas1.empty() || meas2.empty() ) return false; // OK - - std::vector<LHCb::LHCbID>::const_iterator im1; - std::vector<LHCb::LHCbID>::const_iterator im2; - - for ( im1 = meas1.begin(); im1 != meas1.end(); ++im1 ) { - - const LHCb::LHCbID lhcbID1 = *im1; - - if ( lhcbID1.checkDetectorType( LHCb::LHCbID::channelIDtype::Velo ) ) { - nVelos1++; - for ( im2 = meas2.begin(); im2 != meas2.end(); ++im2 ) { - const LHCb::LHCbID lhcbID2 = *im2; - if ( lhcbID2.checkDetectorType( LHCb::LHCbID::channelIDtype::Velo ) ) { - if ( lhcbID1.channelID() == lhcbID2.channelID() ) veloclustercomun++; - } // meas2 is from VELO - } // im2 - } // meas 1 is from VELO - - } // im1 - - for ( im2 = meas2.begin(); im2 != meas2.end(); ++im2 ) { - if ( ( *im2 ).checkDetectorType( LHCb::LHCbID::channelIDtype::Velo ) ) nVelos2++; - } // im2 - - debug() << "VELO clusters: " << nVelos1 << ", " << nVelos2 << ". In common: " << veloclustercomun << endmsg; - - const double commfrac = 2. * veloclustercomun / ( nVelos1 + nVelos2 ); - return commfrac > m_maxClusterFraction; -} -//=========================================================================== -// Auxiliary function to convert a SmartRefVector<T>& to a std::vector<T*> -//=========================================================================== -template <class T> -std::vector<const T*> toStdVector( const SmartRefVector<T>& refvector ) { - std::vector<const T*> tvector; - for ( typename SmartRefVector<T>::const_iterator ip = refvector.begin(); ip != refvector.end(); ++ip ) { - tvector.push_back( *ip ); - } - return tvector; -} -//=========================================================================== diff --git a/Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.h b/Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.h deleted file mode 100644 index 77723bdbf..000000000 --- a/Phys/DaVinciOverlapsAndClones/src/CheckVeloOverlap.h +++ /dev/null @@ -1,106 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef CHECKVELOOVERLAP_H -#define CHECKVELOOVERLAP_H 1 - -// Include files -// from STL -#include <string> - -// from Gaudi -#include "GaudiAlg/GaudiTool.h" - -// From PhysEvent -#include "Event/Particle.h" -#include "Event/ProtoParticle.h" - -// from DaVinci -#include "Kernel/ICheckOverlap.h" - -/** @class CheckVeloOverlap CheckVeloOverlap.h - * - * Tool to check if particles share velo hits - * - * @author P. Koppenburg, based on code from Miriam Calvo - * @date 02/06/2005 - */ -class CheckVeloOverlap : public GaudiTool, virtual public ICheckOverlap { -public: - /// Standard constructor - CheckVeloOverlap( const std::string& type, const std::string& name, const IInterface* parent ); - ///< Destructor - ~CheckVeloOverlap(){}; - //=========================================================================== - /// Check for duplicate use of a protoparticle to produce particles. - /// Argument: parts is a vector of pointers to particles. - /// Create an empty vector of pointers to protoparticles. - /// Call the real check method. - - /// backward-compatible method - bool foundOverlap( const LHCb::Particle::ConstVector& parts ) const override; - - //=========================================================================== - /// Check for duplicate use of a protoparticle to produce particles. - /// Arguments: particle1 up to particle4 are pointers to particles. - /// Create a ParticleVector and fill it with the input particles. - /// Create an empty vector of pointers to protoparticles. - /// Call the real check method. - - bool foundOverlap( const LHCb::Particle* ) const override; - bool foundOverlap( const LHCb::Particle*, const LHCb::Particle* ) const override; - bool foundOverlap( const LHCb::Particle*, const LHCb::Particle*, const LHCb::Particle* ) const override; - bool foundOverlap( const LHCb::Particle*, const LHCb::Particle*, const LHCb::Particle*, - const LHCb::Particle* ) const override; - - //=========================================================================== - /// Check for duplicate use of a protoparticle to produce particles. - /// Continue a previous check using the contents of the vector of pointers - /// to protoparticles.(Most intended for internal use by the other methods). - /// Arguments: parts is a vector of pointer to particles. - /// proto is a vector of pointers to protoparticles. - // Real checking method. Scans the tree headed by parts. Add each - // protoparticle to proto if it is a new one. Returns true otherwise. - // If called directly by the user, it will continue a previous check, - // not start a new one! - //=========================================================================== - bool foundOverlap( const LHCb::Particle::ConstVector& parts, std::vector<const LHCb::ProtoParticle*>& proto ) const; - - /// Check for duplicate use of a protoparticle to produce decay tree of - /// any particle in vector. Removes found particles from vector. - StatusCode removeOverlap( LHCb::Particle::ConstVector& ) const override; - - /// Check for duplicate use of a protoparticle to produce decay tree of - /// any particle in vector. Removes found particles from vector. - StatusCode removeOverlap( LHCb::Particle::Vector& ) const; - -protected: - StatusCode addOrigins( const LHCb::Particle::ConstVector&, std::vector<const LHCb::ProtoParticle*>& ) const; - - /// Only look at protoparticles - bool searchOverlap( std::vector<const LHCb::ProtoParticle*>& proto ) const; - bool shareVeloClusters( const LHCb::ProtoParticle*, const LHCb::ProtoParticle* ) const; - -private: - // int m_maxClusters ; /// Maximum acceptable number of common clusters - double m_maxClusterFraction; /// Maximum acceptable fraction of common cluster - -}; // End of class header. - -// Implement inline methods: - -// The real checking method is implemented in CheckVeloOverlap.cpp -//=========================================================================== -/// Auxiliary function to convert a SmartRefVector<T>& to a std::vector<T*> -//=========================================================================== -template <class T> -std::vector<const T*> toStdVector( const SmartRefVector<T>& refvector ); - -#endif // CHECKVELOOVERLAP_H diff --git a/Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.cpp b/Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.cpp deleted file mode 100644 index ae42367a5..000000000 --- a/Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.cpp +++ /dev/null @@ -1,359 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ - -#include "HighPtIsoLeptonAndTagPV.h" - -#include "Event/ODIN.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiAlg/ITupleTool.h" -#include "Kernel/DaVinciAlgorithm.h" -#include "Kernel/IParticleTransporter.h" -#include "LHCbMath/LHCbMath.h" -#include <Kernel/IDistanceCalculator.h> -#include <Kernel/IVertexFit.h> - -/** @file - * Implementation file for class HighPtIsoLeptonAndTagPV - * @author Cedric POTTERAT cedric.potterat@epfl.ch - * @date 2008-11-24 - */ - -/* standard initialization of the tool - * @return status code - */ - -DECLARE_COMPONENT( HighPtIsoLeptonAndTagPV ) - -StatusCode HighPtIsoLeptonAndTagPV::initialize() { - - StatusCode sc = DaVinciAlgorithm::initialize(); - if ( sc.isFailure() ) return sc; - - if ( 0 == m_pVertexFit ) m_pVertexFit = vertexFitter( "OfflineVertexFitter" ); - - if ( 0 == m_combiner ) m_combiner = tool<IParticleCombiner>( m_combinerName, this ); - - if ( 0 == m_transporter ) m_transporter = tool<IParticleTransporter>( m_transporterName, this ); - - m_dist = tool<IDistanceCalculator>( "LoKi::DistanceCalculator" ); - if ( !m_dist ) { - err() << "Unable to Retrieve LoKi::DistanceCalculator" << endmsg; - return StatusCode::FAILURE; - } - - if ( msgLevel( MSG::DEBUG ) ) { - debug() << " ------------------------------------------------------ " << endmsg; - debug() << " | | " << endmsg; - debug() << " | Prompt Lepton | " << endmsg; - debug() << " | | " << endmsg; - debug() << " | EPFLausanne - 2011 | " << endmsg; - debug() << " | A. Bay & C. Potterat | " << endmsg; - debug() << " | | " << endmsg; - debug() << " ------------------------------------------------------ " << endmsg; - debug() << " | " << endmsg; - debug() << " | parameters: " << endmsg; - debug() << " | ISOPromptLeptonID " << m_LeptID << endmsg; - debug() << " | NoISOPromptLeptonID " << m_niLeptID << endmsg; - debug() << " | JetR " << m_LeptRmax << endmsg; - debug() << " | MuPtTrackMin " << m_LeptMuPtTrackMin << endmsg; - debug() << " | ElPtTrackMin " << m_LeptElPtTrackMin << endmsg; - debug() << " | IPmax " << m_LeptIPmax << endmsg; - debug() << " | EJoverEL " << m_LeptEJoverEL << endmsg; - debug() << " | " << endmsg; - debug() << " ------------------------------------------------------ " << endmsg; - } - - return sc; -} - -// =========================================================================== -// find the jets -// =========================================================================== -StatusCode HighPtIsoLeptonAndTagPV::execute() { - - setFilterPassed( true ); - - std::vector<LHCb::Particle> MyLeptons; - LHCb::Particle::Vector LeptonsSeliso; - LHCb::Particle::Vector LeptonsSelnoiso; - - StatusCode sc; - - //----------------------------------------// - // Options for the PV: // - // if multiple PV -> choose the one with // - // biggest the sum of tracks.Pt() // - //----------------------------------------// - - LHCb::Particles* IsoLept = new LHCb::Particles(); - LHCb::Particles* IsoLeptJet = new LHCb::Particles(); - Table* table = new Table(); - - std::string location_iso, location_isoj, location_isopv; - std::string location_noisopv, location_noisoj, location_noiso; - std::string location_z0pv, location_z0; - - location_iso = "/Event/Phys/IsoLeptons/Particles"; - location_isoj = "/Event/Phys/IsoLeptons/IsoLeptJets/Particles"; - - std::string table_loc; - table_loc = "/Event/Phys/IsoLeptons/Lept2JetsRelations"; - - put( IsoLept, location_iso ); - put( IsoLeptJet, location_isoj ); - put( table, table_loc ); - - LHCb::Particle::ConstVector RealParts = this->i_particles(); - const LHCb::RecVertex::Range pvs = this->primaryVertices(); - - if ( pvs.size() < 1 ) return StatusCode::SUCCESS; - if ( RealParts.size() < 1 ) return StatusCode::SUCCESS; - - for ( LHCb::RecVertex::Range::const_iterator i_pv = pvs.begin(); pvs.end() != i_pv; i_pv++ ) { - - std::vector<Gaudi::XYZVector> Slopes_flag; - - LHCb::Particle::ConstVector all; - LHCb::Particle::Vector LeptonsSel; - LHCb::Particle::Vector LeptonsSelJet; - LHCb::RecVertex::Vector myPV; - - if ( msgLevel( MSG::DEBUG ) ) debug() << "(*i_pv) ->position = " << ( *i_pv )->position() << endmsg; - - for ( LHCb::Particle::ConstVector::const_iterator ip = RealParts.begin(); RealParts.end() != ip; ++ip ) { - const LHCb::Particle* p = *ip; - - if ( 0 == p ) { - Warning( "Invalid input particle" ).ignore(); - continue; - } - - if ( p->charge() == 0 ) { - if ( p->particleID().abspid() != 310 && p->particleID().abspid() != 3122 ) { - } else if ( ( DaVinciAlgorithm::bestPV( p ) )->key() == ( *i_pv )->key() ) { - } else - continue; - } else { - - if ( ( p->particleID().isLepton() ) ) { - if ( msgLevel( MSG::DEBUG ) ) debug() << "p->particleID().abspid() = " << p->particleID().abspid() << endmsg; - - if ( msgLevel( MSG::DEBUG ) ) - debug() << "DaVinciAlgorithm::bestPV(p)->position = " << ( DaVinciAlgorithm::bestPV( p ) )->position() - << endmsg; - } - - if ( LHCb::Track::Types::Downstream == p->proto()->track()->type() ) { - } else if ( ( DaVinciAlgorithm::bestPV( p ) )->key() == ( *i_pv )->key() ) { - } else { - } // continue ;} - } - - bool m_FilterPart = true; - //----------------------------------------// - // check if 1 particle is not twice on // - // the TES with the slopes // - //----------------------------------------// - bool flag_same = false; - if ( m_FilterPart ) { - if ( Slopes_flag.size() != 0 ) { - for ( int k = 0; k < (int)Slopes_flag.size(); k++ ) { - if ( Slopes_flag.at( k ) == p->slopes() ) { - flag_same = true; - // verbose() << "same slopes !! s1: " <<Slopes_flag.at(k) << " s2: " << p->slopes() <<endmsg; - break; - } - } - } - if ( !flag_same ) { - Slopes_flag.push_back( p->slopes() ); - } else { - continue; - } - } - - all.push_back( p ); - - // verbose() << "p->particleID().abspid() = " << p->particleID().abspid()<< endmsg; - // verbose() << "p->charge() = " << p->charge()<< endmsg; - if ( p->charge() == 0 ) continue; - // verbose() << "p->proto() = " << p->proto()<< endmsg; - if ( p->proto() == NULL ) continue; - // verbose() << "p->proto()->track() = " << p->proto()->track()<< endmsg; - if ( p->proto()->track() == NULL ) continue; - // verbose() << "p->proto()->track()->type() = " << p->proto()->track()->type()<< endmsg; - if ( p->proto()->track()->type() != LHCb::Track::Types::Long ) continue; - // verbose() << "p->proto()->track()->chi2PerDoF() = " << p->proto()->track()->chi2PerDoF()<< endmsg; - if ( p->proto()->track()->chi2PerDoF() > m_TrkChi2DoF ) continue; - - double ipl = 0.; - double chi2l = 9999999999999.; - - LHCb::VertexBase* VertB = ( *i_pv )->clone(); - sc = m_dist->distance( p, VertB, ipl, chi2l ); - - delete VertB; - if ( sc.isFailure() ) { - // warning()<< "can measure dist ip, chi2 from pv"<< endmsg; - continue; - } - // verbose() << " delete *VertB;"<< endmsg; - // verbose() << "p->particleID() = "<<p->particleID() << endmsg; - // verbose() << "p->particleID().abspid( = "<<p->particleID().abspid() << endmsg; - - if ( !( p->particleID().isLepton() ) ) continue; - if ( msgLevel( MSG::DEBUG ) ) - debug() << "lepton :" << p->particleID().abspid() << " (pt :" << p->pt() << "): ip / chi2: " << ipl << " " - << chi2l << " " << endmsg; - - if ( p->particleID().abspid() == 11 ) - if ( p->pt() < m_LeptElPtTrackMin ) continue; - - if ( p->particleID().abspid() == 13 ) - if ( p->pt() < m_LeptMuPtTrackMin ) continue; - - if ( sqrt( chi2l ) > m_LeptSignif ) continue; - - if ( ipl > m_LeptIPmax ) continue; - - LeptonsSel.push_back( p->clone() ); - - myPV.push_back( ( *i_pv )->clone() ); - - } // end particles - - //----------------------------------------// - // prepare the inputs // - // selected the good particles for the // - // isoletp algo (ip,ipe,charge,pt......) // - // and the prompt leptons // - //----------------------------------------// - - if ( msgLevel( MSG::DEBUG ) ) debug() << "Particle ALL size = " << RealParts.size() << endmsg; - if ( msgLevel( MSG::DEBUG ) ) debug() << "Particle ALL size (JetCone) = " << all.size() << endmsg; - if ( msgLevel( MSG::DEBUG ) ) - debug() << "NLeptons for iso test = " << LeptonsSel.size() << endmsg; - - //----------------------------------------// - // get the Isolated and NoIso Leptons // - // check on the prompt leptons // - //----------------------------------------// - int isol = 0; - if ( (int)LeptonsSel.size() > 0 ) { - - //----------------------------------------// - // check the Energy of the cone arround // - // the lepton, if EJ over EL is < than ...// - // the lepton is locally isolated // - //----------------------------------------// - - LHCb::Particle::Vector::iterator ip1; - int mv = 0; - for ( ip1 = LeptonsSel.begin(); ip1 != LeptonsSel.end(); ++ip1 ) { - LHCb::Particle* p_iso = *ip1; - - LHCb::Particle P_jet = - JetCone( m_LeptRmax, Gaudi::XYZPoint( p_iso->momentum().Vect() ), p_iso->referencePoint(), m_LeptID, all ); - if ( msgLevel( MSG::DEBUG ) ) - debug() << "TEST | ID: " << p_iso->particleID().pid() << " | Pt: " << p_iso->pt() - << " | EJ over EL: " << P_jet.momentum().E() / p_iso->momentum().E() << endmsg; - - if ( ( P_jet.momentum().E() / p_iso->momentum().E() ) < m_LeptEJoverEL ) { - LHCb::Particle* P_Jet = P_jet.clone(); - p_iso->setReferencePoint( ( *i_pv )->position() ); - IsoLept->insert( p_iso ); - IsoLeptJet->insert( P_Jet ); - table->relate( p_iso, P_Jet ).ignore(); - isol++; - if ( msgLevel( MSG::DEBUG ) ) - debug() << "Ilept" << mv << "| ID: " << p_iso->particleID().pid() << " | Pt: " << p_iso->pt() - << " | EJ over EL: " << P_jet.momentum().E() / p_iso->momentum().E() << endmsg; - if ( msgLevel( MSG::DEBUG ) ) debug() << " | m : " << p_iso->momentum() << endmsg; - if ( msgLevel( MSG::DEBUG ) ) - debug() << " | eta: " << p_iso->momentum().eta() << " / phi: " << p_iso->momentum().phi() << endmsg; - } - } - mv++; - - } // end of p - } - - if ( msgLevel( MSG::DEBUG ) ) { m_nPlepton += MyLeptons.size(); } - - //----------------------------------------// - setFilterPassed( true ); - return StatusCode::SUCCESS; -} - -//============================================================================= -// JETCONE: THE HEART OF EVERYTHING, BUILDS A JET AROUND A SEED -//============================================================================= -LHCb::Particle HighPtIsoLeptonAndTagPV::JetCone( const double& Rmax, Gaudi::XYZPoint v, Gaudi::XYZPoint v1, - const int& myID, LHCb::Particle::ConstVector& parts ) const { - // kind =0 : all - // 1: chg - // 2 : pho - // using namespace LoKi ; - // using namespace LoKi::Fits ; - // using namespace LoKi::Cuts ; - // using namespace LoKi::Extract ; - - LHCb::Particle pJet; - LHCb::Vertex vJet; - LHCb::Particle::ConstVector daughters; - - pJet.setParticleID( LHCb::ParticleID( myID ) ); - - pJet.setReferencePoint( v1 ); - - const double PI = 3.14159265; - double R, Dphi, phi, phi2, e, e2; - - const LHCb::ParticleID IDg( 22 ); - // Particle::ConstVector* JetParts; - - // Range parts = select ( "all" , PALL ) ; - // const Particle::ConstVector& parts = PartIP; - // const Particle::ConstVector& parts = m_context->desktop()->particles(); - if ( msgLevel( MSG::DEBUG ) ) debug() << "Particle size (JetCone)= " << parts.size() << endmsg; - - phi = v.phi(); - e = v.eta(); - Gaudi::LorentzVector ptot = Gaudi::LorentzVector( 0., 0., 0., 0. ); - LHCb::Particle::ConstVector::const_iterator ip; - - for ( ip = parts.begin(); ip != parts.end(); ++ip ) { - - const LHCb::Particle* myPart = *ip; - Gaudi::LorentzVector p1 = ( *ip )->momentum(); - - // LHCb::ParticleID ID = myPart->particleID(); - - phi2 = ( *ip )->momentum().phi(); - e2 = ( *ip )->momentum().eta(); - Dphi = fabs( phi - phi2 ); - if ( Dphi > PI ) { Dphi = 2 * PI - Dphi; }; - R = sqrt( Dphi * Dphi + ( e - e2 ) * ( e - e2 ) ); - - if ( R > Rmax ) continue; - ptot = ptot + p1; - daughters.push_back( myPart ); - } - - if ( daughters.empty() ) { Warning( "Empty list of of daughter particles, skip it" ).ignore(); } - - StatusCode sc = m_combiner->combine( daughters, pJet, vJet ); - if ( sc.isFailure() ) { Warning( "Error from momentum combiner, skip", sc, 0 ).ignore(); } - - pJet.setMomentum( Gaudi::LorentzVector( ptot ) ); - - return pJet; -} diff --git a/Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.h b/Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.h deleted file mode 100644 index bfac53393..000000000 --- a/Phys/JetAccessories/src/HighPtIsoLeptonAndTagPV.h +++ /dev/null @@ -1,143 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#pragma once - -#include "GaudiAlg/GaudiTool.h" -#include "GaudiAlg/ITupleTool.h" -#include "GaudiKernel/IAlgTool.h" - -#include "Kernel/DaVinciAlgorithm.h" -#include "Kernel/IParticleCombiner.h" - -#include "CaloDet/DeCalorimeter.h" -#include "Event/CaloDigit.h" -#include "Event/Particle.h" -#include "GaudiKernel/IIncidentSvc.h" -#include "Kernel/IParticleTransporter.h" -#include "Kernel/IVertexFit.h" -#include <Kernel/IDistanceCalculator.h> - -struct IDistanceCalculator; - -class HighPtIsoLeptonAndTagPV : public DaVinciAlgorithm { -public: - HighPtIsoLeptonAndTagPV( const std::string& name, ISvcLocator* pSvcLocator ) - : DaVinciAlgorithm( name, pSvcLocator ) - - , m_FilterPart( true ) - , m_LeptID( 10099 ) - , m_niLeptID( 10199 ) - , m_LeptEJoverEL( 1.3 ) - , m_LeptRmax( 0.45 ) - , m_LeptMuPtTrackMin( 5000.0 ) - , m_LeptElPtTrackMin( 5000.0 ) - - , m_LeptIPmax( 0.1 ) - , m_LeptSignif( 1. ) - - , m_LeptjetMomRaw( false ) - , m_ipTool( 0 ) - , m_pVertexFit( 0 ) - - , m_combinerName( "MomentumCombiner" ) - , m_combiner( 0 ) - - , m_transporterName( "ParticleTransporter:PUBLIC" ) // The name of particle transpoter tool - , m_transporter( 0 ) - - , m_TrkChi2DoF( 2.5 ) - - { - - declareProperty( "FilterPart", m_FilterPart ); - - declareProperty( "IsoLeptID", m_LeptID, "Particle ID for the Lepton" ); - declareProperty( "NoIsoLeptID", m_niLeptID, "Particle ID for the Lepton" ); - - declareProperty( "LeptEJoverEL", m_LeptEJoverEL ); - declareProperty( "LeptJetR", m_LeptRmax ); - declareProperty( "LeptMuPtTrackMin", m_LeptMuPtTrackMin ); - declareProperty( "LeptElPtTrackMin", m_LeptElPtTrackMin ); - declareProperty( "LeptIPmax", m_LeptIPmax ); - declareProperty( "LeptSignif", m_LeptSignif ); - declareProperty( "LeptJetRawEnergy", m_LeptjetMomRaw ); - declareProperty( "VertexFitter", m_typeVertexFit = "Default" ); - - // define momentum combiner - declareProperty( "ParticleCombiner", m_combinerName ); - - declareProperty( "Transporter", m_transporterName, "The Particle Transporter tool to be used" ); - - declareProperty( "SeedTrkChi2PerDoF", m_TrkChi2DoF, "max chi2PerDoF for the track used for the vtx" ); - } - - /** standard initialization of the tool - * @return status code - */ - StatusCode initialize() override; - - StatusCode execute() override; - -protected: - /// make the detailed check of all parameters - inline StatusCode check() const { return StatusCode( StatusCode::SUCCESS, true ); } - - LHCb::Particle JetCone( const double&, Gaudi::XYZPoint, Gaudi::XYZPoint, const int&, - LHCb::Particle::ConstVector& ) const; - - StatusCode GetIsoLeptons( LHCb::Particle::ConstVector InLeptons, LHCb::Particle::ConstVector inputParts, - std::vector<LHCb::Particle>& Leptons, int& ) const; - - void RemoveTracks( LHCb::Particle::ConstVector& particles, const LHCb::RecVertex PV ) const; - - bool m_FilterPart; - - int m_LeptID; ///< proposed jet ID - int m_niLeptID; ///< proposed jet ID - - bool m_useNN; - double m_LeptEJoverEL; - double m_LeptRmax; - double m_LeptMuPtTrackMin; - double m_LeptElPtTrackMin; - - double m_LeptIPmax; - - double m_LeptSignif; - bool m_LeptjetMomRaw; - - ITupleTool* m_tuple; - const IDistanceCalculator* m_ipTool; - const IVertexFit* m_pVertexFit; - - std::string m_combinerName; - mutable IParticleCombiner* m_combiner; ///< combiner to be used - - std::string m_transporterName; - - mutable IParticleTransporter* m_transporter; - - std::string m_geomToolName; - std::string m_typeVertexFit; - - const IDistanceCalculator* distanceCalculator; - - const IDistanceCalculator* m_dist; - - double m_TrkChi2DoF; - - typedef LHCb::Relation1D<LHCb::Particle, LHCb::Particle> Table; - -private: - mutable Gaudi::Accumulators::StatCounter<> m_nPlepton{this, "#Plepton"}; -}; - -DECLARE_COMPONENT( HighPtIsoLeptonAndTagPV ) diff --git a/Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.cpp b/Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.cpp deleted file mode 100644 index ecbf814f8..000000000 --- a/Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// Include files - -#include "Event/Particle.h" -// kernel -#include "GaudiKernel/PhysicalConstants.h" -#include "Kernel/RelatedInfoNamed.h" - -// local -#include "RelInfoVertexIsolationDetached.h" - -#include "GaudiAlg/Tuple.h" -#include "GaudiAlg/TupleObj.h" -#include <Kernel/GetIDVAlgorithm.h> -#include <Kernel/IDVAlgorithm.h> -#include <Kernel/IDistanceCalculator.h> -#include <Kernel/IVertexFit.h> - -#include "Event/Particle.h" - -using namespace LHCb; - -//----------------------------------------------------------------------------- -// Implementation file for class : TupleToolVtxIsoln -// -// @author Mitesh Patel, Patrick Koppenburg -// @date 2008-04-15 -//----------------------------------------------------------------------------- - -// Declaration of the Tool Factory -// actually acts as a using namespace TupleTool -DECLARE_COMPONENT( RelInfoVertexIsolationDetached ) - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -RelInfoVertexIsolationDetached::RelInfoVertexIsolationDetached( const std::string& type, const std::string& name, - const IInterface* parent ) - : GaudiTool( type, name, parent ), m_dva( 0 ), m_dist( 0 ), m_pVertexFit( 0 ) { - declareInterface<IRelatedInfoTool>( this ); - - m_inputParticles.push_back( "/Event/Phys/StdNoPIDsPions" ); - - declareProperty( "MaxDeltaChi2", m_deltaChi2 = 9.0 ); - declareProperty( "MaxChi2", m_Chi2 = 9.0 ); - declareProperty( "VertexFit", m_typeVertexFit = "default" ); - declareProperty( "InputParticles", m_inputParticles ); - declareProperty( "Variables", m_variables, "List of variables to store (store all if empty)" ); -} - -//============================================================================= - -StatusCode RelInfoVertexIsolationDetached::initialize() { - const StatusCode sc = GaudiTool::initialize(); - if ( sc.isFailure() ) return sc; - - m_dva = Gaudi::Utils::getIDVAlgorithm( contextSvc(), this ); - if ( !m_dva ) return Error( "Couldn't get parent DVAlgorithm", StatusCode::FAILURE ); - - m_dist = m_dva->distanceCalculator(); - if ( !m_dist ) { - Error( "Unable to retrieve the IDistanceCalculator tool" ).ignore(); - return StatusCode::FAILURE; - } - - m_pVertexFit = m_dva->vertexFitter(); - if ( !m_pVertexFit ) { - Error( "Unable to retrieve the IVertexFit tool" ).ignore(); - return StatusCode::FAILURE; - } - - m_keys.clear(); - - if ( m_variables.empty() ) { - - if ( msgLevel( MSG::DEBUG ) ) debug() << "List of variables empty, adding all" << endmsg; - m_keys.push_back( RelatedInfoNamed::VTXISODETNOPARTWITHINDCHI2WDW ); - m_keys.push_back( RelatedInfoNamed::VTXISODETNOPARTWITHINCHI2WDW ); - m_keys.push_back( RelatedInfoNamed::VTXISODETSMALLESTCHI2 ); - m_keys.push_back( RelatedInfoNamed::VTXISODETSMALLESTDELTACHI2 ); - - } else { - - for ( const auto& var : m_variables ) { - short int key = RelatedInfoNamed::indexByName( var ); - if ( key != RelatedInfoNamed::UNKNOWN ) { - m_keys.push_back( key ); - debug() << "Adding variable " << var << ", key = " << key << endmsg; - } else { - warning() << "Unknown variable " << var << ", skipping" << endmsg; - } - } - } - - return sc; -} - -//============================================================================= - -RelInfoVertexIsolationDetached::~RelInfoVertexIsolationDetached() {} - -//============================================================================= -// Fill Cone Info structure -//============================================================================= -StatusCode RelInfoVertexIsolationDetached::calculateRelatedInfo( const LHCb::Particle* mother, - const LHCb::Particle* P ) { - - // -------------------------------------------------- - - // find the origin vertex. Either the primary or the origin in the - // decay - /* - const VertexBase* vtx = 0; - if( mother != P ) vtx = originVertex( mother, P ); - if( !vtx ){ - Error("Can't retrieve the origin vertex for " + prefix ); - return StatusCode::FAILURE; - } - */ - const LHCb::Vertex* vtx = ( P->isBasicParticle() || isPureNeutralCalo( P ) ? mother->endVertex() : P->endVertex() ); - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "vertex for P, ID " << P->particleID().pid() << " = " << vtx << " at " << vtx->position() << endmsg; - } - if ( !vtx ) { - Error( "Can't retrieve the vertex" ).ignore(); - return StatusCode::FAILURE; - } - - // The vertex chi2 of the composite particle being tested - const double vtxChi2 = vtx->chi2(); - - //-------------------------------------------------- - // Get all the particle's final states - LHCb::Particle::ConstVector source; - LHCb::Particle::ConstVector target; - LHCb::Particle::ConstVector finalStates; - LHCb::Particle::ConstVector parts2Vertex; - - // const LHCb::Particle* prefix = P; - if ( P->isBasicParticle() ) { - source.push_back( mother ); - } else { - source.push_back( P ); - } - // The first iteration is for the particle to filter, which has an endVertex - do { - target.clear(); - for ( LHCb::Particle::ConstVector::const_iterator isource = source.begin(); isource != source.end(); isource++ ) { - - if ( !( ( *isource )->daughters().empty() ) ) { - - const LHCb::Particle::ConstVector& tmp = ( *isource )->daughtersVector(); - - for ( LHCb::Particle::ConstVector::const_iterator itmp = tmp.begin(); itmp != tmp.end(); ++itmp ) { - target.push_back( *itmp ); - - // Add the final states, i.e. particles with proto and ignoring gammas - if ( ( *itmp )->proto() && !isPureNeutralCalo( *itmp ) ) finalStates.push_back( *itmp ); - } - } // if endVertex - } // isource - source = target; - } while ( target.size() > 0 ); - - if ( msgLevel( MSG::DEBUG ) ) debug() << "Final states size= " << finalStates.size() << endmsg; - - //-------------------------------------------------- - // Build vector of particles, excluding signal - LHCb::Particle::ConstVector theParts; - - for ( std::vector<std::string>::iterator i = m_inputParticles.begin(); i != m_inputParticles.end(); ++i ) { - - if ( !exist<LHCb::Particle::Range>( *i + "/Particles" ) ) { - if ( msgLevel( MSG::DEBUG ) ) debug() << "No particles at " << *i << " !!!!!" << endmsg; - continue; - } - - LHCb::Particle::Range parts = get<LHCb::Particle::Range>( *i + "/Particles" ); - - if ( msgLevel( MSG::DEBUG ) ) - debug() << "Getting particles from " << *i << " with " << ( parts ).size() << " particles" << endmsg; - - for ( LHCb::Particle::Range::const_iterator iparts = ( parts ).begin(); iparts != ( parts ).end(); ++iparts ) { - - // Ignore if no proto - if ( !( *iparts )->proto() ) continue; - // Ignore if proto and gammas - if ( isPureNeutralCalo( *iparts ) ) continue; - - // Compare protos, not pointers (e.g. because of clones) - bool isSignal = false; - for ( LHCb::Particle::ConstVector::const_iterator signal = finalStates.begin(); signal != finalStates.end(); - ++signal ) { - const LHCb::ProtoParticle* orig = ( *signal )->proto(); - if ( !orig ) continue; - if ( orig != ( *iparts )->proto() ) continue; - isSignal = true; - break; - } - - // Ignore if it is a signal particle - if ( isSignal ) continue; - - // Check that the same particle does not appear twice - bool isIn = false; - for ( LHCb::Particle::ConstVector::const_iterator result = theParts.begin(); result != theParts.end(); - ++result ) { - const LHCb::ProtoParticle* orig = ( *result )->proto(); - if ( !orig ) continue; - if ( orig != ( *iparts )->proto() ) continue; - isIn = true; - break; - } - - // Already in ? - if ( isIn ) continue; - if ( !isIn ) theParts.push_back( *iparts ); - - } // iparts - } // m_inputParticles - - if ( msgLevel( MSG::DEBUG ) ) - debug() << "Number of particles to check excluding signal, particles with same proto and gammas = " - << theParts.size() << endmsg; - //-------------------------------------------------- - - /*Now we want to make a list of daughters - - */ - - // if the daughter - if ( P->isBasicParticle() ) { - parts2Vertex.push_back( P ); - } else { - parts2Vertex = P->daughtersVector(); - } - - if ( msgLevel( MSG::DEBUG ) ) - debug() << "Now final states should include only your particles direct desendents. finalStates.size()= " - << finalStates.size() << endmsg; - - int nCompatibleDeltaChi2 = 0; - int nCompatibleChi2 = 0; - double smallestChi2 = -1; - double smallestDeltaChi2 = -1; - - // Now count how many particles are compatible with the vertex of the particle under study - for ( LHCb::Particle::ConstVector::const_iterator iparts = theParts.begin(); iparts != theParts.end(); ++iparts ) { - - LHCb::Vertex vtxWithExtraTrack; - - // Temporarily add the extra track to the parts2Vertex - parts2Vertex.push_back( *iparts ); - // if (msgLevel(MSG::DEBUG)) debug() << "Adding trk pid" << (*iparts)->particleID().pid() << " to vtx" << endmsg; - - // Fit - StatusCode sc = m_pVertexFit->fit( vtxWithExtraTrack, parts2Vertex ); - // replaced by V.B. 20.Aug.2k+9: (parts2Vertex,vtxWithExtraTrack); - // Remove the added track from parts2Vertex - - parts2Vertex.pop_back(); - if ( !sc ) { - // Warning("Failed to fit vertex").ignore(); - // return sc; - } else { - double dChi2 = vtxWithExtraTrack.chi2() - vtxChi2; - // fabs(vtxChi2 - vtxWithExtraTrack.chi2()) < m_deltaChi2 is not useful if the particle is basic - if ( dChi2 < m_deltaChi2 && m_deltaChi2 > 0.0 && ( !P->isBasicParticle() ) ) nCompatibleDeltaChi2++; - if ( ( vtxWithExtraTrack.chi2() < m_Chi2 ) && ( m_Chi2 > 0.0 ) ) nCompatibleChi2++; - if ( msgLevel( MSG::DEBUG ) ) - debug() << "Fitted vertex adding track has Delta chi2 = " << dChi2 << "chi2 = " << vtxWithExtraTrack.chi2() - << endmsg; - if ( smallestChi2 < 0 || smallestChi2 > vtxWithExtraTrack.chi2() ) smallestChi2 = vtxWithExtraTrack.chi2(); - if ( smallestDeltaChi2 < 0 || smallestDeltaChi2 > dChi2 ) smallestDeltaChi2 = dChi2; - } - - } // iparts - if ( P->isBasicParticle() ) nCompatibleDeltaChi2 = -1; - - if ( msgLevel( MSG::DEBUG ) ) { - if ( m_deltaChi2 > 0.0 ) - debug() << "Number of particles with delta chi2 < cut Delta chi2 = " << nCompatibleDeltaChi2 << endmsg; - if ( m_Chi2 > 0.0 ) debug() << "Number of particles with chi2 < cut chi2 = " << nCompatibleChi2 << endmsg; - } - - if ( m_deltaChi2 < 0.0 ) nCompatibleDeltaChi2 = 0; - if ( m_Chi2 < 0.0 ) nCompatibleChi2 = 0; - - m_map.clear(); - - for ( const auto key : m_keys ) { - - float value = 0; - switch ( key ) { - case RelatedInfoNamed::VTXISODETNOPARTWITHINDCHI2WDW: - value = (float)nCompatibleDeltaChi2; - break; - case RelatedInfoNamed::VTXISODETNOPARTWITHINCHI2WDW: - value = (float)nCompatibleChi2; - break; - case RelatedInfoNamed::VTXISODETSMALLESTCHI2: - value = smallestChi2; - break; - case RelatedInfoNamed::VTXISODETSMALLESTDELTACHI2: - value = smallestDeltaChi2; - break; - default: - value = 0.; - break; - } - debug() << " Inserting key = " << key << ", value = " << value << " into map" << endmsg; - m_map.insert( std::make_pair( key, value ) ); - } - - return StatusCode::SUCCESS; -} - -//========================================================================= -// -//========================================================================= -const Vertex* RelInfoVertexIsolationDetached::originVertex( const Particle* top, const Particle* P ) const { - if ( top == P || P->isBasicParticle() ) return 0; - - const SmartRefVector<LHCb::Particle>& dau = top->daughters(); - if ( dau.empty() ) { - // if (msgLevel(MSG::DEBUG)) debug() << " Particle has no daughters! " << endmsg; - return 0; - } - - SmartRefVector<LHCb::Particle>::const_iterator it; - for ( it = dau.begin(); dau.end() != it; ++it ) { - if ( P == *it ) { // I found the daughter - return top->endVertex(); - } - } - - // vertex not yet found, get deeper in the decay: - for ( it = dau.begin(); dau.end() != it; ++it ) { - if ( P != *it && !( *it )->isBasicParticle() ) { - const Vertex* vv = originVertex( *it, P ); - if ( vv ) return vv; - } - } - return 0; -} - -LHCb::RelatedInfoMap* RelInfoVertexIsolationDetached::getInfo( void ) { return &m_map; } diff --git a/Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.h b/Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.h deleted file mode 100644 index f277fa01b..000000000 --- a/Phys/RelatedInfoTools/src/RelInfoVertexIsolationDetached.h +++ /dev/null @@ -1,85 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef VERTEXISOLATIONDETACHED_H -#define VERTEXISOLATIONDETACHED_H 1 - -#include "CaloUtils/CaloParticle.h" -#include "GaudiAlg/GaudiTool.h" -#include "Kernel/IRelatedInfoTool.h" - -#include "Kernel/IDVAlgorithm.h" -#include "Kernel/IVertexFit.h" -#include <Kernel/GetIDVAlgorithm.h> -struct IDVAlgorithm; -struct IDistanceCalculator; -struct IVertexFit; - -namespace LHCb { - class Particle; - class Vertex; -} // namespace LHCb - -/** @class TupleToolVtxIsoln TupleToolVtxIsoln.h - * - * \brief Fill isolation information for DecayTreeTuple - * - * - head_NOPARTWITHINDCHI2WDW : no. of non-signal particles that when added to vertex give delta chi2 < specified - * window - * - head_NOPARTWITHINCHI2WDW : no. of non-signal particles that when added to vertex give chi2 < specified window - * head_SMALLESTCHI2: chi2 of smallest chi2 combination with any of the input Particles - * head_SMALLESTDELTACHI2: delta chi2 of smallest delta chi2 combination with any of the input Particles - * - * \sa DecayTreeTuple - * - * @todo Maybe one should get Tracks instead of Particles? - * - * @author Mitesh Patel, Patrick Koppenburg - * @date 2008-04-15 - */ -class RelInfoVertexIsolationDetached : public GaudiTool, virtual public IRelatedInfoTool { - -public: - /// Standard constructor - RelInfoVertexIsolationDetached( const std::string& type, const std::string& name, const IInterface* parent ); - - StatusCode initialize() override; - - virtual ~RelInfoVertexIsolationDetached(); ///< Destructor - - StatusCode calculateRelatedInfo( const LHCb::Particle*, const LHCb::Particle* ) override; - - LHCb::RelatedInfoMap* getInfo( void ) override; - -private: - const LHCb::Vertex* originVertex( const LHCb::Particle*, const LHCb::Particle* ) const; - - /// Check if a pure CALO Particle - inline bool isPureNeutralCalo( const LHCb::Particle* P ) const { - LHCb::CaloParticle caloP( (LHCb::Particle*)P ); - return caloP.isPureNeutralCalo(); - } // Helpers - -private: - std::vector<std::string> m_variables; - std::vector<short int> m_keys; - - IDVAlgorithm* m_dva; - const IDistanceCalculator* m_dist; - const IVertexFit* m_pVertexFit; - double m_deltaChi2; - double m_Chi2; - std::string m_typeVertexFit; - std::vector<std::string> m_inputParticles; - - LHCb::RelatedInfoMap m_map; -}; - -#endif diff --git a/Phys/TisTosTobbing/src/TESSelectionTisTos.cpp b/Phys/TisTosTobbing/src/TESSelectionTisTos.cpp deleted file mode 100644 index 35760159b..000000000 --- a/Phys/TisTosTobbing/src/TESSelectionTisTos.cpp +++ /dev/null @@ -1,462 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// Include files -#include <algorithm> -#include <sstream> -#include <vector> - -// from Gaudi -#include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/StringKey.h" - -// local -#include "TESSelectionTisTos.h" - -using namespace LHCb; - -//----------------------------------------------------------------------------- -// Implementation file for class : TESSelectionTisTos -// -// 2009-12-03 : Tomasz Skwarnicki -//----------------------------------------------------------------------------- - -// Declaration of the Tool Factory -DECLARE_COMPONENT( TESSelectionTisTos ) - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -TESSelectionTisTos::TESSelectionTisTos( const std::string& type, const std::string& name, const IInterface* parent ) - : ParticleTisTos( type, name, parent ), m_objectSummaries( 0 ) { - declareInterface<ITriggerSelectionTisTos>( this ); - - declareProperty( "PrefixInTES", m_PrefixInTES = "/Event/" ); - - m_cached_SelectionNames.reserve( 500 ); - m_cached_tisTosTob.reserve( 500 ); -} - -//============================================================================= -// Destructor -//============================================================================= -TESSelectionTisTos::~TESSelectionTisTos() {} - -//============================================================================= -// Initialization -//============================================================================= -StatusCode TESSelectionTisTos::initialize() { - StatusCode sc = ParticleTisTos::initialize(); - if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm - - debug() << "==> Initialize" << endmsg; - - IIncidentSvc* incidentSvc( 0 ); - if ( !service( "IncidentSvc", incidentSvc ).isSuccess() ) return StatusCode::FAILURE; - // add listener to be triggered by first BeginEvent - bool rethrow = false; - bool oneShot = false; - long priority = 0; - incidentSvc->addListener( this, IncidentType::BeginEvent, priority, rethrow, oneShot ); - incidentSvc->release(); - - m_newEvent = true; - - setOfflineInput(); - - return StatusCode::SUCCESS; -} - -void TESSelectionTisTos::handle( const Incident& ) { - - setOfflineInput(); - - m_newEvent = true; - - m_objectSummaries = 0; -} - -// ------------------------------------------------------------------------------------ -void TESSelectionTisTos::getHltSummary() {} - -//============================================================================= -// -------------- offline inputs ----------------------------------------------- -//============================================================================= - -// erase previous input --------------------------------------------------------- -void TESSelectionTisTos::setOfflineInput() { - setSignal(); - clearCache(); -} - -// hit list input --------------------------------------------------------------- -void TESSelectionTisTos::addToOfflineInput( const std::vector<LHCb::LHCbID>& hitlist ) { - if ( addToSignal( hitlist ) ) clearCache(); -} - -// Track input --------------------------------------------------------------- -void TESSelectionTisTos::addToOfflineInput( const LHCb::Track& track ) { - if ( addToSignal( track ) ) clearCache(); -} - -// Proto-particle input ----------------------------------------------------------------------- -void TESSelectionTisTos::addToOfflineInput( const LHCb::ProtoParticle& protoParticle ) { - if ( addToSignal( protoParticle ) ) clearCache(); -} - -// Particle input ----------------------------------------------------------------------- -void TESSelectionTisTos::addToOfflineInput( const LHCb::Particle& particle ) { - if ( addToSignal( particle ) ) clearCache(); -} - -//============================================================================= - -//============================================================================= -// -------------- outputs: -//============================================================================= - -// single complete Trigger Selection TisTos (define Offline Input before calling) -unsigned int TESSelectionTisTos::tisTosSelection( const std::string& selectionName ) { - unsigned int result = 0; - if ( findInCache( selectionName, result ) ) return result; - - bool decision( false ); - - std::string path; - if ( selectionName.find( '/' ) == 0 ) { - path = selectionName; - } else { - path = m_PrefixInTES.value() + selectionName; - } - - if ( exist<Particle::Range>( path ) || exist<Particle::Range>( path + "/Particles" ) ) { - - Particle::Range cParticles; - if ( exist<Particle::Range>( path ) ) { - cParticles = get<Particle::Range>( path ); - } else { - cParticles = get<Particle::Range>( path + "/Particles" ); - } - std::vector<Particle*> particles; - for ( Particle::Range::const_iterator icand = cParticles.begin(); icand != cParticles.end(); icand++ ) { - particles.push_back( const_cast<Particle*>( *icand ) ); - } - decision = ( 0 != particles.size() ); - if ( decision > 0 ) { result = IParticleTisTos::tisTos<Particle>( particles ); } - - } else if ( exist<Vertices>( path ) || exist<Vertices>( path + "/Vertices" ) ) { - - Vertex::Range cVertices; - if ( exist<Vertex::Range>( path ) ) { - cVertices = get<Vertex::Range>( path ); - } else { - cVertices = get<Vertex::Range>( path + "/Vertices" ); - } - std::vector<Vertex*> vtxs; - for ( Vertex::Range::iterator icand = cVertices.begin(); icand != cVertices.end(); icand++ ) { - vtxs.push_back( const_cast<Vertex*>( *icand ) ); - } - decision = ( 0 != vtxs.size() ); - if ( decision > 0 ) { result = IParticleTisTos::tisTos<Vertex>( vtxs ); } - - } else if ( exist<RecVertex::Range>( path ) ) { - - RecVertex::Range cVertices = get<RecVertex::Range>( path ); - std::vector<RecVertex*> vertices; - for ( RecVertex::Range::iterator icand = cVertices.begin(); icand != cVertices.end(); icand++ ) { - vertices.push_back( const_cast<RecVertex*>( *icand ) ); - } - decision = ( 0 != vertices.size() ); - if ( decision ) { result = IParticleTisTos::tisTos<RecVertex>( vertices ); } - - } else if ( exist<Track::Range>( path ) ) { - - Track::Range cTracks = get<Track::Range>( path ); - std::vector<Track*> tracks; - for ( Track::Range::iterator icand = cTracks.begin(); icand != cTracks.end(); icand++ ) { - tracks.push_back( const_cast<Track*>( *icand ) ); - } - decision = ( 0 != tracks.size() ); - if ( decision ) { result = IParticleTisTos::tisTos<Track>( tracks ); } - } - - if ( decision ) result |= kDecision; - storeInCache( selectionName, result ); - return result; -} - -// single complete Trigger Selection TisTos (define Offline Input before calling) -std::string TESSelectionTisTos::analysisReportSelection( const std::string& selectionName ) { - - unsigned int result = 0; - - bool decision( false ); - - std::string path; - if ( selectionName.find( '/' ) == 0 ) { - path = selectionName; - } else { - path = m_PrefixInTES.value() + selectionName; - } - - std::ostringstream report; - report << offset() << " Selection path " + path; - - if ( exist<Particle::Range>( path ) || exist<Particle::Range>( path + "/Particles" ) ) { - - Particle::Range cParticles; - if ( exist<Particle::Range>( path ) ) { - cParticles = get<Particle::Range>( path ); - } else { - cParticles = get<Particle::Range>( path + "/Particles" ); - } - std::vector<Particle*> particles; - for ( Particle::Range::const_iterator icand = cParticles.begin(); icand != cParticles.end(); icand++ ) { - particles.push_back( const_cast<Particle*>( *icand ) ); - } - report << " Particles size= " << particles.size() << std::endl; - decision = ( 0 != particles.size() ); - if ( decision > 0 ) { - result = IParticleTisTos::tisTos<Particle>( particles ); - report << analysisReport<Particle>( particles ); - } - - } else if ( exist<Vertex::Range>( path ) || exist<Vertex::Range>( path + "/Vertices" ) ) { - - Vertex::Range cVertices; - if ( exist<Vertex::Range>( path ) ) { - cVertices = get<Vertex::Range>( path ); - } else { - cVertices = get<Vertex::Range>( path + "/Vertices" ); - } - std::vector<Vertex*> vtxs; - for ( Vertex::Range::iterator icand = cVertices.begin(); icand != cVertices.end(); icand++ ) { - vtxs.push_back( const_cast<Vertex*>( *icand ) ); - } - report << " Vertcies size= " << vtxs.size() << std::endl; - decision = ( 0 != vtxs.size() ); - if ( decision > 0 ) { - result = IParticleTisTos::tisTos<Vertex>( vtxs ); - report << analysisReport<Vertex>( vtxs ); - } - - } else if ( exist<RecVertex::Range>( path ) ) { - - RecVertex::Range cVertices = get<RecVertex::Range>( path ); - std::vector<RecVertex*> vertices; - for ( RecVertex::Range::iterator icand = cVertices.begin(); icand != cVertices.end(); icand++ ) { - vertices.push_back( const_cast<RecVertex*>( *icand ) ); - } - report << " RecVerticies size= " << vertices.size() << std::endl; - decision = ( 0 != vertices.size() ); - if ( decision ) { - result = IParticleTisTos::tisTos<RecVertex>( vertices ); - report << analysisReport<RecVertex>( vertices ); - } - - } else if ( exist<Track::Range>( path ) ) { - - Track::Range cTracks = get<Track::Range>( path ); - std::vector<Track*> tracks; - for ( Track::Range::iterator icand = cTracks.begin(); icand != cTracks.end(); icand++ ) { - tracks.push_back( const_cast<Track*>( *icand ) ); - } - report << " Tracks size= " << tracks.size() << std::endl; - decision = ( 0 != tracks.size() ); - if ( decision ) { - result = IParticleTisTos::tisTos<Track>( tracks ); - report << analysisReport<Track>( tracks ); - } - } - - if ( decision ) result |= kDecision; - TisTosTob res( result ); - report << offset() << " Selection " + selectionName + " " - << " TIS= " << res.tis() << " TOS= " << res.tos() << " TPS= " << res.tps() << " decision= " << res.decision() - << std::endl; - return report.str(); -} - -// fast check for TOS -#define TOSTISTPS( FUN ) \ - { \ - std::string path; \ - bool decision( false ); \ - if ( selectionName.find( '/' ) == 0 ) { \ - path = selectionName; \ - } else { \ - path = m_PrefixInTES.value() + selectionName; \ - } \ - \ - if ( exist<Particle::Range>( path ) || exist<Particle::Range>( path + "/Particles" ) ) { \ - \ - Particle::Range cParticles; \ - if ( exist<Particle::Range>( path ) ) { \ - cParticles = get<Particle::Range>( path ); \ - } else { \ - cParticles = get<Particle::Range>( path + "/Particles" ); \ - } \ - std::vector<Particle*> particles; \ - for ( Particle::Range::const_iterator icand = cParticles.begin(); icand != cParticles.end(); icand++ ) { \ - particles.push_back( const_cast<Particle*>( *icand ) ); \ - } \ - decision = ( 0 != particles.size() ); \ - if ( decision > 0 ) { return IParticleTisTos::FUN<Particle>( particles ); } \ - \ - } else if ( exist<Vertex::Range>( path ) || exist<Vertex::Range>( path + "/Vertices" ) ) { \ - \ - Vertex::Range cVertices; \ - if ( exist<Vertex::Range>( path ) ) { \ - cVertices = get<Vertex::Range>( path ); \ - } else { \ - cVertices = get<Vertex::Range>( path + "/Vertices" ); \ - } \ - std::vector<Vertex*> vtxs; \ - for ( Vertex::Range::iterator icand = cVertices.begin(); icand != cVertices.end(); icand++ ) { \ - vtxs.push_back( const_cast<Vertex*>( *icand ) ); \ - } \ - decision = ( 0 != vtxs.size() ); \ - if ( decision > 0 ) { return IParticleTisTos::FUN<Vertex>( vtxs ); } \ - \ - } else if ( exist<RecVertex::Range>( path ) ) { \ - \ - RecVertex::Range cVertices = get<RecVertex::Range>( path ); \ - std::vector<RecVertex*> vertices; \ - for ( RecVertex::Range::iterator icand = cVertices.begin(); icand != cVertices.end(); icand++ ) { \ - vertices.push_back( const_cast<RecVertex*>( *icand ) ); \ - } \ - decision = ( 0 != vertices.size() ); \ - if ( decision ) { return IParticleTisTos::FUN<RecVertex>( vertices ); } \ - \ - } else if ( exist<Track::Range>( path ) ) { \ - \ - Track::Range cTracks = get<Track::Range>( path ); \ - std::vector<Track*> tracks; \ - for ( Track::Range::iterator icand = cTracks.begin(); icand != cTracks.end(); icand++ ) { \ - tracks.push_back( const_cast<Track*>( *icand ) ); \ - } \ - decision = ( 0 != tracks.size() ); \ - if ( decision ) { return IParticleTisTos::FUN<Track>( tracks ); } \ - } \ - return false; \ - } - -bool TESSelectionTisTos::tosSelection( const std::string& selectionName ) TOSTISTPS( tos ) - - bool TESSelectionTisTos::tisSelection( const std::string& selectionName ) TOSTISTPS( tis ) - - bool TESSelectionTisTos::tusSelection( const std::string& selectionName ) TOSTISTPS( tus ) - - // ------------ auxiliary output: list of LHCbIDs corresponding to present offline input - std::vector<LHCb::LHCbID> TESSelectionTisTos::offlineLHCbIDs() { - return signal(); -} - -#define TISTOSSELECTSTORE() \ - unsigned int result = tisTos( *object ); \ - bool tis, tos, tps; \ - tis = result & kTIS; \ - tos = result & kTOS; \ - tps = result & kTPS; \ - if ( ( ( tisRequirement >= kAnything ) || ( tis == tisRequirement ) ) && \ - ( ( tosRequirement >= kAnything ) || ( tos == tosRequirement ) ) && \ - ( ( tpsRequirement >= kAnything ) || ( tps == tpsRequirement ) ) ) { \ - HltObjectSummary* hos( 0 ); \ - for ( HltObjectSummarys::iterator ppHos = m_objectSummaries->begin(); ppHos != m_objectSummaries->end(); \ - ++ppHos ) { \ - HltObjectSummary* pHos( *ppHos ); \ - if ( pHos->summarizedObjectCLID() == object->clID() ) { \ - if ( pHos->summarizedObject() == object ) hos = pHos; \ - } \ - } \ - if ( !hos ) { \ - hos = new HltObjectSummary(); \ - m_objectSummaries->push_back( hos ); \ - hos->setSummarizedObjectCLID( object->clID() ); \ - hos->setSummarizedObject( object ); \ - } \ - matchedObjectSummaries.push_back( hos ); \ - } - -// ------------ additional functionality: lists of object summaries for tracks/vertices/particles from trigger -// selections -// satisfying TIS, TOS requirements - -std::vector<const LHCb::HltObjectSummary*> -TESSelectionTisTos::hltSelectionObjectSummaries( const std::string& selectionName, unsigned int tisRequirement, - unsigned int tosRequirement, unsigned int tpsRequirement ) { - std::vector<const LHCb::HltObjectSummary*> matchedObjectSummaries; - - if ( !m_objectSummaries ) { - if ( exist<HltObjectSummary::Container>( "/Event/Hlt/TESSelectionTisTosStore" ) ) { - m_objectSummaries = get<HltObjectSummary::Container>( "/Event/Hlt/TESSelectionTisTosStore" ); - } else { - m_objectSummaries = new HltObjectSummary::Container(); - put( m_objectSummaries, "/Event/Hlt/TESSelectionTisTosStore" ); - } - } - - std::string path; - if ( selectionName.find( '/' ) == 0 ) { - path = selectionName; - } else { - path = m_PrefixInTES.value() + selectionName; - } - - if ( exist<Track::Range>( path ) ) { - - Track::Range sel = get<Track::Range>( path ); - if ( !( sel.size() ) ) return matchedObjectSummaries; - for ( Track::Range::iterator icand = sel.begin(); icand != sel.end(); icand++ ) { - Track* object = const_cast<Track*>( *icand ); - TISTOSSELECTSTORE() - } - - } else if ( exist<RecVertex::Range>( path ) ) { - - RecVertex::Range sel = get<RecVertex::Range>( path ); - if ( !( sel.size() ) ) return matchedObjectSummaries; - for ( RecVertex::Range::iterator icand = sel.begin(); icand != sel.end(); icand++ ) { - RecVertex* object = const_cast<RecVertex*>( *icand ); - TISTOSSELECTSTORE() - } - - } else if ( exist<Particle::Range>( path ) || exist<Particle::Range>( path + "/Particles" ) ) { - - Particle::Range sel; - if ( exist<Particle::Range>( path ) ) { - sel = get<Particle::Range>( path ); - } else { - sel = get<Particle::Range>( path + "/Particles" ); - } - if ( !( sel.size() ) ) return matchedObjectSummaries; - for ( Particle::Range::iterator icand = sel.begin(); icand != sel.end(); icand++ ) { - Particle* object = const_cast<Particle*>( *icand ); - TISTOSSELECTSTORE() - } - - } else if ( exist<Vertex::Range>( path ) || exist<Vertex::Range>( path + "/Vertices" ) ) { - - Vertex::Range sel; - if ( exist<Vertex::Range>( path ) ) { - sel = get<Vertex::Range>( path ); - } else { - sel = get<Vertex::Range>( path + "/Vertices" ); - } - if ( !( sel.size() ) ) return matchedObjectSummaries; - for ( Vertex::Range::iterator icand = sel.begin(); icand != sel.end(); icand++ ) { - Vertex* object = const_cast<Vertex*>( *icand ); - TISTOSSELECTSTORE() - } - } - - return matchedObjectSummaries; -} diff --git a/Phys/TisTosTobbing/src/TESSelectionTisTos.h b/Phys/TisTosTobbing/src/TESSelectionTisTos.h deleted file mode 100644 index 47b48d01c..000000000 --- a/Phys/TisTosTobbing/src/TESSelectionTisTos.h +++ /dev/null @@ -1,156 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef TESSELECTIONTISTOS_H -#define TESSELECTIONTISTOS_H 1 - -// Include files -// from Gaudi -#include "GaudiAlg/GaudiTool.h" -#include "Kernel/ITriggerSelectionTisTos.h" // Interface - -#include "TisTos/ParticleTisTos.h" - -#include "Event/HltObjectSummary.h" -#include "Event/Particle.h" -#include "Event/RecVertex.h" -#include "Event/Track.h" - -#include "GaudiKernel/IIncidentListener.h" - -/** @class TESSelectionTisTos TESSelectionTisTos.h - * - * @author Tomasz Skwarnicki - * @date 2009-12-03 - * - * This is a special version of TisTosTobbing of TES Selections with candidates saved on TES - * This code is general enough to TisTos any Selection of Particles, Tracks, RecVertices saved on TES - * with respect to user defined "Signal" - * - * Hit based implementation of Tis,Tos'ing TES Selection(s). - * @sa ITriggerSelectionTisTos docs for more explanation. - * This interface also defines inlined shortcuts to set Offline Input and get an output in one call. - */ -class TESSelectionTisTos : public ParticleTisTos, - virtual public IIncidentListener, - virtual public ITriggerSelectionTisTos { -public: - /// Standard constructor - TESSelectionTisTos( const std::string& type, const std::string& name, const IInterface* parent ); - - virtual ~TESSelectionTisTos(); ///< Destructor - - StatusCode initialize() override; - void handle( const Incident& ) override; - - // ------------ various ways to define off-line input ------------------------- - - /// erase previous input - void setOfflineInput() override; - - /// Detector hit input - void addToOfflineInput( const std::vector<LHCb::LHCbID>& hitlist ) override; - - /// Track input - void addToOfflineInput( const LHCb::Track& track ) override; - - /// Proto-particle input - void addToOfflineInput( const LHCb::ProtoParticle& protoParticle ) override; - - /// Particle input; for composite particles loop over daughters will be executed - void addToOfflineInput( const LHCb::Particle& particle ) override; - - // ------------ TIS,TOS output functions ------------------------ - - /// single complete Trigger Selection TisTos (define Offline Input before calling) - unsigned int tisTosSelection( const std::string& selectionName ) override; - - /// check for TOS - may be faster than using tisTosSelection() - bool tosSelection( const std::string& selectionName ) override; - - /// check for TIS - may be faster than using tisTosSelection() - bool tisSelection( const std::string& selectionName ) override; - - /// check for TUS (Trigger Used Signal: TPS or TOS) - may be faster than using tisTosSelection() - bool tusSelection( const std::string& selectionName ) override; - - /// analysis report - std::string analysisReportSelection( const std::string& selectionName ) override; - - using ParticleTisTos::analysisReport; - template <class T> - std::string analysisReport( const std::vector<T*>& list ) { - std::ostringstream report; - report << offset() << " Vector of CLID=" << T::classID() << " size=" << list.size() << std::endl; - - ++m_reportDepth; - unsigned int result( 0 ); - for ( const T* obj : list ) { - result |= tisTos( *obj ); - report << ParticleTisTos::analysisReport( *obj ); - // if( (result&kTPS) && (result&kTOS) && (result&kTIS) )break; - } - --m_reportDepth; - return report.str(); - } - - // ------------ auxiliary outputs --------------------------------- - - /// list of LHCbIDs corresponding to present Offline Input (only hits used in matching are returned) - std::vector<LHCb::LHCbID> offlineLHCbIDs() override; - - /// list of HltObjectSummaries from Selection Summary satisfying TOS,TIS requirements (define Offline Input before - /// calling) - std::vector<const LHCb::HltObjectSummary*> - hltSelectionObjectSummaries( const std::string& selectionName, unsigned int tisRequirement = kAnything, - unsigned int tosRequirement = kAnything, - unsigned int tpsRequirement = kAnything ) override; - -protected: - /// get Hlt Summary and configuration - void getHltSummary(); - - bool m_newEvent; - - /// Prefix in TES (prefix for TES locations if the selection-name is not absolute path itself) - StringProperty m_PrefixInTES; - -private: - // internal Cache of results used as long as the Offline Input remains the same (cache only full classifications) - - void clearCache() { - m_cached_SelectionNames.clear(); - m_cached_tisTosTob.clear(); - } - - void storeInCache( const std::string& selectionName, unsigned int result ) { - m_cached_SelectionNames.push_back( selectionName ); - m_cached_tisTosTob.push_back( result ); - } - - bool findInCache( const std::string& selectionName, unsigned int& result ) { - std::vector<std::string>::iterator found = - std::find( m_cached_SelectionNames.begin(), m_cached_SelectionNames.end(), selectionName ); - if ( found == m_cached_SelectionNames.end() ) return false; - int index( found - m_cached_SelectionNames.begin() ); - result = m_cached_tisTosTob[index]; - return true; - } - - // -------------------------- data members -------------------- - - /// Cache of results for the same Offline Input - std::vector<std::string> m_cached_SelectionNames; - std::vector<unsigned int> m_cached_tisTosTob; - - /// HltObjectSummary container - LHCb::HltObjectSummary::Container* m_objectSummaries; -}; -#endif // TESSELECTIONTISTOS_H diff --git a/Phys/TisTosTobbing/src/TESTisTos.cpp b/Phys/TisTosTobbing/src/TESTisTos.cpp deleted file mode 100644 index e6865d841..000000000 --- a/Phys/TisTosTobbing/src/TESTisTos.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// Include files -#include <algorithm> -#include <sstream> -#include <vector> - -// from Gaudi -#include "GaudiKernel/IDataManagerSvc.h" -#include "GaudiKernel/IOpaqueAddress.h" -#include "GaudiKernel/IRegistry.h" -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/StringKey.h" - -// local -#include "TESTisTos.h" - -#include "boost/regex.hpp" - -using namespace LHCb; - -//----------------------------------------------------------------------------- -// Implementation file for class : TESTisTos -// -// 2007-08-20 : Tomasz Skwarnicki -//----------------------------------------------------------------------------- - -// Declaration of the Tool Factory -DECLARE_COMPONENT( TESTisTos ) - -const std::vector<std::string> TESTisTos::m_empty_selections = std::vector<std::string>(); - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -TESTisTos::TESTisTos( const std::string& type, const std::string& name, const IInterface* parent ) - : TESSelectionTisTos( type, name, parent ) { - declareInterface<ITriggerTisTos>( this ); - - declareProperty( "TriggerInputWarnings", m_trigInputWarn = false ); - declareProperty( "AllowToPreloadTES", m_preLoad = true ); -} -//============================================================================= -// Destructor -//============================================================================= -TESTisTos::~TESTisTos() {} - -//============================================================================= -// Initialization -//============================================================================= -StatusCode TESTisTos::initialize() { - StatusCode sc = TESSelectionTisTos::initialize(); // must be executed first - if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm - - debug() << "==> Initialize" << endmsg; - - setOfflineInput(); - setTriggerInput(); - - return StatusCode::SUCCESS; -} - -//============================================================================= - -void TESTisTos::getTriggerNames( const std::string& selectionNameWithWildChar ) { - - std::string preloadPath = "None"; - if ( selectionNameWithWildChar.find( '/' ) != 0 ) { - // if string does not start with / then relative to PrefixInTES - preloadPath = m_PrefixInTES.value(); - if ( preloadPath.find( "/Event" ) != 0 ) { preloadPath = "None"; } - } else { - // otherwise absolute path - - // find first regex special character if any - unsigned int found = selectionNameWithWildChar.size(); - for ( unsigned int i = 0; i < selectionNameWithWildChar.size(); ++i ) { - if ( std::string( ".*[^$|?+(){}\\" ).find( selectionNameWithWildChar.substr( i, i + 1 ) ) != std::string::npos ) { - found = i; - break; - } - } - if ( found == 0 ) { - preloadPath = "/Event"; - } else if ( found < selectionNameWithWildChar.size() ) { - preloadPath = selectionNameWithWildChar.substr( 0, found ); - } - } - if ( preloadPath.find_last_of( "/" ) == ( preloadPath.size() - 1 ) ) { - preloadPath = preloadPath.substr( 0, preloadPath.size() - 1 ); - } - - m_triggerNames.clear(); - exploreTES( "/Event", preloadPath ); - - if ( m_triggerNames.empty() ) { Warning( "No TES locations found", StatusCode::FAILURE, 1 ).setChecked(); } -} - -void TESTisTos::setTriggerInput() { - m_triggerInput_Selections.clear(); - m_newEvent = false; -} - -void TESTisTos::addToTriggerInput( const std::string& selectionNameWithWildChar ) { -#if 0 - if( m_newEvent )setTriggerInput(); - // if selectionNameWithWildChar contains a * without a . in front of it: print warning... - static boost::regex warn("[^\\.]\\*"); - if ( boost::regex_search( selectionNameWithWildChar, warn ) ) { - Warning( " addToTriggerInput now does Posix (Perl) regular expression matching instead of globbing;" - " this implies that eg. a '*' should be replaced by '.*'. You've specified " - " a selectionName using a '*', without leading '.': '" + selectionNameWithWildChar - + "'. Please verify whether this is what you still want\n " - " For more information on the supported syntax, please check " - " http://www.boost.org/doc/libs/1_39_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html" - ,StatusCode::SUCCESS - ).ignore(); - } -#endif - unsigned int sizeAtEntrance( m_triggerInput_Selections.size() ); - getTriggerNames( selectionNameWithWildChar ); - boost::regex expr; - if ( selectionNameWithWildChar.find( "/" ) == 0 ) { - expr = boost::regex( selectionNameWithWildChar ); - } else { - expr = boost::regex( m_PrefixInTES.value() + selectionNameWithWildChar ); - } - for ( std::vector<std::string>::const_iterator inpt = m_triggerNames.begin(); inpt != m_triggerNames.end(); ++inpt ) { - if ( boost::regex_match( *inpt, expr ) ) { - if ( find( m_triggerInput_Selections.begin(), m_triggerInput_Selections.end(), *inpt ) == - m_triggerInput_Selections.end() ) { - m_triggerInput_Selections.push_back( *inpt ); - } - } - } - if ( m_trigInputWarn && ( m_triggerInput_Selections.size() == sizeAtEntrance ) ) { - std::ostringstream mess; - mess << " addToTriggerInput called with selectionNameWithWildChar=" << selectionNameWithWildChar - << " added no selection to the Trigger Input, which has size=" << m_triggerInput_Selections.size(); - Warning( mess.str(), StatusCode::SUCCESS, 50 ).setChecked(); - } -} - -unsigned int TESTisTos::tisTosTrigger() { - unsigned int result = 0; - if ( m_newEvent ) setTriggerInput(); - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " triggerTisTos called with empty Trigger Input" ).setChecked(); - return result; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - unsigned int res = tisTosSelection( *iTriggerSelection ); - if ( res & kDecision ) { result |= res; } - if ( ( result & kTOS ) && ( result & kTIS ) && ( result & kTPS ) ) break; - } - return result; -} - -std::string TESTisTos::analysisReportTrigger() { - std::ostringstream report; - report << offset() << " Trigger #-of-sel " << m_triggerInput_Selections.size() << std::endl; - unsigned int result = 0; - if ( m_newEvent ) setTriggerInput(); - if ( m_triggerInput_Selections.empty() ) { - report << "Trigger Input empty" << std::endl; - return report.str(); - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - unsigned int res = tisTosSelection( *iTriggerSelection ); - ++m_reportDepth; - if ( res & kDecision ) { - report << analysisReportSelection( *iTriggerSelection ); - result |= res; - } else { - report << offset() << " Selection " + *iTriggerSelection + " decision=false " << std::endl; - } - --m_reportDepth; - // if( (result & kTOS) && (result & kTIS) && (result & kTPS ) )break; - } - TisTosTob res( result ); - report << offset() << " Trigger #-of-sel " << m_triggerInput_Selections.size() << " TIS= " << res.tis() - << " TOS= " << res.tos() << " TPS= " << res.tps() << " decision= " << res.decision() << std::endl; - return report.str(); -} - -// fast check for TOS -bool TESTisTos::tosTrigger() { - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " tosTrigger called with empty Trigger Input" ).setChecked(); - return false; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - if ( tosSelection( *iTriggerSelection ) ) return true; - } - return false; -} - -// fast check for TIS -bool TESTisTos::tisTrigger() { - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " tisTrigger called with empty Trigger Input" ).setChecked(); - return false; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - if ( tisSelection( *iTriggerSelection ) ) return true; - } - return false; -} - -// fast check for TIS -bool TESTisTos::tusTrigger() { - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " tpsTrigger called with empty Trigger Input" ).setChecked(); - return false; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - if ( tusSelection( *iTriggerSelection ) ) return true; - } - return false; -} - -std::vector<std::string> TESTisTos::triggerSelectionNames( unsigned int decisionRequirement, - unsigned int tisRequirement, unsigned int tosRequirement, - unsigned int tpsRequirement ) { - if ( m_newEvent ) setTriggerInput(); - if ( ( decisionRequirement >= kAnything ) && ( tisRequirement >= kAnything ) && ( tosRequirement >= kAnything ) && - ( tpsRequirement >= kAnything ) ) { - return m_triggerInput_Selections; - } - std::vector<std::string> selections; - for ( std::vector<std::string>::const_iterator iSel = m_triggerInput_Selections.begin(); - iSel != m_triggerInput_Selections.end(); ++iSel ) { - bool decision, tis, tos, tps; - unsigned int result = tisTosSelection( *iSel ); - decision = result & kDecision; - tos = result & kTOS; - tis = result & kTIS; - tps = result & kTPS; - if ( ( ( decisionRequirement >= kAnything ) || ( decision == decisionRequirement ) ) && - ( ( tisRequirement >= kAnything ) || ( tis == tisRequirement ) ) && - ( ( tosRequirement >= kAnything ) || ( tos == tosRequirement ) ) && - ( ( tpsRequirement >= kAnything ) || ( tps == tpsRequirement ) ) ) { - selections.push_back( *iSel ); - } - } - return selections; -} - -std::vector<const LHCb::HltObjectSummary*> -TESTisTos::hltObjectSummaries( unsigned int tisRequirement, unsigned int tosRequirement, unsigned int tpsRequirement ) { - if ( m_newEvent ) setTriggerInput(); - std::vector<const LHCb::HltObjectSummary*> hosVec; - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " hltObjectSummaries called with empty Trigger Input" ).setChecked(); - return hosVec; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - std::vector<const LHCb::HltObjectSummary*> selHosVec = - hltSelectionObjectSummaries( *iTriggerSelection, tisRequirement, tosRequirement, tpsRequirement ); - hosVec.insert( hosVec.end(), selHosVec.begin(), selHosVec.end() ); - } - return hosVec; -} - -void TESTisTos::exploreTES( const std::string& path, const std::string& preloadPath ) { - SmartIF<IDataManagerSvc> mgr( evtSvc() ); - if ( exist<DataObject>( path ) ) { - m_triggerNames.push_back( path ); - DataObject* pObj = get<DataObject>( path ); - IRegistry* reg = pObj->registry(); - typedef std::vector<IRegistry*> Leaves; - Leaves leaves; - StatusCode sc = mgr->objectLeaves( reg, leaves ); - if ( sc.isSuccess() ) { - const std::string* par0 = 0; - if ( reg->address() ) { par0 = reg->address()->par(); } - for ( Leaves::const_iterator leave = leaves.begin(); leave != leaves.end(); ++leave ) { - const std::string& pathid = ( *leave )->identifier(); - if ( ( *leave )->address() ) { - if ( par0 ) { - const std::string* par1 = ( *leave )->address()->par(); - if ( par1 ) { - // do not access forign - if ( par0[0] != par1[0] ) { continue; } - } - } - } - bool preload( false ); - if ( m_preLoad ) { - if ( pathid.find( preloadPath ) == 0 ) { - preload = true; - } else if ( ( pathid != "/Event" ) && ( preloadPath.find( pathid ) == 0 ) ) { - preload = true; - } - } - DataObject* p = 0; - if ( preload ) { - sc = evtSvc()->retrieveObject( pathid, p ); - } else { - sc = evtSvc()->findObject( pathid, p ); - } - if ( sc.isSuccess() ) { exploreTES( pathid, preloadPath ); } - } - } - } -} diff --git a/Phys/TisTosTobbing/src/TESTisTos.h b/Phys/TisTosTobbing/src/TESTisTos.h deleted file mode 100644 index cc4fa2fca..000000000 --- a/Phys/TisTosTobbing/src/TESTisTos.h +++ /dev/null @@ -1,97 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef TESTISTOS_H -#define TESTISTOS_H 1 - -// Include files -// from Gaudi -#include "GaudiAlg/GaudiTool.h" -#include "Kernel/ITriggerTisTos.h" // Interface - -#include "TESSelectionTisTos.h" - -/** @class TESTisTos TESTisTos.h - * - * @author Tomasz Skwarnicki - * @date 2009-12-03 - * - * This is a special version of TisTosTobbing of TES Selections with candidates saved on TES - * This code is general enough to TisTos any Selection of Particles, Tracks, RecVertices saved on TES - * with respect to user defined "Signal" - * - * Hit based implementation of Tis,Tos'ing TES specified via stripping name pattern. - * @sa TESSelectionTisTos for inherited member functions (e.g. to define Offline Input). - * @sa ITriggerTisTos docs for more explanation. - * This interface also defines inlined shortcuts to set Offline Input and or TES Input and get an output in one call. - */ -class TESTisTos : public TESSelectionTisTos, virtual public ITriggerTisTos { -public: - /// Standard constructor - TESTisTos( const std::string& type, const std::string& name, const IInterface* parent ); - - virtual ~TESTisTos(); ///< Destructor - - StatusCode initialize() override; - - /// erase previous Trigger Input - void setTriggerInput() override; - - /// add Trigger Selection Name pattern to Trigger Input; pattern may contain wild character *, all matches will be - /// added - void addToTriggerInput( const std::string& selectionNameWithWildChar ) override; - - /// Complete classification of the Trigger Input (see ITisTis::TisTosTob for the meaning) - unsigned int tisTosTrigger() override; - - /// check for TOS - may be faster than using tisTosTrigger() - bool tosTrigger() override; - - /// check for TIS - may be faster than using tisTosTrigger() - bool tisTrigger() override; - - /// check for TUS (Trigger Used Signal: TPS or TOS) - may be faster than using tisTosTrigger() - bool tusTrigger() override; - - /// analysis report - std::string analysisReportTrigger() override; - - /// returns Trigger Selection names matching optional pattern of decision,tis,tos for previously set Trigger and - /// Offline Inputs - std::vector<std::string> triggerSelectionNames( unsigned int decisionRequirement = kAnything, - unsigned int tisRequirement = kAnything, - unsigned int tosRequirement = kAnything, - unsigned int tpsRequirement = kAnything ) override; - - /// list of HltObjectSummaries from Selections satisfying TOS,TIS requirements (define Trigger and Offline Input - /// before calling) - std::vector<const LHCb::HltObjectSummary*> hltObjectSummaries( unsigned int tisRequirement = kAnything, - unsigned int tosRequirement = kAnything, - unsigned int tpsRequirement = kAnything ) override; - -private: - /// if true then warning about empty trigger inputs are printed - bool m_trigInputWarn; - /// flag to set if objects in TES are allowed to be preloaded - bool m_preLoad; - - /// obtain all known trigger names - void getTriggerNames( const std::string& selectionNameWithWildChar ); - void exploreTES( const std::string& path, const std::string& preloadPath ); - - static const std::vector<std::string> m_empty_selections; - - /// content of Trigger Input (list of trigger selection names) - std::vector<std::string> m_triggerInput_Selections; - - /// all known trigger names - std::vector<std::string> m_triggerNames; -}; -#endif // TESTISTOS_H diff --git a/Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.cpp b/Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.cpp deleted file mode 100644 index e3ae1380a..000000000 --- a/Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -//#define LOCDEBUG -// Include files -#include "boost/algorithm/string/replace.hpp" -#include <algorithm> -#include <sstream> - -// from Gaudi -#include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/IRegistry.h" -#include "Kernel/Particle2UnsignedInts.h" - -// local -#include "TriggerSelectionTisTosSummary.h" - -#include "Event/HltDecReports.h" - -using namespace LHCb; - -//----------------------------------------------------------------------------- -// Implementation file for class : TriggerSelectionTisTosSummary -// -// 2010-10-18 : Tomasz Skwarnicki -//----------------------------------------------------------------------------- - -// Declaration of the Tool Factory -DECLARE_COMPONENT( TriggerSelectionTisTosSummary ) - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -TriggerSelectionTisTosSummary::TriggerSelectionTisTosSummary( const std::string& type, const std::string& name, - const IInterface* parent ) - : ParticleTisTos( type, name, parent ), m_hltDecReports( 0 ) { - declareInterface<ITriggerSelectionTisTos>( this ); - - declareProperty( "HltDecReportsLocation", m_HltDecReportsLocation = LHCb::HltDecReportsLocation::Default ); - - m_cached_SelectionNames.reserve( 500 ); - m_cached_tisTosTob.reserve( 500 ); -} - -//============================================================================= -// Destructor -//============================================================================= -TriggerSelectionTisTosSummary::~TriggerSelectionTisTosSummary() {} - -//============================================================================= -// Initialization -//============================================================================= -StatusCode TriggerSelectionTisTosSummary::initialize() { - StatusCode sc = ParticleTisTos::initialize(); // must be executed first - if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm - - debug() << "==> Initialize" << endmsg; - - IIncidentSvc* incidentSvc( 0 ); - if ( !service( "IncidentSvc", incidentSvc ).isSuccess() ) return StatusCode::FAILURE; - // add listener to be triggered by first BeginEvent - bool rethrow = false; - bool oneShot = false; - long priority = 0; - incidentSvc->addListener( this, IncidentType::BeginEvent, priority, rethrow, oneShot ); - incidentSvc->release(); - - m_newEvent = true; - - setOfflineInput(); - - return StatusCode::SUCCESS; -} - -void TriggerSelectionTisTosSummary::handle( const Incident& ) { - m_hltDecReports = 0; - - setOfflineInput(); - - m_newEvent = true; -} - -// ------------------------------------------------------------------------------------ -void TriggerSelectionTisTosSummary::getHltSummary() { - if ( !m_hltDecReports ) { - if ( exist<HltDecReports>( m_HltDecReportsLocation ) ) { - m_hltDecReports = get<HltDecReports>( m_HltDecReportsLocation ); - } else { - Error( " No HltDecReports at " + m_HltDecReportsLocation.value(), StatusCode::FAILURE, 2 ).setChecked(); - m_hltDecReports = 0; - } - } -} - -//============================================================================= -// -------------- offline inputs ----------------------------------------------- -//============================================================================= - -// erase previous input --------------------------------------------------------- -void TriggerSelectionTisTosSummary::setOfflineInput() { clearCache(); } - -// data object signal --------------------------------------------------------------- -bool TriggerSelectionTisTosSummary::addParticleTisTosSummary( const LHCb::Particle& object ) { - // try global map at RootInTES location - DaVinci::Map::Particle2UnsignedInts* p2tisTosSummary( 0 ); - if ( exist<DaVinci::Map::Particle2UnsignedInts>( "Particle2TisTos" ) ) { - p2tisTosSummary = get<DaVinci::Map::Particle2UnsignedInts>( "Particle2TisTos" ); - } else { - const DataObject* container = object.parent(); - if ( !container ) { - Error( "Particle passed as OfflineInput not in a container - no TisTossing", StatusCode::FAILURE, 10 ) - .setChecked(); - return false; - } - IRegistry* registry = container->registry(); - if ( !registry ) { - Error( "Particle passed as OfflineInput is in a container which is not on TES - no TisTossing", - StatusCode::FAILURE, 10 ) - .setChecked(); - return false; - } - std::string path = registry->identifier(); - // local map - boost::replace_last( path, "/Particles", "/Particle2TisTos" ); - if ( exist<DaVinci::Map::Particle2UnsignedInts>( path, false ) ) { - p2tisTosSummary = get<DaVinci::Map::Particle2UnsignedInts>( path, false ); - } else { - // global map at stream location (find first "/" past "/Event/") - std::size_t ipos = path.find( "/", 7 ); - if ( ipos != std::string::npos ) { - std::string pathg = path.substr( 0, ipos ) + "/Particle2TisTos"; - if ( exist<DaVinci::Map::Particle2UnsignedInts>( pathg, false ) ) { - p2tisTosSummary = get<DaVinci::Map::Particle2UnsignedInts>( pathg, false ); - } else { - Error( "No /Particle2TisTos for the Particle passed as OfflineInput - no TisTossing", StatusCode::FAILURE, - 10 ) - .setChecked(); - return false; - } - } - } - } - if ( !p2tisTosSummary ) { - Error( "No /Particle2TisTos for the Particle passed as OfflineInput - no TisTossing", StatusCode::FAILURE, 10 ) - .setChecked(); - return false; - } - std::vector<unsigned int> tisTosSummary = ( *p2tisTosSummary )[&object]; - return addTisTosSummary( tisTosSummary ); -} - -// data object signal --------------------------------------------------------------- -bool TriggerSelectionTisTosSummary::addTisTosSummary( std::vector<unsigned int>& tisTosSummary ) { - // add to existing TisTosSummary - if ( m_cached_tisTosTob.size() ) { - if ( tisTosSummary.size() != m_cached_tisTosTob.size() ) { - Error( " TisTosSummary size different from previous TisTosSummary size ", StatusCode::FAILURE, 10 ).setChecked(); - return false; - } - std::vector<unsigned int>::iterator iResult = tisTosSummary.begin(); - for ( std::vector<unsigned int>::iterator iPrevResult = m_cached_tisTosTob.begin(); - iPrevResult != m_cached_tisTosTob.end(); ++iPrevResult, ++iResult ) { - unsigned int& resultToAdd = *iResult; - unsigned int& resultPrev = *iPrevResult; - TisTosTob updatedResult( 0 ); - updatedResult.set_decision( ( resultPrev & kDecision ) != 0 ); - // this is not going to give accurate results (some TOS and TIS may be missed, but if set not to true not wrong) - updatedResult.set_tos( ( ( resultPrev & kTOS ) | ( resultToAdd & kTOS ) ) != 0 ); - updatedResult.set_tis( ( ( resultPrev & kTIS ) & ( resultToAdd & kTIS ) ) != 0 ); - updatedResult.set_tps( ( ( ( resultPrev & kTPS ) | ( resultToAdd & kTPS ) ) != 0 ) && ( !updatedResult.tos() ) ); - resultPrev = updatedResult.value(); - } - return true; - } else { - // create cached results - // get trigger names from HltDecReports - if ( !m_hltDecReports ) getHltSummary(); - if ( !m_hltDecReports ) { - Error( " No HltDecReports available - cannot interprete results. No TisTossing possible. ", StatusCode::FAILURE, - 10 ) - .setChecked(); - return false; - } - std::vector<std::string> triggerNames = m_hltDecReports->decisionNames(); - if ( tisTosSummary.size() < triggerNames.size() ) { - Error( " TisTosSummary size < HltDecReports size ", StatusCode::FAILURE, 10 ).setChecked(); - return false; - } - std::vector<unsigned int>::iterator iResult = tisTosSummary.begin(); - for ( std::vector<std::string>::const_iterator iDecName = triggerNames.begin(); iDecName != triggerNames.end(); - ++iDecName, ++iResult ) { - m_cached_SelectionNames.push_back( *iDecName ); - m_cached_tisTosTob.push_back( *iResult ); - } - } - return true; -} - -// hit list input --------------------------------------------------------------- -void TriggerSelectionTisTosSummary::addToOfflineInput( const std::vector<LHCb::LHCbID>& hitlist ) { - // try to pass lhcbids as TisTosSummary - std::vector<unsigned int> tisTosSummary; - for ( std::vector<LHCb::LHCbID>::const_iterator i = hitlist.begin(); i != hitlist.end(); ++i ) { - unsigned int result = i->lhcbID(); - // not a legal TisTos result value? - if ( result > 15 ) { - Error( "Cannot handle LHCbID Offline input - no TisTossing", StatusCode::SUCCESS, 10 ).setChecked(); - clearCache(); - } - tisTosSummary.push_back( result ); - } - if ( addTisTosSummary( tisTosSummary ) ) return; - Error( "Cannot handle LHCbID Offline input - no TisTossing", StatusCode::SUCCESS, 10 ).setChecked(); - clearCache(); -} - -// Track input --------------------------------------------------------------- -void TriggerSelectionTisTosSummary::addToOfflineInput( const LHCb::Track& ) { - Error( "Cannot handle Track input - no TisTossing", StatusCode::SUCCESS, 10 ).setChecked(); - clearCache(); -} - -// Proto-particle input ----------------------------------------------------------------------- -void TriggerSelectionTisTosSummary::addToOfflineInput( const LHCb::ProtoParticle& ) { - Error( "Cannot handle ProtoParticle input - no TisTossing", StatusCode::SUCCESS, 10 ).setChecked(); - clearCache(); -} - -// Particle input ----------------------------------------------------------------------- -void TriggerSelectionTisTosSummary::addToOfflineInput( const LHCb::Particle& particle ) { - if ( !addParticleTisTosSummary( particle ) ) clearCache(); -} - -//============================================================================= -// -------------- outputs: -//============================================================================= - -// single complete Trigger Selection TisTos (define Offline Input before calling) -unsigned int TriggerSelectionTisTosSummary::tisTosSelection( const std::string& selectionName ) { - unsigned int result = 0; - if ( findInCache( selectionName, result ) ) return result; - return result; -} - -// analysisReport for Selection (define Offline Input before calling) -std::string TriggerSelectionTisTosSummary::analysisReportSelection( const std::string& selectionName ) { - std::ostringstream report; - report << offset() << " Selection " + selectionName + " "; - - unsigned int result = 0; - - getHltSummary(); - - bool decision( false ); - // get decision from HltDecReports if can find it - if ( m_hltDecReports ) { - const HltDecReport* rep = m_hltDecReports->decReport( selectionName ); - if ( rep ) { - decision = rep->decision(); - report << " HltDecReport decision=" << decision; - } - } - // if( decision )result |= kDecision; - - if ( !findInCache( selectionName, result ) ) { - report << " not found in TisTosSummary " << std::endl; - return report.str(); - } - - // if( decision )result |= kDecision; - report << std::endl; - //++m_reportDepth; - // report << analysisReport( *sel ); - //--m_reportDepth; - TisTosTob res( result ); - report << offset() << " Selection " + selectionName + " TIS= " << res.tis() << " TOS= " << res.tos() - << " TPS= " << res.tps() << " decision= " << res.decision() << " Cached result " << std::endl; - return report.str(); -} - -// fast check for TOS -bool TriggerSelectionTisTosSummary::tosSelection( const std::string& selectionName ) { - unsigned int result = 0; - if ( !findInCache( selectionName, result ) ) return false; - if ( result & kTOS ) return true; - return false; -} - -// fast check for TIS -bool TriggerSelectionTisTosSummary::tisSelection( const std::string& selectionName ) { - unsigned int result = 0; - if ( !findInCache( selectionName, result ) ) return false; - if ( result & kTIS ) return true; - return false; -} - -// fast check for TOS -bool TriggerSelectionTisTosSummary::tusSelection( const std::string& selectionName ) { - unsigned int result = 0; - if ( !findInCache( selectionName, result ) ) return false; - if ( result & kTUS ) return true; - return false; -} - -// ------------ auxiliary output: list of LHCbIDs corresponding to present offline input -std::vector<LHCb::LHCbID> TriggerSelectionTisTosSummary::offlineLHCbIDs() { - // return TisTosSummary instead! - std::vector<LHCb::LHCbID> fakeLHCbIDs; - for ( std::vector<unsigned int>::iterator iResult = m_cached_tisTosTob.begin(); iResult != m_cached_tisTosTob.end(); - ++iResult ) { - fakeLHCbIDs.push_back( LHCb::LHCbID( *iResult ) ); - } - return fakeLHCbIDs; -} - -// ------------ additional functionality: lists of object summaries for tracks/vertices/particles from trigger -// selections -// satisfying TIS, TOS requirements - -std::vector<const LHCb::HltObjectSummary*> -TriggerSelectionTisTosSummary::hltSelectionObjectSummaries( const std::string&, unsigned int, unsigned int, - unsigned int ) { - // This is a dummy version since no such info available - std::vector<const LHCb::HltObjectSummary*> matchedObjectSummaries; - return matchedObjectSummaries; -} diff --git a/Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.h b/Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.h deleted file mode 100644 index 5fc43d0dd..000000000 --- a/Phys/TisTosTobbing/src/TriggerSelectionTisTosSummary.h +++ /dev/null @@ -1,143 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef TRIGGERSELECTIONTISTOSSUMMARY_H -#define TRIGGERSELECTIONTISTOSSUMMARY_H 1 - -// Include files -// from Gaudi -//#include "GaudiAlg/GaudiTool.h" -#include "Kernel/ITriggerSelectionTisTos.h" // Interface -#include "TisTos/ParticleTisTos.h" - -#include "Event/HltObjectSummary.h" -#include "Event/Particle.h" -#include "Event/Track.h" - -#include "GaudiKernel/IIncidentListener.h" - -namespace LHCb { - class HltDecReports; -} - -/** @class TriggerSelectionTisTosSummary TriggerSelectionTisTosSummary.h - * - * @author Tomasz Skwarnicki - * @date 2010-10-18 - * - * Precalculated TisTosSummary implementation of Tis,Tos'ing Trigger Selection(s). - * @sa ITriggerSelectionTisTos docs for more explanation. - * This interface also defines inlined shortcuts to set Offline Input and get an output in one call. - */ -class TriggerSelectionTisTosSummary : public ParticleTisTos, - virtual public IIncidentListener, - virtual public ITriggerSelectionTisTos { -public: - /// Standard constructor - TriggerSelectionTisTosSummary( const std::string& type, const std::string& name, const IInterface* parent ); - - virtual ~TriggerSelectionTisTosSummary(); ///< Destructor - - StatusCode initialize() override; - void handle( const Incident& ) override; - - // ------------ various ways to define off-line input ------------------------- - - /// erase previous input - void setOfflineInput() override; - - /// Detector hit input - can add TisTosSummary by passing fake LHCbID vector - void addToOfflineInput( const std::vector<LHCb::LHCbID>& hitlist ) override; - - /// Track input - void addToOfflineInput( const LHCb::Track& track ) override; - - /// Proto-particle input - void addToOfflineInput( const LHCb::ProtoParticle& protoParticle ) override; - - /// Particle input; for composite particles loop over daughters will be executed - void addToOfflineInput( const LHCb::Particle& particle ) override; - - // ------------ TIS,TOS output functions ------------------------ - - /// single complete Trigger Selection TisTos (define Offline Input before calling) - unsigned int tisTosSelection( const std::string& selectionName ) override; - - /// check for TOS - may be faster than using tisTosSelection() - bool tosSelection( const std::string& selectionName ) override; - - /// check for TIS - may be faster than using tisTosSelection() - bool tisSelection( const std::string& selectionName ) override; - - /// check for TUS (Trigger Used Signal: TPS or TOS) - may be faster than using tisTosSelection() - bool tusSelection( const std::string& selectionName ) override; - - /// analysis report - std::string analysisReportSelection( const std::string& selectionName ) override; - - // ------------ auxiliary outputs --------------------------------- - - /// return cached TisTosSummary as fake LHCbID vector - std::vector<LHCb::LHCbID> offlineLHCbIDs() override; - - /// list of HltObjectSummaries from Selection Summary satisfying TOS,TIS requirements (define Offline Input before - /// calling) - std::vector<const LHCb::HltObjectSummary*> - hltSelectionObjectSummaries( const std::string& selectionName, unsigned int tisRequirement = kAnything, - unsigned int tosRequirement = kAnything, - unsigned int tpsRequirement = kAnything ) override; - -protected: - /// get Hlt Summary and configuration - void getHltSummary(); - - /// Hlt summary reports - LHCb::HltDecReports* m_hltDecReports; - - /// Location of Hlt Summary - StringProperty m_HltDecReportsLocation; - - bool m_newEvent; - -private: - /// add TisTosSummary to the cached result; - bool addTisTosSummary( std::vector<unsigned int>& tisTosSummary ); - - /// Look for TisTosSummary of OfflineInput; add it to the cached result; - bool addParticleTisTosSummary( const LHCb::Particle& object ); - - // internal Cache of results used as long as the Offline Input remains the same (cache only full classifications) - - void clearCache() { - m_cached_SelectionNames.clear(); - m_cached_tisTosTob.clear(); - } - - void storeInCache( const std::string& selectionName, unsigned int result ) { - m_cached_SelectionNames.push_back( selectionName ); - m_cached_tisTosTob.push_back( result ); - } - - bool findInCache( const std::string& selectionName, unsigned int& result ) { - std::vector<std::string>::iterator found = - std::find( m_cached_SelectionNames.begin(), m_cached_SelectionNames.end(), selectionName ); - if ( found == m_cached_SelectionNames.end() ) return false; - int index( found - m_cached_SelectionNames.begin() ); - result = m_cached_tisTosTob[index]; - return true; - } - - // -------------------------- data members -------------------- - - /// Cache of results for the same Offline Input - std::vector<std::string> m_cached_SelectionNames; - std::vector<unsigned int> m_cached_tisTosTob; -}; -#endif // TRIGGERSELECTIONTISTOSSUMMARY_H diff --git a/Phys/TisTosTobbing/src/TriggerTisTosSummary.cpp b/Phys/TisTosTobbing/src/TriggerTisTosSummary.cpp deleted file mode 100644 index 08c9d14f8..000000000 --- a/Phys/TisTosTobbing/src/TriggerTisTosSummary.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// Include files -#include <algorithm> -#include <sstream> - -// local -#include "TriggerTisTosSummary.h" - -#include "boost/regex.hpp" - -#include "Event/HltDecReports.h" - -using namespace LHCb; - -//----------------------------------------------------------------------------- -// Implementation file for class : TriggerTisTosSummary -// -// 2010-10-18 : Tomasz Skwarnicki -//----------------------------------------------------------------------------- - -// Declaration of the Tool Factory -DECLARE_COMPONENT( TriggerTisTosSummary ) - -const std::vector<std::string> TriggerTisTosSummary::m_empty_selections = std::vector<std::string>(); - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -TriggerTisTosSummary::TriggerTisTosSummary( const std::string& type, const std::string& name, const IInterface* parent ) - : TriggerSelectionTisTosSummary( type, name, parent ) { - declareInterface<ITriggerTisTos>( this ); - - declareProperty( "TriggerInputWarnings", m_trigInputWarn = false ); -} -//============================================================================= -// Destructor -//============================================================================= -TriggerTisTosSummary::~TriggerTisTosSummary() {} - -//============================================================================= -// Initialization -//============================================================================= -StatusCode TriggerTisTosSummary::initialize() { - StatusCode sc = TriggerSelectionTisTosSummary::initialize(); // must be executed first - if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm - - debug() << "==> Initialize" << endmsg; - - setOfflineInput(); - setTriggerInput(); - - return StatusCode::SUCCESS; -} - -//============================================================================= - -void TriggerTisTosSummary::getTriggerNames() { - if ( m_newEvent ) { - m_triggerNames.clear(); - m_newEvent = false; - } - - // done before ? - if ( !( m_triggerNames.empty() ) ) { return; } - - // get trigger names from HltDecReports - if ( !m_hltDecReports ) getHltSummary(); - // for the same TCK this should be fixed list for events which passed Hlt - if ( m_hltDecReports ) { m_triggerNames = m_hltDecReports->decisionNames(); } - - if ( m_triggerNames.empty() ) { Warning( "No known trigger names found", StatusCode::FAILURE, 1 ).setChecked(); } -} - -void TriggerTisTosSummary::setTriggerInput() { m_triggerInput_Selections.clear(); } - -void TriggerTisTosSummary::addToTriggerInput( const std::string& selectionNameWithWildChar ) { -#if 0 - // if selectionNameWithWildChar contains a * without a . in front of it: print warning... - static boost::regex warn("[^\\.]\\*"); - if ( boost::regex_search( selectionNameWithWildChar, warn ) ) { - Warning( " addToTriggerInput now does Posix (Perl) regular expression matching instead of globbing;" - " this implies that eg. a '*' should be replaced by '.*'. You've specified " - " a selectionName using a '*', without leading '.': '" + selectionNameWithWildChar - + "'. Please verify whether this is what you still want\n " - " For more information on the supported syntax, please check " - " http://www.boost.org/doc/libs/1_39_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html" - ,StatusCode::SUCCESS - ).ignore(); - } -#endif - unsigned int sizeAtEntrance( m_triggerInput_Selections.size() ); - getTriggerNames(); - boost::regex expr( selectionNameWithWildChar ); - for ( std::vector<std::string>::const_iterator inpt = m_triggerNames.begin(); inpt != m_triggerNames.end(); ++inpt ) { - if ( boost::regex_match( *inpt, expr ) ) { - if ( find( m_triggerInput_Selections.begin(), m_triggerInput_Selections.end(), *inpt ) == - m_triggerInput_Selections.end() ) { - m_triggerInput_Selections.push_back( *inpt ); - } - } - } - if ( m_trigInputWarn && ( m_triggerInput_Selections.size() == sizeAtEntrance ) ) { - std::ostringstream mess; - mess << " addToTriggerInput called with selectionNameWithWildChar=" << selectionNameWithWildChar - << " added no selection to the Trigger Input, which has size=" << m_triggerInput_Selections.size(); - Warning( mess.str(), StatusCode::SUCCESS, 50 ).setChecked(); - } -} - -unsigned int TriggerTisTosSummary::tisTosTrigger() { - unsigned int result = 0; - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " tisTosTrigger called with empty Trigger Input" ).setChecked(); - return result; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - unsigned int res = tisTosSelection( *iTriggerSelection ); - if ( res & kDecision ) { result |= res; } - if ( ( result & kTOS ) && ( result & kTIS ) && ( result & kTPS ) ) break; - } - return result; -} - -// analysisReport for Trigger (define Trigger & Offline Input before calling) -std::string TriggerTisTosSummary::analysisReportTrigger() { - std::ostringstream report; - report << offset() << " Trigger #-of-sel " << m_triggerInput_Selections.size() << std::endl; - unsigned int result = 0; - if ( m_triggerInput_Selections.empty() ) { - report << "Trigger Input empty" << std::endl; - return report.str(); - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - unsigned int res = tisTosSelection( *iTriggerSelection ); - ++m_reportDepth; - if ( res & kDecision ) { - report << analysisReportSelection( *iTriggerSelection ); - result |= res; - } else { - report << offset() << " Selection " + *iTriggerSelection + " decision=false " << std::endl; - } - --m_reportDepth; - - // if( (result & kTOS) && (result & kTIS) && (result & kTPS ) )break; - } - TisTosTob res( result ); - report << offset() << " Trigger #-of-sel " << m_triggerInput_Selections.size() << " TIS= " << res.tis() - << " TOS= " << res.tos() << " TPS= " << res.tps() << " decision= " << res.decision() << std::endl; - return report.str(); -} - -// fast check for TOS -bool TriggerTisTosSummary::tosTrigger() { - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " tosTrigger called with empty Trigger Input" ).setChecked(); - return false; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - if ( tosSelection( *iTriggerSelection ) ) return true; - } - return false; -} - -// fast check for TIS -bool TriggerTisTosSummary::tisTrigger() { - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " tisTrigger called with empty Trigger Input" ).setChecked(); - return false; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - if ( tisSelection( *iTriggerSelection ) ) return true; - } - return false; -} - -// fast check for TUS -bool TriggerTisTosSummary::tusTrigger() { - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " tpsTrigger called with empty Trigger Input" ).setChecked(); - return false; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - if ( tusSelection( *iTriggerSelection ) ) return true; - } - return false; -} - -std::vector<std::string> TriggerTisTosSummary::triggerSelectionNames( unsigned int decisionRequirement, - unsigned int tisRequirement, - unsigned int tosRequirement, - unsigned int tpsRequirement ) { - if ( ( decisionRequirement >= kAnything ) && ( tisRequirement >= kAnything ) && ( tosRequirement >= kAnything ) && - ( tpsRequirement >= kAnything ) ) { - return m_triggerInput_Selections; - } - std::vector<std::string> selections; - for ( std::vector<std::string>::const_iterator iSel = m_triggerInput_Selections.begin(); - iSel != m_triggerInput_Selections.end(); ++iSel ) { - bool decision, tis, tos, tps; - unsigned int result = tisTosSelection( *iSel ); - decision = result & kDecision; - tos = result & kTOS; - tis = result & kTIS; - tps = result & kTPS; - if ( ( ( decisionRequirement >= kAnything ) || ( decision == decisionRequirement ) ) && - ( ( tisRequirement >= kAnything ) || ( tis == tisRequirement ) ) && - ( ( tosRequirement >= kAnything ) || ( tos == tosRequirement ) ) && - ( ( tpsRequirement >= kAnything ) || ( tps == tpsRequirement ) ) ) { - selections.push_back( *iSel ); - } - } - return selections; -} - -std::vector<const LHCb::HltObjectSummary*> TriggerTisTosSummary::hltObjectSummaries( unsigned int tisRequirement, - unsigned int tosRequirement, - unsigned int tpsRequirement ) { - std::vector<const LHCb::HltObjectSummary*> hosVec; - if ( m_triggerInput_Selections.empty() ) { - if ( m_trigInputWarn ) Warning( " hltObjectSummaries called with empty Trigger Input" ).setChecked(); - return hosVec; - } - for ( std::vector<std::string>::const_iterator iTriggerSelection = m_triggerInput_Selections.begin(); - iTriggerSelection != m_triggerInput_Selections.end(); ++iTriggerSelection ) { - std::vector<const LHCb::HltObjectSummary*> selHosVec = - hltSelectionObjectSummaries( *iTriggerSelection, tisRequirement, tosRequirement, tpsRequirement ); - hosVec.insert( hosVec.end(), selHosVec.begin(), selHosVec.end() ); - } - return hosVec; -} diff --git a/Phys/TisTosTobbing/src/TriggerTisTosSummary.h b/Phys/TisTosTobbing/src/TriggerTisTosSummary.h deleted file mode 100644 index 85ef2beb5..000000000 --- a/Phys/TisTosTobbing/src/TriggerTisTosSummary.h +++ /dev/null @@ -1,91 +0,0 @@ -/*****************************************************************************\ -* (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". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef TRIGGERTISTOSSUMMARY_H -#define TRIGGERTISTOSSUMMARY_H 1 - -// Include files -// from Gaudi -#include "GaudiAlg/GaudiTool.h" -#include "Kernel/ITriggerTisTos.h" // Interface - -#include "TriggerSelectionTisTosSummary.h" - -/** @class TriggerTisTosSummary TriggerTisTosSummary.h - * - * @author Tomasz Skwarnicki - * @date 2010-10-18 - * - * TisTosSummary based implementation of Tis,Tos'ing Trigger specified via trigger name pattern. - * @sa TriggerSelectionTisTosSummary for inherited member functions (e.g. to define Offline Input). - * @sa ITriggerTisTos docs for more explanation. - * This interface also defines inlined shortcuts to set Offline Input and or Trigger Input and get an output in one - * call. - */ -class TriggerTisTosSummary : public TriggerSelectionTisTosSummary, virtual public ITriggerTisTos { -public: - /// Standard constructor - TriggerTisTosSummary( const std::string& type, const std::string& name, const IInterface* parent ); - - ~TriggerTisTosSummary(); ///< Destructor - - StatusCode initialize() override; - - /// erase previous Trigger Input - void setTriggerInput() override; - - /// add Trigger Selection Name pattern to Trigger Input; pattern may contain wild character *, all matches will be - /// added - void addToTriggerInput( const std::string& selectionNameWithWildChar ) override; - - /// Complete classification of the Trigger Input (see ITisTis::TisTosTob for the meaning) - unsigned int tisTosTrigger() override; - - /// check for TOS - may be faster than using tisTosTrigger() - bool tosTrigger() override; - - /// check for TIS - may be faster than using tisTosTrigger() - bool tisTrigger() override; - - /// check for TUS (Trigger Used Signal: TPS or TOS) - may be faster than using tisTosTrigger() - bool tusTrigger() override; - - /// analysis report - std::string analysisReportTrigger() override; - - /// returns Trigger Selection names matching optional pattern of decision,tis,tos for previously set Trigger and - /// Offline Inputs - std::vector<std::string> triggerSelectionNames( unsigned int decisionRequirement = kAnything, - unsigned int tisRequirement = kAnything, - unsigned int tosRequirement = kAnything, - unsigned int tpsRequirement = kAnything ) override; - - /// list of HltObjectSummaries from Selections satisfying TOS,TIS requirements (define Trigger and Offline Input - /// before calling) - std::vector<const LHCb::HltObjectSummary*> hltObjectSummaries( unsigned int tisRequirement = kAnything, - unsigned int tosRequirement = kAnything, - unsigned int tpsRequirement = kAnything ) override; - -private: - /// if true then warning about empty trigger inputs are printed - bool m_trigInputWarn; - - /// obtain all known trigger names - void getTriggerNames(); - - static const std::vector<std::string> m_empty_selections; - - /// content of Trigger Input (list of trigger selection names) - std::vector<std::string> m_triggerInput_Selections; - - /// all known trigger names - std::vector<std::string> m_triggerNames; -}; -#endif // TRIGGERTISTOSSUMMARY_H -- GitLab From c2ce032a4a1da8ebf4dd56d4ab5411cb858f5c70 Mon Sep 17 00:00:00 2001 From: Patrick Koppenburg <Patrick Koppenburg patrick.koppenburg@cern.ch> Date: Fri, 19 Mar 2021 16:43:11 +0100 Subject: [PATCH 2/2] Fix LoKi doc --- .../dict/DaVinciInterfacesDict.h | 2 -- Phys/LoKiPhys/LoKi/Particles33.h | 25 ------------------- 2 files changed, 27 deletions(-) diff --git a/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h b/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h index 1c3765deb..217c0cd00 100644 --- a/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h +++ b/Phys/DaVinciInterfaces/dict/DaVinciInterfacesDict.h @@ -38,8 +38,6 @@ #include "Kernel/IJets2Jets.h" #include "Kernel/ILifetimeFitter.h" #include "Kernel/IMassFit.h" -#include "Kernel/IP2VVAngleCalculator.h" -#include "Kernel/IP2VVPartAngleCalculator.h" #include "Kernel/IPVReFitter.h" #include "Kernel/IParticle2State.h" #include "Kernel/IParticleArrayFilter.h" diff --git a/Phys/LoKiPhys/LoKi/Particles33.h b/Phys/LoKiPhys/LoKi/Particles33.h index 08b4ea1c8..877c46324 100644 --- a/Phys/LoKiPhys/LoKi/Particles33.h +++ b/Phys/LoKiPhys/LoKi/Particles33.h @@ -36,8 +36,6 @@ namespace LoKi { * * @see LoKi::Kinematics::decayAngle * @see LoKi::Kinematics::cosDecayAngle - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::COSPOL * * The decay angle calculated is that between @@ -117,8 +115,6 @@ namespace LoKi { * decay planes of daughter particles * * @see LoKi::Kinematics::sinDecayAngleChi - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::SINCHI * * The angle is calculated using the explicit @@ -156,7 +152,6 @@ namespace LoKi { * The sign for <c>sin</c> is set according to * Thomas Blake's code from * P2VVAngleCalculator tool - * @see P2VVAngleCalculator * * @attention It is very important to know the structure * of the decay for proper use of this functor @@ -218,8 +213,6 @@ namespace LoKi { * decay planes of daughter particles * * @see LoKi::Kinematics::cosDecayAngleChi - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::SINCHI * * The angle is evaluated using the explicit @@ -286,8 +279,6 @@ namespace LoKi { * @see LoKi::Kinematics::decayAngleChi * @see LoKi::Kinematics::sinDecayAngleChi * @see LoKi::Kinematics::cosDecayAngleChi - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::SINCHI * * @attention It is very important to know the structure @@ -328,8 +319,6 @@ namespace LoKi { * transversity angle \f$\cos \theta_{\mathrm{tr}} \f$ * * @see LoKi::Kinematics::cosThetaTr - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::COSTHETATR * * The evaluation is performed using the explicit Lorentz-invariant @@ -387,8 +376,6 @@ namespace LoKi { * transversity angle phi \f$\sin \phi_{\mathrm{tr}} \f$ * * @see LoKi::Kinematics::sinPhiTr - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::SINPHITR * * The evaluation is performed using the explicit Lorentz-invariant @@ -455,8 +442,6 @@ namespace LoKi { * transversity angle phi \f$\cos \phi_{\mathrm{tr}} \f$ * * @see LoKi::Kinematics::cosPhiTr - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::COSPHITR * * The evaluation is performed using the explicit Lorentz-invariant @@ -500,8 +485,6 @@ namespace LoKi { * transversity angle phi \f$\phi_{\mathrm{tr}} \f$ * * @see LoKi::Kinematics::anglePhiTr - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::ANGLEPHITR * * The evaluation is performed using the explicit Lorentz-invariant @@ -565,8 +548,6 @@ namespace LoKi { * @see LoKi::Particles::PolarizationAngle * @see LoKi::Kinematics::decayAngle * @see LoKi::Kinematics::cosDecayAngle - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::COSPOL * * @author Vanya BELYAEV Ivan.Belyaev@itep.ru @@ -592,8 +573,6 @@ namespace LoKi { * @endcode * * @see LoKi::Kinematics::sinDecayAngleChi - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::COSPOL * * @author Vanya BELYAEV Ivan.Belyaev@itep.ru @@ -619,8 +598,6 @@ namespace LoKi { * @endcode * * @see LoKi::Kinematics::cosDecayAngleChi - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::COSPOL * * @author Vanya BELYAEV Ivan.Belyaev@itep.ru @@ -648,8 +625,6 @@ namespace LoKi { * @see LoKi::Kinematics::decayAngleChi * @see LoKi::Kinematics::sinDecayAngleChi * @see LoKi::Kinematics::cosDecayAngleChi - * @see IP2VVAngleCalculator - * @see IP2VVPartAngleCalculator * @see LoKi::Cuts::COSPOL * * @author Vanya BELYAEV Ivan.Belyaev@itep.ru -- GitLab