diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b6d91896cc011c4695f8aba652f3307586a6f4c..91861ef421a01a59180579113b97509cf8126fa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,6 @@ lhcb_add_subdirectories( Phys/FunTuple Phys/JetAccessoriesMC Phys/LoKiAlgoMC - Phys/LoKiPhysMC - Phys/Particle2MCTruth ) lhcb_finalize_configuration() diff --git a/Phys/DaVinciMCTools/CMakeLists.txt b/Phys/DaVinciMCTools/CMakeLists.txt index 1b6ed11b176f567b34aec56fa5d64b2032f9cb9a..b7cb3eaf45876aa56c145dd8d5f40c04092769e6 100644 --- a/Phys/DaVinciMCTools/CMakeLists.txt +++ b/Phys/DaVinciMCTools/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2000-2021 CERN for the benefit of the LHCb Collaboration # +# (c) Copyright 2000-2022 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". # @@ -26,7 +26,6 @@ gaudi_add_module(DaVinciMCTools src/Particle2BackgroundCategoryRelationsAlg.cpp src/PrintDecayTreeTool.cpp LINK - Analysis::LoKiPhysMCLib Boost::headers Gaudi::GaudiAlgLib Gaudi::GaudiKernel @@ -42,4 +41,5 @@ gaudi_add_module(DaVinciMCTools Rec::DaVinciInterfacesLib Rec::DaVinciKernelLib Rec::DaVinciMCKernelLib + Rec::LoKiPhysMCLib ) diff --git a/Phys/LoKiAlgoMC/CMakeLists.txt b/Phys/LoKiAlgoMC/CMakeLists.txt index 2fc6b27d69aefd7bc01cc618e40e6ee2207ab787..9cd2a924985f9bc666882046512662e9cc3bcab2 100644 --- a/Phys/LoKiAlgoMC/CMakeLists.txt +++ b/Phys/LoKiAlgoMC/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2000-2021 CERN for the benefit of the LHCb Collaboration # +# (c) Copyright 2000-2022 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". # @@ -21,7 +21,6 @@ gaudi_add_library(LoKiAlgoMCLib src/MCTupleDicts.cpp LINK PUBLIC - Analysis::LoKiPhysMCLib Gaudi::GaudiAlgLib LHCb::LoKiCoreLib LHCb::LoKiMCLib @@ -29,6 +28,7 @@ gaudi_add_library(LoKiAlgoMCLib LHCb::MCInterfaces Rec::DaVinciMCKernelLib Rec::LoKiAlgo + Rec::LoKiPhysMCLib PRIVATE Rec::DaVinciKernelLib ) @@ -39,7 +39,6 @@ gaudi_add_module(LoKiAlgoMC src/Components/DecayTruth.cpp src/Components/HybridMCParticleArrayFilter.cpp LINK - Analysis::LoKiPhysMCLib Gaudi::GaudiAlgLib LHCb::LoKiCoreLib LHCb::LoKiMCLib @@ -47,6 +46,7 @@ gaudi_add_module(LoKiAlgoMC Rec::DaVinciMCKernelLib Rec::LoKiAlgo Rec::LoKiPhysLib + Rec::LoKiPhysMCLib ) gaudi_add_dictionary(LoKiAlgoMCDict diff --git a/Phys/LoKiPhysMC/CMakeLists.txt b/Phys/LoKiPhysMC/CMakeLists.txt deleted file mode 100644 index 3106c247d099579e2a68f7770e17630849a51e62..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -############################################################################### -# (c) Copyright 2000-2021 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. # -############################################################################### -#[=======================================================================[.rst: -Phys/LoKiPhysMC ---------------- -#]=======================================================================] - -gaudi_add_library(LoKiPhysMCLib - SOURCES - src/LoKiPhysMC.cpp - src/MCMatch.cpp - src/MCMatchDicts.cpp - src/MCMatchObj.cpp - src/MCMatcher.cpp - src/MCTruth.cpp - src/PhysMCParticles.cpp - LINK - PUBLIC - Gaudi::GaudiKernel - LHCb::LoKiCoreLib - LHCb::LoKiMCLib - LHCb::MCEvent - LHCb::PhysEvent - LHCb::RecEvent - LHCb::RelationsLib - LHCb::TrackEvent - Rec::DaVinciMCKernelLib - Rec::LoKiPhysLib - PRIVATE - Gaudi::GaudiAlgLib - LHCb::PartPropLib -) - -gaudi_add_module(LoKiPhysMC - SOURCES - src/Components/LoKi_Track2MC.cpp - src/Components/MCTruthPhoton.cpp - src/Components/P2MC.cpp - src/Components/P2MCBase.cpp - src/Components/P2MCW.cpp - src/Components/PV2MC.cpp - src/Components/PV2MCAlg.cpp - LINK - Boost::headers - Gaudi::GaudiAlgLib - Gaudi::GaudiKernel - LHCb::GenEvent - LHCb::LinkerEvent - LHCb::LoKiCoreLib - LHCb::LoKiMCLib - LHCb::MCAssociators - LHCb::MCEvent - LHCb::PhysEvent - LHCb::RecEvent - LHCb::RelationsLib - LHCb::TrackEvent - LoKiPhysMCLib - Rec::DaVinciMCKernelLib - Rec::LoKiPhysLib -) - -gaudi_add_dictionary(LoKiPhysMCDict - HEADERFILES dict/LoKiPhysMCDict.h - SELECTION dict/LoKiPhysMC.xml - LINK LoKiPhysMCLib -) - -gaudi_install(PYTHON) - -gaudi_add_tests(QMTest) diff --git a/Phys/LoKiPhysMC/dict/LoKiPhysMC.xml b/Phys/LoKiPhysMC/dict/LoKiPhysMC.xml deleted file mode 100644 index 526361a12d0210bebc5fce578a279f4ad4def0ce..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/dict/LoKiPhysMC.xml +++ /dev/null @@ -1,60 +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. ---> -<!-- - * ======================================================================== - * @file - * The seleciton file to build Reflex dictionaries - * for Phys/LoKiPhysMC package - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-02-06 - * ======================================================================== ---> - -<lcgdict> - - - <class name = "LoKi::MCMatch" /> - <class name = "LoKi::MCMatchObj" /> - - <class name="LoKi::Interface<LoKi::MCMatchObj>" /> - - <class name = "LoKi::PhysMCParticles::RCTruth" /> - <class name = "LoKi::PhysMCParticles::MCTruth" /> - - <class name = "LoKi::PhysMCParticles::MCMatcherBase" /> - <class name = "LoKi::PhysMCParticles::MCSelMatch" /> - <class name = "LoKi::PhysMCParticles::MCTreeMatch" /> - <class name = "LoKi::PhysMCParticles::MCNodeMatch" /> - - <function pattern="LoKi::Dicts::MCMatchDicts::*" /> - - <exclusion> - - <class pattern="LoKi::PhysMCParticles::*"> - <method name="=" /> - </class> - <class pattern="LoKi::Dicts::*"> - <method name="=" /> - </class> - <class pattern="LoKi::Interface<*>"> - <method name="=" /> - </class> - - <class name="LoKi::MCMatch"> - <method name="=" /> - </class> - <class name="LoKi::MCMatchObj"> - <method name="=" /> - </class> - - </exclusion> - -</lcgdict> diff --git a/Phys/LoKiPhysMC/dict/LoKiPhysMCDict.h b/Phys/LoKiPhysMC/dict/LoKiPhysMCDict.h deleted file mode 100644 index ce6b63136c603069a6a12fd0e2a7a1a55f9be30b..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/dict/LoKiPhysMCDict.h +++ /dev/null @@ -1,32 +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 LOKI_LOKIPHYSMCDICT_H -# define LOKI_LOKIPHYSMCDICT_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// LoKi -// ============================================================================ -# include "LoKi/LoKiPhysMC.h" -# include "LoKi/MCMatcher.h" -// ============================================================================ -# include "LoKi/MCMatchDicts.h" -// ============================================================================ -# ifdef __INTEL_COMPILER -# pragma warning( disable : 177 ) // variable ... was declared but never referenced -# pragma warning( disable : 191 ) // type qualifier is meaningless on cast type -# endif -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_LOKIPHYSMCDICT_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/doc/release.notes b/Phys/LoKiPhysMC/doc/release.notes deleted file mode 100644 index a5c282774de11dd200e6e99d642114d5157c97eb..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/doc/release.notes +++ /dev/null @@ -1,776 +0,0 @@ -! ----------------------------------------------------------------------------- -! Package : Phys/LoKiPhysMC -! Responsible : Vanya BELYAEV ibelyaev@physics.syr.edu -! Purpose : RC <--> MC part of LoKi -! ----------------------------------------------------------------------------- - -! 2017-02-10 - Vanya Belyaev - - add new algorithm MCTuthPhoton to create "custom" MC-truth linkst between - some interesting MC-photons and neutral protoparticles - -e.g. build MC-truth for phtons frmo Bs -> phi(1020) gamma decays: - - from Configurables import LoKi__MCTruthPhoton as CustomPP2MC - - alg = CustomPP2MC('Custom') - alg.EnergyFraction = (0.1,2) - alg.MaxChi2 = 4 - ## - alg.PropertiesPrint = True - alg.Preambulo = [ - "from GaudiKernel.SystemOfUnits import GeV, MeV, cm" , - ] - alg.Code = """ - ( MCPT > 100 * MeV ) & MCDECTREE ( 'Beauty -> (phi(1020) => K+ K-) ^gamma' ) - """ - -or a bit more generic: - - alg.Preambulo = [ - "from GaudiKernel.SystemOfUnits import GeV, MeV, cm" , - "from LoKiCore.functions import in_range" - ] - alg.Code = """ - ( MCPZ > 1 * GeV ) & - ( MCPT > 0.1 * GeV ) & - MCFROMDECAYS & - ( abs ( MCPX / MCPZ ) < 0.350 ) & - ( abs ( MCPY / MCPZ ) < 0.250 ) & - in_range ( -20*cm , MCVFASPF( MCVZ ) , 20*cm ) - """ - -MC-mathching is perfomed using the spatial matching of photon direction -and CaloPositon ( using data on center&spread) using chi2. -for inner/middle zones chi2<1 has almost 100% efficiency, -for outer zone the distribution is a bit wider, but chi2<2 is close to 100% - - - 150 ++----+----+----+----+----+----+----+----+----+----+ - || . . . . . . . . . | - || . . . . . . . . . | - || . . . . . . . . . | - || . . . . . . . . . | - 112 ++.................................................+ - || . . . . . . . . . | - |** . . . . . . . . . | - |*** . . . . . . . . . | - |*** . . . . . . . . . | - 75 +***...............................................+ - |*** . . . . . . . . . | - |*** . . . . . . . . . | - |**** . . . . . . . . . | - |**** . . . . . . . . . | - 37.5 +****..............................................+ - |*****. . . . . . . . . | - |****** . . . . . . . . | - |********* . . . . . . . . | - |*********** . . . . . . . | - 0 *-++----+----+***************************************->* - U - N O - D V - E E - R R - F F - L 0 0 1 1 2 2 3 3 L - O . . . . . . . . O - W 00 4 8 2 6 2 4 8 2 6 4 W - - - -Optionally the criteria on E(mc)/E(calo) is applied. - -Usage., e.g. for Bender: - - bender_alg = ... - bender_alg.PP2MCs = [ - 'Relations/Rec/ProtoP/Charged' , - 'Relations/Rec/ProtoP/Upstream' , - 'Relations/Rec/ProtoP/Custom' ] - -for "mcMatch" - - ... = mcMatch ( ... , strings( [ - 'Relations/Rec/ProtoP/Charged' , - 'Relations/Rec/ProtoP/Upstream' , - 'Relations/Rec/ProtoP/Custom' ] ) , ... ) - - -!======================== LoKiPhysMC v9r11 2015-12-03 ========================= - -! 2015-11-09 - Gerhard Raven - - avoid comparing (smart)pointers to 0 - - replace LoKi::Select with std::copy_if - -! 2015-11-01 - Gerhard Raven - - replace endreq with endmsg - - avoid comparing (smart)pointers to 0 - - replace BOOST_STATIC_ASSERT with static_assert - - prefer range-based for loops - -!======================== LoKiPhysMC v9r10 2015-10-19 ========================= - -! 2015-10-09 - Vanya Belyaev - - - add possibility to create mcMatch functors outside of the algorithm loop - e.g. in bender command line: - - >>> get('/Event/Phys/StdNoPIDsPions/Particles', mcMatch('[ D*(2010)+ -> (D0 => pi- mu+ Nu) ^pi+]CC') ) - - Thanks to Adam Davis for inspiring idea - -!========================= LoKiPhysMC v9r9 2015-07-24 ========================= - -! 2015-06-22 - Eduardo Rodrigues - - Removed unused class rule producing warning in genflex. - -!========================= LoKiPhysMC v9r8 2015-02-26 ========================= - -! 2015-01-24 - Vanya Belyaev - - step towards generation of C++ code - -!========================= LoKiPhysMC v9r7 2014-10-30 ========================= - -! 2014-09-23 - Chris Jones - - Explicitly initialise LoKi::AuxFunBase() base class in - LoKi::PhysMCParticles::MCMatcherBase copy constructor. - -! 2014-09-03 - Vanya Belyaev - - Fix a problem with copy of "non-strandard" MCMatcher objects - many thanks to Igor Babushkin! - -! 2014-08-25 - Vanya Belyaev - - 1) Fix a typo in mcMatch - 2) Extend MCMatchers to allow picking MC-particles from non-standard locations - (thanks to Igor Babuschkin) - -!========================= LoKiPhysMC v9r6p2 2013-05-07 ========================= - -! 2013-02-26 - Chris Jones - - Fix -pedantic compilation warnings - -!========================= LoKiPhysMC v9r6p1 2012-11-30 ========================= - -! 2012-11-29 - Marco Clemencic - - Added CMake configuration file. - -!========================= LoKiPhysMC v9r6 2012-10-04 ========================= - -! 2012-09-18 - Will Barter - - Adapted HepMCParticleMaker so that you can exclude particles from a particle - mother. - -!========================= LoKiPhysMC v9r5 2012-02-09 ========================= - -! 2012-01-17 - Albert Bursche -- Adapted HepMCParticleMaker for https://savannah.cern.ch/task/?20125 - (changed ParticlePropertySvc) - -!========================= LoKiPhysMC v9r4 2011-11-10 ========================= - -! 2011-11-06 - Cédric Potterat - - add the possiblility to chose the pythia process(es) in HepMCParticleMaker - -! 2011-10-21 - Will Barter - - Extended Victor's option to get the full stable particle - set with no geometrical/kinematical cuts.. - -! 2011-10-21 - Victor Coco - - HepMCParticleMaker.cpp : add ForceNoCut option to get the full stable particle - set with no geometrical/kinematical cuts. - Add parton mode and selector. - -!========================= LoKiPhysMC v9r3 2011-06-17 ========================= -! 2011-06-04 - Vanya Belyaev - - remove some code - -! 2011-05-22 - Vanya Belyaev - - - MCMatchObj.cpp - another fix - - -! 2011-05-18 - Vanya Belyaev - - - MCMatchObj.cpp - minor fix in logic - -! 2011-05-18 - Vanya Belyaev - - - MCMatchObj.cpp - see bug report #82409 - release a bit the matching criteria for composed particles :-( - finally the final state matches is enough... - I suspect that it it too "loose".. but not I see no other easy solution - for Steve's problem - - - cmt/requirements - version increment to v9r2 - - - -!========================== LoKiPhysMC v9r1 2010-06-24 ======================== - -! 2010-05-31 - Vanya Belyaev - - fix for new LoKiMC - - cmt/requirements - version increment to v9r1 - -!========================== LoKiPhysMC v9r0 2010-04-30 ======================== - -! 2010-04-21 - Vanya Belyaev - - - src/Component/P2MCBase.h - - Container -> Range - - see task #13342 - - - -! 2010-04-06 - Vanya Belyaev - - replace LoKi::Range with Gaudi::Range - - new decorators - - cmt/requirements - version increment to v9r0 - -!========================== LoKiPhysMC v8r8 2010-03-27 ======================== -! 2010-03-14 - Vanya Belyaev - - - src/MatchObj.cpp - - - do not try to "use" ProtoParticles & Tracks, - if no corresponidg MC-tables are provided - - It is minor fix, but very important for usage with MicroDST - -- cmt/requirements - - verision increment to v8r8 - -!========================== LoKiPhysMC v8r7 2010-02-26 ======================== - -! 2010-02-18 - Vanya Belyaev - - - add new component , LoKi::Hybrid::MCTupleTool, - - simple implementation of IMCParticleTupleTool interface: - - XXTool.Varibales = { - - ## "name" : "functor" - - 'px' : "MCPX" , - - 'fromB' : " switch ( MCINANCESTORS ( BEAUTY ) , 1 , 0 ) " , - - 'fromLongLived' : " switch ( MCINANCESTORS ( MCDECNODE ( Nodes.LonvLived ), 1 , 0 ) " , - - 'fromPV' : " 0 == MCNINANCESTORS ( MCDECNODE ( Nodes.LonvLived ) ) " - - } - - - - - cmt/requirements - - version increment to v8r7 - -!========================== LoKiPhysMC v8r6 2009-12-11 ======================== -! 2009-12-03 - Vanya Belyaev - - - MCMatcher: automatiocally insert 'Relations/' into the path for relation table, - is original path does nto work... - - -! 2009-11-27 - Vanya Belyaev - - - minor fix with the default arguments for MCMatcher functors - ( required for properMC-match within DecayTreeTuple framework) - - - cmt/requirement - - version increment to v8r6 - -!========================== LoKiPhysMC v8r5 2009-10-16 ======================== -! 2009-09-03 - Vanya BELYAEV - - fix event and reference counters for MC-match - - cmt/requirements - version increment to v8r5 - -!========================== LoKiPhysMC v8r4 2009-09-02 ======================== -! 2009-09-02 - Marco Cattaneo - - Remove obsolete file src/Components/LoKiPhysMC_dll.cpp - -! 2009-08-12 - Vanya BELYAEV - - - add more context symnols: - - MCSELMATCH - MCNODEMATCH - MCTREEMATCH - - and the helper function mcMatch - - Thus one can use following constructions for - CombineParticles/FilterDesktop & "Hybrid" Plot/Print/Tuple-tools - - - XXX.DaughterCuts = { - 'K+' : " ( PT > 1*GeV ) & MCMATCH ( '[B_s0 => ^K+ ^K-]cc' ) " , - 'pi+' : " ( PT > 1*GeV ) & MCSELMATCH ( 'pi+' == MCABSD ) " , - 'mu+' : " ( PT > 1*GeV ) & MCNODEMATCH ( Lepton ) " - } - - -! 2009-08-11 - Vanya BELYAEV - - - add new "context" symbol MCMATCH to be used with CombineParticles/FilterDesktop - - - cmt/requirements - - version increment to v8r4 - -!========================== LoKiPhysMC v8r3 2009-05-25 ======================== -! 2009-05-09 - Vanya BELYAEV - - remove unnesessary std::unary/binary_function bases - - cmt/requirements - version increment to v8r3 - -!========================== LoKiPhysMC v8r2 2009-05-07 ======================== -! 2009-03-12 - Vanya BELYAEV - - src/MCMatchObj.cpp - fix to speed-up drastically the Monte Carlo Truth Matching - (thank to Jibo HE for inspiring "bug"-example) - - - cmt/requirements - version increment to v8r2 - -!========================== LoKiPhysMC v8r1 2009-01-12 ======================== -! 2009-01-10 - Chris Jones - - Add CLHEP dependency for OSX - -! 2008-11-28 - Vanya BELYAEV - - Add QMTest - -!========================== LoKiPhysMC v8r0 2008-11-17 ======================== -! 2008-11-04 - Vanya BELYAEV - - remove all opts files ( and the directory) - - add the configurations to tun 'on-demand' - Track -> MC relation tables - Primary Vertices ---> Monte Carlo Vertices - Primary Vertices ---> Generator Collisions relation tables - - python/LoKiPhysMC/Track2MC_Configuration.py - python/LoKiPhysMC/PV2MC_Configuration.py - - -! 2008-11-03 - Vanya BELYAEV - - resurrect & redesign all PV -> MCV stuff - -! 2008-11-02 - Vanya BELYAEV - - more fixes for variosu compilers - - remove some methods form the dictionaries - -! 2008-10-29 - Vanya BELYAEV - - few fixes to please gcc43 compilation - - cmt/requirements - versiom increment to v8r0 - -!========================== LoKiPhysMC v7r4 2008-07-27 ======================== -! 2008-07-22 - Vanya BELYAEV - - LoKi/DecayChain.h - remove obsolete CLHEP methods (not needed anymore with new HepMC) - - - cmt/requirements - version inrement to v7r4 - -!========================== LoKiPhysMC v7r3 2008-06-30 ======================== -! 2008-06-25 - Vanya BELYAEV - - update the components - - cmt/release.notes - version inrment to v7r3 - -!========================== LoKiPhysMC v7r2 2008-06-02 ======================== -! 2008-06-02 - Marco Cattaneo - - Fix two doxygen warnings - - cmt/requirements: version increment to v7r2 - -! 2008-06-02 - Vanya Belyaev - - Change the handled incidents from EndEvent to BeginEvent - -!========================== LoKiPhysMC v7r1 2008-05-19 ======================== -! 2008-05-19 - Marco Cattaneo - - Fix many "cut & paste" doxygen warnings - - Remove obsolete macro form requirements - -! 2008-05-17 - Vanya BELYAEV - - LoKi/DechayChain.h, src/DecayChain.cpp - put the various minor changes into improve the printout - in partular now all colors work nicely - -! 2008-05-05 - Vanya BELYAEV - - src/Components/DumpMC.cpp - new algorithm LoKi::DumpMC to perform the detailed printout of - MC information - -! 2008-05-04 - Vanya BELYAEV - - src/Components/DumpHepMC.cpp - new algorithm LoKi::DumpHepMC to perform the detailed prinput of - HepMC information (it is very useful for debugging of generators) - -- cmt/requirements: version increment to v7r1 - -!========================== LoKiPhysMC v7r0 2007-12-03 ======================== -! 2007-12-03 - Vanya BELYAEV - - update for the next major version of LoKi v7r0 ("The powerful Streamers") - - cmt/requirements - version increment to v7r0 - -!========================== LoKiPhysMC v6r2 2007-11-06 ======================== -! 2007-11-06 - Marco Cattaneo - - Fix some doxygen warnings - -! 2007-11-05 - Vanya BELYAEV - - src/Components/LoKi_PV2MCAlg.cpp - - fix couple of small problems with PV vertex <--> MC vertex association - - - cmt/requirements - version increment to v6r2 - -!========================== LoKiPhysMC v6r1 2007-10-08 ======================== -! 2007-10-07 - Vanya BELYAEV - - cmt/requirements - increment version to v6r1 - use new pattern for python modules - -!========================== LoKiPhysMC v6r0 2007-09-04 ======================== -! 2007-08-20 - Vanya BELYAEV - - increment the major version to v6r0 - -!========================== LoKiPhysMC v5r0 2007-06-11 ======================== -! 2007-06-10 - Vanya BELYAEV - - add the decorators for MCMatch class, - - few small fixes to please Reflex and make - functions vizible - - some work on unification of vizible interface - - New files: - - LoKi/MCMatchDicts.h - src/MCMatchDicts.cpp - -! 2007-06-04 - Marco Cattaneo - - Remove obsolete file src/Components/LoKiPhysMC_load.cpp - -! 2007-06-01 - Vanya BELYAEV - - prepare for the new major version v5r0 - - - New files: - - dict/LoKiPhysMC.xml - dict/LoKiPhysMCDict.h - - python/LoKiPhysMC/__init__.py - python/LoKiPhysMC/decorators.py - python/LoKiPhysMC/functions.py - python/LoKiPhysMC/tests.py - - - Modified files: - - - cmt/requirements - version increment to v5r0 - -!========================== LoKiPhysMC v4r1p1 2007-04-19 =================== -! 2007-04-19 - P. Koppenburg - Remove controversial doxygen comment - -!========================== LoKiPhysMC v4r1 2007-04-04 ======================= - -! 2007-04-04 - Vanya BELYAEV - - - src/Components/LoKi_HepMCPArticleMaker.cpp - fix a stupid bug with the defauld cuts for photons - - cmt/requirements - version increment to v4r1 - -!========================== LoKiPhysMC v4r0 2007-02-25 ======================= - -! 2007-02-24 - Vanya BELYAEV - - src/Components/LoKi_P2MC.cpp , - src/Components/LoKi_P2MCW.cpp - 1) adapt to new location of Particle2MCLinker - 2) eliminate the code duplication through insertion of base class - LoKi::P2MC - - src/Components/P2MC.h, - src/Components/P2MC.cpp - new base class to remove the code duplication in P2MC and - P2MCW algorithms - - - retag as v4r0 - -! 2007-02-23 - Vanya BELYAEV - - add an "On-Demand" conversion of Linkers into Relation tables. - - options/StdParticles2MC.opts - options/StdKaons2MC.opts - options/StdMuons2MC.opts - options/StdPions2MC.opts - options/StdProtons2MC.opts - options/StdElectrons2MC.opts - options/StdD02MC.opts - options/StdDplus2MC.opts - options/StdPhi2MC.opts - options/StdJpsi2MC.opts - - Configuration files to run an automatic on-demand decoding of linker objects - into Relation tables. - The configurtaionis just approximate, - for each concrete case, some tuning could be needed - - - cmt/requirements - version increment to v4r0 - -!========================== LoKiPhysMC v3r0 2007-01-20 ======================= - -! 2007-01-20 - Vanya BELYAEV - - LoKi/PhysMCParticles.h, - src/PhysMCParticles.cpp - - add new function LoKi::Particles::GenMCTruth for association of - LHCb::Particle objects and HepMC::GenParticle objects - ( it is needed e.g. for parton-jet matching in higgs/jet studies) - - /** @class GenMCTruth PhysMCParticles.h LoKi/PhysMCParticles.h - * - * Helper and useful function to be used to check the matching of - * LHCb::Particle and some HepMC::GenParticle - * - * @code - * - * // some sequence of HepMC-particles - * SEQUENCE hepmcps = ... ; - * // get RC<-->MC-matcher - * MCMatch mc = ... ; - * // get HepMC<-->MC matcher - * const LHCb::HepMC2MC* table = ... ; - * // create the function - * Cut cut = GMCTRUTH( table , mc , hepmcps.begin() , hepmcps.end() ) ; - * - * const LHCb::Particle* B = ... ; - * - * // use the predicate! - * - * const bool good = cut( B ) ; - * - * @endcode - * - * @see LoKi::Cuts::GMCTRUTH - * @author Vanya BELYAEV ibelyaev@physics.sye.edu - * @date 2003-01-28 - */ - - - LoKi/PhysMCParticleCuts.h: - - add a shortcut (LoKi::Cuts::)GMCTRUTH for new class LoKi::Particles::GenMCTruth - -! 2007-01-19 - Vanya BELYAEV - - - LoKi/DecayChain.h - add the printout for many additional classes - - -!========================== LoKiPhysMC v3r0 2007-01-09 ======================= -! 2007-01-09 - Florence RANJARD - - install include files - -!========================== LoKiPhysMC v2r6p1 2006-12-15 ===================== - -! 2006-12-15 - Ivan Belyaev - - src/Components/LoKi_HepMCParticleMaker.cpp - fix few bugs, observed and lindly reported by Victor COCO - - cmt/requirements - version increment to v2r6p1 - -!========================== LoKiPhysMC v2r6 2006-11-25 ======================== -! 2006-11-25 - Vanya BELYAEV - - add RCTUTH typedef into namespace LoKi::Cuts - - improve a little bit Doxygen documentation - - remove semicolumns after the namespaces - - cmt/requirements - version imcprement to v2r6 - - -!========================== LoKiPhysMC v2r5 2006-11-12 ======================== - -! 2006-11-12 - Vanya BELYAEV - - - src/Components/LoKi_HepMCParticleMaker.cpp - for the default configuration DISABLE the smearing of momenta and positions - - - options/StdHepMCPhotons.opts - new file for "standard HepMC-photons" - - - options/*.opts - adapt all option-file for new semantic of Data-On-Demans Service - - - cmt/requirements - 1) add the environment variables: - HEPMCSTANDARDPARTICLESROOT and HEPMCSTANDARDPARTICLESOPTS to allow - coherent inclusion of HepMC particles, e.g. - - #include "$HEPMCSTANDARDPARTICLESOPTS/StdHepMCPions.opts" - 2) version increment to v2r5 - -!========================== LoKiPhysMC v2r4 2006-10-11 ======================== - -! 2006-10-11 - Vanya BELYAEV - - Make usage of new package Phys/DaVinciMCKernel - - - Kernel/*.cpp : remove all files - - - cmt/requirements - version incrmeent to v2r4 - -! 2006-10-10 - Vanya BELYAEV - - LoKi/MCMatchObj.h - src/MCMatchObj.cpp - tiny fixes for good&valid reflex/python dictionaries - - cmt/requirements - version incrmeent to v2r3 - -!========================== LoKiPhysMC v2r2 2006-10-04 ======================== -! 2006-10-04 - Vanya BELYAEV - - - Kernel/RC2HepMC.h - - new file, nesessary definitions for LHCb::Particle -> HepMC::GenParticle - - - options/StdHepMCElectrons.opts - - options/StdHepMCKaons.opts - - options/StdHepMCMuons.opts - - options/StdHepMCPions.opts - - options/StdHepMCProtons.opts - - configuration files to build on-demand "standard" particles - from generator information - - - src/Components/LoKi_HepMCParticleMaker.cpp - - special "particle maker": tool to produce particles from generator - particles. - - - RETAG ad v2r2 - - -!========================== LoKiPhysMC v2r2 2006-09-26 ======================== -! 2006-09-26 - Vanya Belyaev - - add LoKi_HepMCParticleMaker.cpp - - cmt/requirements - version increment to v2r2 - -!========================== LoKiPhysMC v2r1 2006-09-06 =================== - -! 2006-09-06 - Vanya BELYAEV - - LoKi/PhysMCParticles.h, src/PhysMCParticles.cpp - fix a duplication in constructor - - cmt/requirements - version increment to v2r1 - - -!========================== LoKiPhysMC v2r0 2006-08-30 =================== - - -! 2006-08-29 - Ivan BELYAEV - - Many updated to simplify the operations with MC - - - Kernel/Particle2MC.h - Kernel/Track2MC.h - new definitions - - - -! 2006-08-15 - Vanya BELYAEV - - - make an adaptation to new inheriance scheme - LHCb::Vertex <--- LHCb::VertexBase --> LHCb::RecVertex - - cmt/requirements - version increment to v2r0 - - -!========================== LoKiPhys v1r2 2006-07-07 =================== - -! 2006-06-23 - Juan PALACIOS - - fix for new version of Kernel/Relations - (no need in "serializers" anymore) - - cmt/requirements increment version to v1r2 - -!========================== LoKiPhys v1r1 2006-05-29 =================== - -! 2006-05-27 - VanyaBELYAEV - - LoKi/DecayChain.h, src/DecayChain.cpp - nice utility for printout of (Phys/MC/HepMC)-trees - - cmt/requirments - versionincrement to v1r1 - -! 2006-03-19 - Vanya BELYAEV - - the major upgrade - add the code for making the links inbetween the recontructed - primary vertices and (primary) MC-vertices and pp-collisions. - - The link attribute ("weight") is LHCb::PV2MCWeight, - which is std::pair<size_t,float>. - The first component is a number of true MC-tracks from the - given (primary) vertez, used in the reconstruction of the PrimVertex - The second component is chi2-distance inbetween the reconstructed - primary vertex and (primary) MC-vertex/pp-Collision - - Relation tables and builder algorithsm - - Kernel/PV2MC.h - the defintion of basic types & table locations - Types: - RC --> MC - IRelationWeighted<LHCb::PrimVertex,LHCb::MCVertex,LHCb::PV2MCWeght> , - MC --> RC - IRelationWeighted<LHCb::MCVertex,LHCb::PrimVertexLHCb::PV2MCWeght> , - RC --> pp-Collision - IRelationWeighted<LHCb::PrimVertex,LHCb::GenCollision,LHCb::PV2MCWeght> , - pp-Collision --> RC - IRelationWeighted<LHCb::GenCollision,LHCb::PrimVertexLHCb::PV2MCWeght> - - Locaions of 2D tables: - LHCb::PV2MCLocation::Default, defined as - "Relations/" + LHCb::VertexLocation::Primary - LHCb::PV2CoillisonLocation::Default, defined as - "Relations/" + LHCb::VertexLocation::Primary + "2Collision" - - Algorithm: - - src/Components/LoKi_PV2MCAlg.cpp - the algorithm to build the links - - Run-time configuration (using Data-on-Demand service) - - options/LoKiPhysMC.opts - options/PV2MC.opts - - - OPTIONAL: (for those who likes to manipulate with tools) - - Kernel/IPV2MC.h - src/Components/LoKi_PV2MC.cpp - definition of the abstract interface to deal with the tables - and concrete tool - - -! 2006-03-14 - Vanya BELYAEV - - new import - - -! ----------------------------------------------------------------------------- -! The END -! ----------------------------------------------------------------------------- diff --git a/Phys/LoKiPhysMC/include/LoKi/Inherits.h b/Phys/LoKiPhysMC/include/LoKi/Inherits.h deleted file mode 100644 index 771ceb245d5a0726acae015b895bcc1d62e6a60d..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/Inherits.h +++ /dev/null @@ -1,26 +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 LOKI_INHERITS_H -# define LOKI_INHERITS_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// Relations -// ============================================================================ -# include "Relations/IsConvertible.h" -// ============================================================================ -# define INHERITS( T1, T2 ) \ - ( Relations::IsConvertible<const T1*, const T2*>::value && !Relations::IsConvertible<const T1*, const void*>::same ) -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_INHERITS_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/LoKiPhysMC.h b/Phys/LoKiPhysMC/include/LoKi/LoKiPhysMC.h deleted file mode 100644 index 90f78cb86fd88a018b00f3fd9477afa75101b375..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/LoKiPhysMC.h +++ /dev/null @@ -1,43 +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 LOKI_LOKIPHYSMC_H -# define LOKI_LOKIPHYSMC_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -# include "LoKi/MCMatch.h" -# include "LoKi/MCMatchObj.h" -# include "LoKi/PhysMCParticleCuts.h" -# include "LoKi/PhysMCParticles.h" -# include "LoKi/PhysMCTypes.h" -// ============================================================================ -/** @file - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-11 - */ -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_LOKIPHYSMC_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/MCMatch.h b/Phys/LoKiPhysMC/include/LoKi/MCMatch.h deleted file mode 100644 index 3b49a81a4265db00b5e038ec933a28ba95b796e9..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/MCMatch.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 LOKI_MCMATCH_H -# define LOKI_MCMATCH_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// STD & STL -// ============================================================================ -# include <functional> -// ============================================================================ -// GaudiKernel -// ============================================================================ -# include "GaudiKernel/Kernel.h" -// ============================================================================ -// LoKiCore -// ============================================================================ -# include "LoKi/Interface.h" -// ============================================================================ -/** @file - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-11 - */ -// ============================================================================ -namespace LoKi { - // ========================================================================== - class MCMatchObj; - // ========================================================================== - /** @class MCMatch.h LoKi/MCMatch.h - * - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-11 - */ - class GAUDI_API MCMatch : public LoKi::Interface<LoKi::MCMatchObj> { - public: - // ======================================================================== - /// Standard constructor from the object and reporter - MCMatch( const LoKi::MCMatchObj* object ); - /// destructor - virtual ~MCMatch(); // Destructor - /// implicit conversion to the pointer - operator const LoKi::MCMatchObj*() const; - // ======================================================================== - private: - // ======================================================================== - /// the default constructor is disabled - MCMatch(); - // ======================================================================== - }; - // ========================================================================== -} // namespace LoKi -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_MCMATCH_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/MCMatchDicts.h b/Phys/LoKiPhysMC/include/LoKi/MCMatchDicts.h deleted file mode 100644 index 31b7d36fed44fc5c60bdd8adf8b03a58944abd6c..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/MCMatchDicts.h +++ /dev/null @@ -1,57 +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 LOKI_MCMATCHDICTS_H -# define LOKI_MCMATCHDICTS_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// Event -// ============================================================================ -# include "Event/MCParticle.h" -// ============================================================================ -// LoKi -// ============================================================================ -# include "LoKi/Keeper.h" -# include "LoKi/MCMatch.h" -# include "LoKi/MCMatchObj.h" -# include "LoKi/MCTypes.h" -# include "LoKi/UniqueKeeper.h" -// ============================================================================ -namespace LoKi { - namespace Dicts { - /** @namespace LoKi::Dicst::MCMatchDicts MCMatchDicts.h LoKi/MCMatchDicts.h - * @author Ivan BELYAEV ibelyaev@physics.syr.edu - * @date 2007-06-06 - */ - namespace MCMatchDicts { - /// valid object? - bool valid( const LoKi::MCMatch& m ); - /// does this MC particle make contribution to this RC particle? - bool match( const LoKi::MCMatch& m, const LHCb::Particle* p, const LHCb::MCParticle* mc ); - /// do these MC particles make contribution to this RC particle? - bool match( const LoKi::MCMatch& m, const LHCb::Particle* p, const LoKi::Types::MCRange& mc ); - /// do these MC particles make contribution to this RC particle? - bool match( const LoKi::MCMatch& m, const LHCb::Particle* p, const LHCb::MCParticle::Vector& mc ); - /// do these MC particles make contribution to this RC particle? - bool match( const LoKi::MCMatch& m, const LHCb::Particle* p, const LHCb::MCParticle::ConstVector& mc ); - /// do these MC particles make contribution to this RC particle? - bool match( const LoKi::MCMatch& m, const LHCb::Particle* p, const LoKi::Keeper<LHCb::MCParticle>& mc ); - /// do these MC particles make contribution to this RC particle? - bool match( const LoKi::MCMatch& m, const LHCb::Particle* p, const LoKi::UniqueKeeper<LHCb::MCParticle>& mc ); - } // namespace MCMatchDicts - } // namespace Dicts -} // end of namespace LoKi -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_MCMATCHDICTS_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/MCMatchObj.h b/Phys/LoKiPhysMC/include/LoKi/MCMatchObj.h deleted file mode 100644 index dc54a2c185ae3c6df9f8ba334aa39536e2858184..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/MCMatchObj.h +++ /dev/null @@ -1,279 +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 LOKI_MCMATCHOBJ_H -# define LOKI_MCMATCHOBJ_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// STD & STL -// ============================================================================ -# include <functional> -// ============================================================================ -// LoKiCore -// ============================================================================ -# include "LoKi/Base.h" -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -# include "LoKi/PhysMCTypes.h" -// ============================================================================ -/** @file - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-10 - */ -// ============================================================================ -namespace LoKi { - // ========================================================================== - /** @class MCMatchObj LoKi/MCMatchObj.h - * - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-11 - */ - class MCMatchObj : public LoKi::Base { - // ======================================================================== - public: - // ======================================================================== - /** Standard constructor - * @param name object name - * @param reporter error reporter - */ - MCMatchObj( const std::string& name, const LoKi::IReporter* reporter ); - // ======================================================================== - protected: - // ======================================================================== - /// protected and virtual destructor - virtual ~MCMatchObj(); // Destructor - // ======================================================================== - public: - // ======================================================================== - /** check the match of MC truth information (functor interface) - * @param particle pointer to Particle object - * @param mcparticle pointer to MCParticle object - * @return true if the particle and mcparticle has "match" - */ - bool operator()( const LHCb::Particle* particle, const LHCb::MCParticle* mcparticle ) const { - return match( particle, mcparticle ); - } - /** check the match of MC truth information - * @param particle pointer to Particle object - * @param mcparticle pointer to MCParticle object - * @return true if the particle and mcparticle has "match" - */ - bool match( const LHCb::Particle* particle, const LHCb::MCParticle* mcparticle ) const; - /** check the match of MC truth information - * @param first begin iterator for sequence of particles - * @param last end iterator for sequence of particles - * @param mcparticle pointer to MCParticle object - * @return iterator to the first matched particle - */ - template <class PARTICLE> - inline PARTICLE match( PARTICLE first, PARTICLE last, const LHCb::MCParticle* mcparticle ) const; - /** check the match of MC truth information - * @param particle pointer to Particle object - * @param first begin iterator for sequence of MC particles - * @param last end iterator for sequence of MC particles - * @return iterator to the first matched MC particle - */ - template <class MCPARTICLE> - inline MCPARTICLE match( const LHCb::Particle* particle, MCPARTICLE first, MCPARTICLE last ) const; - /** check the match of MC truth information - * @param first begin iterator for sequence of MC particles - * @param last end iterator for sequence of MC particles - * @return true if *ALL* 'particles' are matched - */ - template <class PARTICLE, class MCPARTICLE> - inline bool match( PARTICLE first, PARTICLE last, MCPARTICLE firstMC, MCPARTICLE lastMC ) const; - /** check the match of MC truth information - * @return true if particle matches at least 1 MC particle from range - */ - bool match( const LHCb::Particle* particle, const LoKi::Types::MCRange& range ) const; - // ======================================================================== - public: - // ======================================================================== - void addMatchInfo( const LoKi::Types::TableP2MC* table ) { - if ( 0 != table ) { m_tableP2MC.push_back( table ); } - } - void addMatchInfo( const LoKi::Types::TableP2MCW* table ) { - if ( 0 != table ) { m_tableP2MCW.push_back( table ); } - } - void addMatchInfo( const LoKi::Types::TablePP2MC* table ) { - if ( 0 != table ) { m_tablePP2MC.push_back( table ); } - } - void addMatchInfo( const LoKi::Types::TableT2MC* table ) { - if ( 0 != table ) { m_tableT2MC.push_back( table ); } - } - void addMatchInfo( const LoKi::Types::TableT2MCW* table ) { - if ( 0 != table ) { m_tableT2MCW.push_back( table ); } - } - /// clear the internal storage - void clear(); - // ======================================================================== - bool empty() const { - return m_tableP2MC.empty() && m_tableP2MCW.empty() && m_tablePP2MC.empty() && m_tableT2MC.empty() && - m_tableT2MCW.empty(); - } - // ======================================================================== - protected: - // ======================================================================== - /** look at MC truth information using "direct" relation table - * @param table pointer to relation table - * @param object the object (Particle/ProtoParticle/Track/...) - * @param mcparticle pointer to MCParticle object - */ - template <class TABLE, class OBJECT, class MCPARTICLE> - inline bool matchInTable( const TABLE* table, OBJECT object, MCPARTICLE mcparticle ) const; - /** look at MC truth information using "direct" relation table - */ - template <class TABLE, class OBJECT, class MCPARTICLE> - inline bool matchInTable( TABLE first, TABLE last, OBJECT obj, MCPARTICLE mcp ) const; - /** look at MC truth information using "direct" relation table - * @param tables pointer to relation table - * @param obj the object (Particle/ProtoParticle/Track/...) - * @param mcp pointer to MCParticle object - */ - template <class TABLES, class OBJECT, class MCPARTICLE> - inline bool matchInTables( const TABLES& tables, OBJECT obj, MCPARTICLE mcp ) const; - // ======================================================================== - private: - // ======================================================================== - /// default constructor is disabled (?) - MCMatchObj(); - /// copy constructor is disabled - MCMatchObj( const MCMatchObj& right ); - /// assignement operator is disabled - MCMatchObj& operator=( const MCMatchObj& right ); - // ======================================================================== - private: - // ======================================================================== - typedef std::vector<const LoKi::Types::TableP2MC*> TablesP2MCs; - typedef std::vector<const LoKi::Types::TableP2MCW*> TablesP2MCWs; - typedef std::vector<const LoKi::Types::TablePP2MC*> TablesPP2MCs; - typedef std::vector<const LoKi::Types::TableT2MC*> TablesT2MCs; - typedef std::vector<const LoKi::Types::TableT2MCW*> TablesT2MCWs; - // - TablesP2MCs m_tableP2MC; - TablesP2MCWs m_tableP2MCW; - TablesPP2MCs m_tablePP2MC; - TablesT2MCs m_tableT2MC; - TablesT2MCWs m_tableT2MCW; - // ======================================================================== - }; - // ========================================================================== -} // namespace LoKi -// ============================================================================ -/* check the match of MC truth information - * @param first begin iterator for sequence of particles - * @param last end iterator for sequence of particles - * @param mcparticle pointer to MCParticle object - * @return iterator to the first matched particle - */ -// ============================================================================ -template <class PARTICLE> -inline PARTICLE LoKi::MCMatchObj::match( PARTICLE first, PARTICLE last, const LHCb::MCParticle* mcparticle ) const { - if ( 0 == mcparticle ) { - Error( "match(): MCParticle* points to NULL" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return last; - } // RETURN - for ( ; first != last; ++first ) { - if ( match( *first, mcparticle ) ) { return first; } - } // RETURN - return last; // RETURN -} -// ============================================================================ -/* check the match of MC truth information - * @param particle pointer to Particle object - * @param first begin iterator for sequence of MC particles - * @param last end iterator for sequence of MC particles - * @return iterator to the first matched MC particle - */ -// ============================================================================ -template <class MCPARTICLE> -inline MCPARTICLE LoKi::MCMatchObj::match( const LHCb::Particle* particle, MCPARTICLE first, MCPARTICLE last ) const { - if ( 0 == particle ) { - Error( "match(): Particle* points to NULL" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return last; - } // RETURN - for ( ; first != last; ++first ) { - if ( match( particle, *first ) ) { return first; } - } // RETURN - return last; // RETURN -} -// ============================================================================ -/* check the match of MC truth information - * @param first begin iterator for sequence of MC particles - * @param last end iterator for sequence of MC particles - * @return true if *ALL* 'particles' are matched - */ -// ============================================================================ -template <class PARTICLE, class MCPARTICLE> -inline bool LoKi::MCMatchObj::match( PARTICLE first, PARTICLE last, MCPARTICLE firstMC, MCPARTICLE lastMC ) const { - // agreement - if ( first == last ) { return false; } - // match the first particle - if ( lastMC == match( *first, firstMC, lastMC ) ) { return false; } - // empty sequence ? - if ( ++first == last ) { return true; } - // match the rest - return match( first, last, firstMC, lastMC ); -} -// ============================================================================ -/* look at MC truth information using "direct" relation table - * @param table pointer to relation table - * @param object the object (particle, protoparticle, track, etc..) - * @param mcparticle pointer to MCParticle object - */ -// ============================================================================ -template <class TABLE, class OBJECT, class MCPARTICLE> -inline bool LoKi::MCMatchObj::matchInTable( const TABLE* table, OBJECT object, MCPARTICLE mcparticle ) const { - if ( !table || !object || !mcparticle ) { return false; } // RETURN - const LHCb::MCParticle* mcp = mcparticle; - for ( const auto& entry : table->relations( object ) ) { - if ( mcp == entry.to() ) { return true; } // RETURN - } - return false; // RETURN -} -// ============================================================================ -// look at MC truth information using "direct" relation table -// ============================================================================ -template <class TABLE, class OBJECT, class MCPARTICLE> -inline bool LoKi::MCMatchObj::matchInTable( TABLE first, TABLE last, OBJECT obj, MCPARTICLE mcp ) const { - for ( ; first != last; ++first ) { - if ( matchInTable( *first, obj, mcp ) ) { return true; } - } // RETURN - return false; -} -// ============================================================================ -/* look at MC truth information using "direct" relation table - * @param tables pointer to relation tables - * @param obj the object (Particle/ProtoParticle/Track/...) - * @param mcp pointer to MCParticle object - */ -// ============================================================================ -template <class TABLES, class OBJECT, class MCPARTICLE> -inline bool LoKi::MCMatchObj::matchInTables( const TABLES& tables, OBJECT obj, MCPARTICLE mcp ) const { - return matchInTable( tables.begin(), tables.end(), obj, mcp ); -} -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_MCMATCHOBJ_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/MCMatcher.h b/Phys/LoKiPhysMC/include/LoKi/MCMatcher.h deleted file mode 100644 index e98be62a0fdfaf6242c374d9ba2519c3227bdbcd..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/MCMatcher.h +++ /dev/null @@ -1,438 +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 LOKI_MCMATCHER_H -# define LOKI_MCMATCHER_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// LoKiMC -// ============================================================================ -# include "LoKi/IMCDecay.h" -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -# include "LoKi/MCTruth.h" -// ============================================================================ -// forward declaration -// ============================================================================ -class GaudiAlgorithm; -// ============================================================================ -namespace LoKi { - // ========================================================================== - /// forward declarations - class MCMatch; // forward declarations - // ========================================================================== - namespace PhysMCParticles { - // ======================================================================== - enum ProtoPMatch { - All, // Neutral , Charged + Upstream - Charged, // Charged + Upstream - ChargedLong, // Charged - Neutral - }; - // ======================================================================== - /** @class MCMatcherBase LoKi/MCMatcher.h - * - * The special version of class LoKi::PhysMCParticles::MCTruth - * to be used withing CombineParticles/DecayTree frameworks - * - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @date 2009-08-11 - */ - class MCMatcherBase : public LoKi::PhysMCParticles::MCTruth { - public: - // ====================================================================== - /// the actual type for TES-locations for relation tables - typedef std::vector<std::string> Locations; // TES-locations of tables - // ====================================================================== - typedef Decays::iNode iNode; - // ====================================================================== - public: - // ====================================================================== - /// constructor from the list of TES-locations - MCMatcherBase( Locations locations, std::string thehead = "" ); - /// constructor from the list of TES-location - MCMatcherBase( const std::string& location ) : MCMatcherBase( Locations{location} ) {} - /// constructor from the list of TES-locations - MCMatcherBase( const std::string& location1, const std::string& location2 ) - : MCMatcherBase( Locations{location1, location2} ) {} - /// constructor from the list of TES-locations - MCMatcherBase( const std::string& location1, const std::string& location2, const std::string& location3 ) - : MCMatcherBase( Locations{location1, location2, location3} ) {} - /// constructor from protopartcile matching flag - MCMatcherBase( const ProtoPMatch& protoMatch, std::string thehead = "" ); - /// copy constructor - MCMatcherBase( const MCMatcherBase& right ); - // ====================================================================== - /// virtual destructor - virtual ~MCMatcherBase(); - // ====================================================================== - protected: - // ====================================================================== - /// load the data - StatusCode load() const; // load the data - /// get MC-particles - virtual StatusCode getMCParticles( const LHCb::MCParticle::Container& cnt ) const = 0; - /// clear all storages - void clearAll() const; - /// get all locations - const Locations& locations() const { return m_locations; } - /// get the MC head - const std::string& head() const { return m_head; } - /// get the algorithm - const GaudiAlgorithm* alg() const { return m_alg; } - /// set the algorithm - void setAlg( const GaudiAlgorithm* a ) const { m_alg = a; } - // ====================================================================== - private: - // ====================================================================== - /// the default constructor is disabled - MCMatcherBase(); // the default constructor is disabled - /// the assignement operator is disabled - MCMatcherBase& operator=( const MCMatcherBase& ); - // ====================================================================== - private: - // ====================================================================== - /// TES locations of relation tables - Locations m_locations; // TES locations of relation tables - /// the location of MC-particles in TES - std::string m_head; // the location of MC-particles in TES - /// the algorithm - mutable const GaudiAlgorithm* m_alg = nullptr; // the algorithm - // ====================================================================== - }; - // ======================================================================== - /** @class MCSelMatch - */ - class MCSelMatch : public MCMatcherBase { - public: - // ====================================================================== - /// the actual type of MC-selector - typedef LoKi::Types::MCCuts MCCuts; - // ====================================================================== - public: - // ====================================================================== - /// Default copy constructor - MCSelMatch( const MCSelMatch& ) = default; - /** constructor from MC-selector and TES-locations - * @param selector Monte Carlo selector - * @param locations TES-locations of relation tables - */ - MCSelMatch( const MCCuts& cuts, const Locations& locations, const std::string& thehead = "" ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location TES-location of relation tables - */ - MCSelMatch( const MCCuts& cuts, const std::string& location ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location1 TES-location of relation tables - * @param location2 TES-location of relation tables - */ - MCSelMatch( const MCCuts& cuts, const std::string& location1, const std::string& location2 ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location1 TES-location of relation tables - * @param location2 TES-location of relation tables - * @param location3 TES-location of relation tables - */ - MCSelMatch( const MCCuts& cuts, const std::string& location1, const std::string& location2, - const std::string& location3 ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param protoMatch the key for ProtoParticles match - */ - MCSelMatch( const MCCuts& cuts, const ProtoPMatch& protoMatch = All, const std::string& thehead = "" ); - // ====================================================================== - /// MANDATORY: virtual destrcutor - virtual ~MCSelMatch(); - /// MANDATORY: clone method ("virtual constructor") - MCSelMatch* clone() const override; - /// MANDATORY: the only one essential method - result_type operator()( argument p ) const override; - /// OPTIONAL: nice printout - std::ostream& fillStream( std::ostream& ) const override; - // ====================================================================== - protected: - // ====================================================================== - /// get MC-particles - StatusCode getMCParticles( const LHCb::MCParticle::Container& cnt ) const override; - // ====================================================================== - private: - // ====================================================================== - /// default constructor is disabled - MCSelMatch(); // default constructor is disabled - /// the assignement operator is disabled - MCSelMatch& operator=( const MCSelMatch& ); - // ====================================================================== - private: - // ====================================================================== - /// the actual selector of Monte Carlo particles - LoKi::Types::MCCut m_cuts; // the selector of Monte Carlo particles - // ====================================================================== - }; - // ======================================================================== - class MCTreeMatch : public MCMatcherBase { - public: - // ====================================================================== - // the actual type of decay finder - typedef Decays::IMCDecay::Finder Finder; - // the actual type of decay descriptor - typedef Finder::iTree iTree; - // ====================================================================== - public: - // ====================================================================== - /// Default copy constructor - MCTreeMatch( const MCTreeMatch& ) = default; - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param locations TES-locations of relation tables - */ - MCTreeMatch( const iTree& decay, const Locations& locations, const std::string& thehead = "" ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location TES-location of relation tables - */ - MCTreeMatch( const iTree& decay, const std::string& location ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location1 TES-location of relation tables - * @param location2 TES-location of relation tables - */ - MCTreeMatch( const iTree& decay, const std::string& location1, const std::string& location2 ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location1 TES-location of relation tables - * @param location2 TES-location of relation tables - * @param location3 TES-location of relation tables - */ - MCTreeMatch( const iTree& decay, const std::string& location1, const std::string& location2, - const std::string& location3 ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param protoMatch the key for ProtoParticles match - */ - MCTreeMatch( const iTree& decay, const ProtoPMatch& protoMatch = All, const std::string& thehead = "" ); - // ====================================================================== - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param locations TES-locations of relation tables - */ - MCTreeMatch( const std::string& decay, const Locations& locations, const std::string& thehead = "" ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location TES-location of relation tables - */ - MCTreeMatch( const std::string& decay, const std::string& location ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location1 TES-location of relation tables - * @param location2 TES-location of relation tables - */ - MCTreeMatch( const std::string& decay, const std::string& location1, const std::string& location2 ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param location1 TES-location of relation tables - * @param location2 TES-location of relation tables - * @param location3 TES-location of relation tables - */ - MCTreeMatch( const std::string& decay, const std::string& location1, const std::string& location2, - const std::string& location3 ); - /** constructor from decay descriptor and TES-locations of tables - * @param decay the decay desriptor - * @param protoMatch the key for ProtoParticles match - */ - MCTreeMatch( const std::string& decay, const ProtoPMatch& protoMatch = All, const std::string& thehead = "" ); - // ====================================================================== - /// MANDATORY: virtual destructor - virtual ~MCTreeMatch(); - /// MANDATORY: clone method ("virtual constructor") - MCTreeMatch* clone() const override; - /// - /// MANDATORY: the only one essential method - result_type operator()( argument p ) const override; - /// OPTIONAL: nice printout - std::ostream& fillStream( std::ostream& ) const override; - // ====================================================================== - protected: - // ====================================================================== - /// get MC-particles - StatusCode getMCParticles( const LHCb::MCParticle::Container& cnt ) const override; - // ====================================================================== - /// check the validness of finder - void checkFinder(); - /// get the decay finder - void getFinder( const std::string& decay ); - // ====================================================================== - private: - // ====================================================================== - /// default constructor is disabled - MCTreeMatch(); // default constructor is disabled - /// the assignement operator is disabled - MCTreeMatch& operator=( const MCTreeMatch& ); - // ====================================================================== - private: - // ====================================================================== - /// the actual decay finder - Finder m_finder; // the actual decay finder - // ====================================================================== - }; - // ======================================================================== - class MCNodeMatch : public MCMatcherBase { - public: - // ====================================================================== - // the actual type of decay node - typedef Decays::iNode iNode; - // the actual type of decay node - typedef Decays::Node Node; - // ====================================================================== - public: - // ====================================================================== - /// Default copy constructor - MCNodeMatch( const MCNodeMatch& ) = default; - /// constructor from node descriptor and TES-locations of tables - MCNodeMatch( const iNode& decay, const Locations& locations, const std::string& thehead = "" ); - /// constructor from node descriptor and TES-locations of tables - MCNodeMatch( const iNode& node, const std::string& location ); - /// constructor from node descriptor and TES-locations of tables - MCNodeMatch( const iNode& decay, const std::string& location1, const std::string& location2 ); - /// constructor from node descriptor and TES-locations of tables - MCNodeMatch( const iNode& node, const std::string& location1, const std::string& location2, - const std::string& location3 ); - /// constructor from decay descriptor and TES-locations of tables - MCNodeMatch( const iNode& node, const ProtoPMatch& protoMatch = All, const std::string& thehead = "" ); - // ====================================================================== - /// MANDATORY: virtual destructor - virtual ~MCNodeMatch(); - /// MANDATORY: clone method ("virtual constructor") - MCNodeMatch* clone() const override; - /// - /// MANDATORY: the only one essential method - result_type operator()( argument p ) const override; - /// OPTIONAL: nice printout - std::ostream& fillStream( std::ostream& ) const override; - // ====================================================================== - protected: - // ====================================================================== - /// get MC-particles - StatusCode getMCParticles( const LHCb::MCParticle::Container& cnt ) const override; - // ====================================================================== - /// check the validness of node - void checkNode(); - // ====================================================================== - private: - // ====================================================================== - /// default constructor is disabled - MCNodeMatch(); // default constructor is disabled - /// the assignement operator is disabled - MCNodeMatch& operator=( const MCNodeMatch& ); - // ====================================================================== - private: - // ====================================================================== - /// the actual decay node - Node m_node; // the actual decay node - // ====================================================================== - }; - // ======================================================================== - } // namespace PhysMCParticles - // ========================================================================== - namespace Particles { - // ======================================================================== - /// import the symbol into proper namespace - typedef LoKi::PhysMCParticles::MCSelMatch MCSelMatch; - typedef LoKi::PhysMCParticles::MCTreeMatch MCTreeMatch; - typedef LoKi::PhysMCParticles::MCNodeMatch MCNodeMatch; - // ======================================================================== - } // namespace Particles - // ========================================================================== - namespace Cuts { - // ======================================================================== - /** @typedef MCSELMATCH - * helper symbol (for CombineParticles/FilterDesktop framework) - * to perform MC-truth match - * - * @code - * - * Cut cut = MCSELMATCH ( "pi+" == MCABSID ) ; - * - * @endcode - * - * @see CombineParticles - * @see FilterDesktop - * - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @date 2009-08-12 - */ - typedef LoKi::PhysMCParticles::MCSelMatch MCSELMATCH; - // ======================================================================== - /** @typedef MCTREEMATCH - * helper symbol (for CombineParticles/FilterDesktop framework) - * to perform MC-truth match - * - * @code - * - * Cut cut = MCTREEMATCH ( "B0 -> pi+ pi-") ; - * - * @endcode - * - * @see CombineParticles - * @see FilterDesktop - * - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @date 2009-08-12 - */ - typedef LoKi::PhysMCParticles::MCTreeMatch MCTREEMATCH; - // ======================================================================== - /** @typedef MCNODEMATCH - * helper symbol (for CombineParticles/FilterDesktop framework) - * to perform MC-truth match - * - * @code - * - * Cut cut = MCNODEMATCH ( StableCharged ) ; - * - * @endcode - * - * @see CombineParticles - * @see FilterDesktop - * - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @date 2009-08-12 - */ - typedef LoKi::PhysMCParticles::MCNodeMatch MCNODEMATCH; - // ======================================================================== - /** @typedef MCMATCH - * helper symbol (for CombineParticles/FilterDesktop framework) - * to perform MC-truth match - * - * @code - * - * Cut cut = MCMATCH ( "B0 -> pi+ pi-") ; - * - * @endcode - * - * @see CombineParticles - * @see FilterDesktop - * - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @date 2009-08-12 - */ - typedef LoKi::PhysMCParticles::MCTreeMatch MCMATCH; - // ======================================================================== - } // namespace Cuts - // ========================================================================== -} // end of namespace LoKi -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_MCMATCHER_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/MCTruth.h b/Phys/LoKiPhysMC/include/LoKi/MCTruth.h deleted file mode 100644 index b06e63f8e9eb5f724071b0dfb4ce60fc79914a86..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/MCTruth.h +++ /dev/null @@ -1,237 +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 LOKI_MCTRUTH_H -# define LOKI_MCTRUTH_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// LoKiCore -// ============================================================================ -# include "LoKi/Keeper.h" -// ============================================================================ -// LoKiPhys -// ============================================================================ -# include "LoKi/PhysRangeTypes.h" -# include "LoKi/PhysTypes.h" -// ============================================================================ -// LoKiMC -// ============================================================================ -# include "LoKi/MCTypes.h" -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -# include "LoKi/MCMatch.h" -# include "LoKi/PhysMCTypes.h" -// ============================================================================ -namespace LoKi { - // ========================================================================= - /// forward declarations - class MCMatch; - // ========================================================================== - namespace PhysMCParticles { - // ======================================================================== - /** @class MCTruth PhysMCParticles.h LoKi/PhysMCParticles.h - * - * Helper and useful function to be used to check the matching of - * LHCb::Particle and some LHCb::MCParticle - * - * @code - * - * // some sequence of mc-particle - * SEQUENCE mcps = ... ; - * // get mc-matcher - * MCMatch mc = ... ; - * // create the function - * Cut cut = MCTRUTH( mc , mcps.begin() , mcps.end() ) ; - * - * - * const LHCb::Particle* B = ... ; - * // use the predicate! - * - * const bool good = cut( B ) ; - * - * @endcode - * - * @see LoKi::Cuts::MCTRUTH - * @see LoKi::MCMatchObj - * @see LoKi::MCMatch - * @see LHCb::Particle - * @see LHCb::MCParticle - * - * @author Vanya BELYAEV Ivan.Belyaev@itep.ru - * @date 2003-01-28 - */ - class MCTruth : public LoKi::BasicFunctors<const LHCb::Particle*>::Predicate, - public LoKi::Keeper<LHCb::MCParticle> { - public: - // ====================================================================== - /// the actual type of Keeper - typedef LoKi::Keeper<LHCb::MCParticle> Keeper; - // ====================================================================== - public: - // ====================================================================== - /** constructor - * @param match MCMatch object (working horse) - * @param particle pointer to MC particle object - */ - MCTruth( const LoKi::MCMatch& match, const LHCb::MCParticle* particle ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::MCMatch& match, const LoKi::MCTypes::MCRange& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::MCMatch& match, const LHCb::MCParticle::Vector& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::MCMatch& match, const LHCb::MCParticle::ConstVector& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::MCMatch& match, const LoKi::Keeper<LHCb::MCParticle>& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::MCMatch& match, const LoKi::UniqueKeeper<LHCb::MCParticle>& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param begin begin iterator of any sequence of MC particles - * @param end end iterator of any sequence of MC particles - */ - template <class MCPARTICLE> - MCTruth( const LoKi::MCMatch& match, MCPARTICLE begin, MCPARTICLE end ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( begin, end ) - , m_match( match ) {} - /** constructor - * @param match MCMatch object (working horse) - * @param particle pointer to MC particle object - */ - MCTruth( const LHCb::MCParticle* particle, const LoKi::MCMatch& match ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::MCTypes::MCRange& range, const LoKi::MCMatch& match ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LHCb::MCParticle::Vector& range, const LoKi::MCMatch& match ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LHCb::MCParticle::ConstVector& range, const LoKi::MCMatch& match ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::Keeper<LHCb::MCParticle>& range, const LoKi::MCMatch& match ); - /** constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ - MCTruth( const LoKi::UniqueKeeper<LHCb::MCParticle>& range, const LoKi::MCMatch& match ); - /** constructor - * @param begin begin iterator of any sequence of MC particles - * @param end end iterator of any sequence of MC particles - * @param match MCMatch object (working horse) - */ - template <class MCPARTICLE> - MCTruth( MCPARTICLE begin, MCPARTICLE end, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( begin, end ) - , m_match( match ) {} - /// copy constructor - MCTruth( const MCTruth& right ); - /// MANDATORY: virual destructor - virtual ~MCTruth(); - /// MANDATORY: clone method ("virtual constructor") - MCTruth* clone() const override; - /// MANDATORY: the only one essential method ("function") - result_type operator()( argument p ) const override { return match( p ); } - /// OPTIONAL: the specific printout - std::ostream& fillStream( std::ostream& s ) const override; - // ====================================================================== - public: - // ====================================================================== - /** add additional particle to the - * list of MCParticles to be matched - * @param mcp MC particle - */ - MCTruth& add( const LHCb::MCParticle* mcp ) { - addObject( mcp ); - return *this; - } - /** add additional particles to the - * list of MCParticles to be matched - * @param range new range of MC particles - */ - MCTruth& add( const LoKi::MCTypes::MCRange& range ) { return add( range.begin(), range.end() ); } - /** add few additional particles to the list of - * MCParticles to be matched - * @param first "begin" iterator of sequence - * @param last - */ - template <class MCPARTICLE> - MCTruth& add( MCPARTICLE first, MCPARTICLE last ) { - addObjects( first, last ); - return *this; - } - // ====================================================================== - public: - // ====================================================================== - /// implicit convertion to match object - operator const MCMatch&() const { return match(); } - // ====================================================================== - protected: - // ====================================================================== - /// explicit convertion to match object - const MCMatch& match() const { return m_match; } - // ====================================================================== - bool match( argument p ) const; - // ====================================================================== - /// default constructor is protected - MCTruth(); // default constructor is protected - /// set new mc match object - void setMatch( const LoKi::MCMatch& m ) const; - /// get the keeper - Keeper& storage() const; - // ====================================================================== - private: - // ====================================================================== - // assignement is disabled - MCTruth& operator=( const MCTruth& ); - // ====================================================================== - private: - // ====================================================================== - /// match-object - LoKi::MCMatch m_match; // MC-match-object - // ====================================================================== - }; - // ======================================================================== - } // namespace PhysMCParticles - // ========================================================================== -} // end of namespace LoKi -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_MCTRUTH_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/PhysMCParticleCuts.h b/Phys/LoKiPhysMC/include/LoKi/PhysMCParticleCuts.h deleted file mode 100644 index 865fb639467f57adda93e3f6670dfc27506d874e..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/PhysMCParticleCuts.h +++ /dev/null @@ -1,79 +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 LOKI_PHYSMCPARTICLECUTS_H -# define LOKI_PHYSMCPARTICLECUTS_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -# include "LoKi/PhysMCParticles.h" -// ============================================================================ - -namespace LoKi { - namespace Cuts { - // ======================================================================== - /** @typedef MCTRUTH - * - * Helper and useful function to be used to check the matching of - * LHCb::Particle and some LHCb::MCParticle - * - * @code - * - * // some sequence of mc-particle - * SEQUENCE mcps = ... ; - * // get mc-matcher - * MCMatch mc = ... ; - * // create the function - * Cut cut = MCTRUTH( mc , mcps.begin() , mcps.end() ) ; - * - * - * const LHCb::Particle* B = ... ; - * // use the predicate! - * - * const bool good = cut( B ) ; - * - * @endcode - * - * @see LoKi::MCMatchObj - * @see LoKi::MCMatch - * @see LHCb::Particle - * @see LHCb::MCParticle - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-12 - */ - typedef LoKi::PhysMCParticles::MCTruth MCTRUTH; - // ======================================================================== - /** @typedef RCTRUTH - * - * Helper and useful function to be used to check the matching of - * LHCb::Particle and some LHCb::MCParticle - * - * @see LoKi::MCMatchObj - * @see LoKi::MCMatch - * @see LHCb::Particle - * @see LHCb::MCParticle - * @see LoKi::MCParticles::RCTruth - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-12 - */ - typedef LoKi::PhysMCParticles::RCTruth RCTRUTH; - // ======================================================================== - } // namespace Cuts -} // namespace LoKi -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_PHYSMCPARTICLECUTS_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/PhysMCParticles.h b/Phys/LoKiPhysMC/include/LoKi/PhysMCParticles.h deleted file mode 100644 index 329749789f9b725388716fdb801325e0d57ef0d2..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/PhysMCParticles.h +++ /dev/null @@ -1,212 +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 LOKI_PHYSMCPARTICLES_H -# define LOKI_PHYSMCPARTICLES_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// LokiPhysMC -// ============================================================================ -# include "LoKi/MCTruth.h" -// ============================================================================ -/** @file - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-02-20 - */ -// ============================================================================ -namespace LoKi { - // ========================================================================= - /// forward declarations - class MCMatch; - // ========================================================================== - namespace PhysMCParticles { - // ======================================================================== - /** @class RCTruth PhysMCParticles.h LoKi/PhysMCParticles.h - * - * Helper and useful function to be used to check the matching of - * LHCb::Particle and some LHCb::MCParticle - * - * @see LoKi::MCMatchObj - * @see LoKi::MCMatch - * @see LHCb::Particle - * @see LHCb::MCParticle - * @see LoKi::Cuts::RCTRUTH - * - * @author Vanya BELYAEV Ivan.Belyaev@itep.ru - * @date 2003-01-28 - */ - class RCTruth : public LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate, - public LoKi::Keeper<LHCb::Particle> { - public: - // ====================================================================== - /** constructor - * @param match MCMatch object (working horse) - * @param particle pointer to particle object - */ - RCTruth( const LoKi::MCMatch& match, const LHCb::Particle* particle ); - /** constructor - * @param match MCMatch object (working horse) - * @param range "container" of particles - */ - RCTruth( const LoKi::MCMatch& match, const LoKi::Types::Range& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ - RCTruth( const LoKi::MCMatch& match, const LHCb::Particle::Vector& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ - RCTruth( const LoKi::MCMatch& match, const LHCb::Particle::ConstVector& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ - RCTruth( const LoKi::MCMatch& match, const LoKi::Keeper<LHCb::Particle>& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ - RCTruth( const LoKi::MCMatch& match, const LoKi::UniqueKeeper<LHCb::Particle>& range ); - /** constructor - * @param match MCMatch object (working horse) - * @param begin begin iterator of any sequence of particles - * @param end end iterator of any sequence of particles - */ - template <class PARTICLE> - RCTruth( const LoKi::MCMatch& match, PARTICLE begin, PARTICLE end ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( begin, end ) - , m_match( match ) {} - /** constructor - * @param particle pointer to particle object - * @param match MCMatch object (working horse) - */ - RCTruth( const LHCb::Particle* particle, const LoKi::MCMatch& match ); - /** constructor - * @param range "container" of particles - * @param match MCMatch object (working horse) - */ - RCTruth( const LoKi::Types::Range& range, const LoKi::MCMatch& match ); - /** constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ - RCTruth( const LHCb::Particle::Vector& range, const LoKi::MCMatch& match ); - /** constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ - RCTruth( const LHCb::Particle::ConstVector& range, const LoKi::MCMatch& match ); - /** constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ - RCTruth( const LoKi::Keeper<LHCb::Particle>& range, const LoKi::MCMatch& match ); - /** constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ - RCTruth( const LoKi::UniqueKeeper<LHCb::Particle>& range, const LoKi::MCMatch& match ); - /** constructor - * @param begin begin iterator of any sequence of particles - * @param end end iterator of any sequence of particles - * @param match MCMatch object (working horse) - */ - template <class PARTICLE> - RCTruth( PARTICLE begin, PARTICLE end, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( begin, end ) - , m_match( match ) {} - /// copy constructor - RCTruth( const RCTruth& right ); - /// MANDATORY : virtual destructor destructor - virtual ~RCTruth(); - /// MANDATORY: clone method ("virtual constructor") - RCTruth* clone() const override; - /// MANDATORY: the only one essential method ("function") - result_type operator()( argument ) const override; - /// OPTIONAL: the specific printout - std::ostream& fillStream( std::ostream& s ) const override; - // ====================================================================== - public: - // ====================================================================== - /** add additional particle to the - * list of Particles to be matched - * @param p particle to be added - */ - RCTruth& add( const LHCb::Particle* p ) { - addObject( p ); - return *this; - } - /** add additional particles to the - * list of MCParticles to be matched - * @param range new range of MC particles - */ - RCTruth& add( const LoKi::Types::Range& range ) { return add( range.begin(), range.end() ); } - /** add few additional particles to the list of - * Particles to be matched - * @param first "begin" iterator of sequence - * @param last - */ - template <class PARTICLE> - RCTruth& add( PARTICLE first, PARTICLE last ) { - addObjects( first, last ); - return *this; - } - // ====================================================================== - private: - // ====================================================================== - // default constructor is disabled - RCTruth(); - // assignement is disabled - RCTruth& operator=( const RCTruth& ); - // ====================================================================== - private: - // ====================================================================== - /// MC-match object - LoKi::MCMatch m_match; // MC-match object - // ====================================================================== - }; - // ======================================================================== - namespace Particles { - // ====================================================================== - /// import the type into the proper namespace - typedef LoKi::PhysMCParticles::MCTruth MCTruth; - // ====================================================================== - } // namespace Particles - // ======================================================================== - namespace MCParticles { - // ====================================================================== - /// import the type into proper namespace - typedef LoKi::PhysMCParticles::RCTruth RCTruth; - // ====================================================================== - } // namespace MCParticles - // ======================================================================== - } // namespace PhysMCParticles - // ========================================================================== -} // end of namespace LoKi -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_PHYSMCPARTICLES_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/include/LoKi/PhysMCTypes.h b/Phys/LoKiPhysMC/include/LoKi/PhysMCTypes.h deleted file mode 100644 index ce16d0317c7b608c8aee3c83f8283e1bf83e222b..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/include/LoKi/PhysMCTypes.h +++ /dev/null @@ -1,93 +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 LOKI_PHYSMCTYPES_H -# define LOKI_PHYSMCTYPES_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// Relations -// ============================================================================ -# include "Relations/IRelation.h" -# include "Relations/IRelationWeighted.h" -// ============================================================================ -// Event -// ============================================================================ -# include "Event/MCParticle.h" -# include "Event/Particle.h" -# include "Event/ProtoParticle.h" -# include "Event/Track.h" -// ============================================================================ -// LoKiMC -// ============================================================================ -# include "LoKi/MCTypes.h" -// ============================================================================ -// LoKiPhys -// ============================================================================ -# include "LoKi/PhysTypes.h" -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -# include "Kernel/Particle2MC.h" -# include "Kernel/Track2MC.h" -// ============================================================================ -/** @file - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-02-20 - */ -// ============================================================================ -namespace LoKi { - // ========================================================================== - namespace PhysMCTypes { - // ======================================================================== - /// the actual type of Particle->MCParticle relation - typedef LHCb::P2MC TableP2MC; - /// the actual type of Particle->MCParticle relation with weight - typedef LHCb::P2MCW TableP2MCW; - /// the actual type of ProtoParticle->MCParticle relation with weight - typedef IRelationWeighted<LHCb::ProtoParticle, LHCb::MCParticle, double> TablePP2MC; - /// the actual type of Track->MCParticle relation - typedef IRelation<LHCb::Track, LHCb::MCParticle> TableT2MC; - /// the actual type of Track->MCParticle relation with weight - typedef LHCb::Track2MC TableT2MCW; - // ======================================================================== - } // namespace PhysMCTypes - // ========================================================================== - namespace Types { - // ======================================================================== - /// the actual type of Particle->MCParticle relation - typedef LoKi::PhysMCTypes::TableP2MC TableP2MC; - /// the actual type of Particle->MCParticle relation with weight - typedef LoKi::PhysMCTypes::TableP2MCW TableP2MCW; - /// the actual type of ProtoParticle->MCParticle relation with weight - typedef LoKi::PhysMCTypes::TablePP2MC TablePP2MC; - /// the actual type of Track->MCParticle relations - typedef LoKi::PhysMCTypes::TableT2MC TableT2MC; - /// the actual type of Track->MCParticle relations with weight - typedef LoKi::PhysMCTypes::TableT2MCW TableT2MCW; - // ======================================================================== - } // namespace Types - // ========================================================================== -} // end of namespace LoKi -// ============================================================================ -// The END -// ============================================================================ -#endif // LOKI_PHYSMCTYPES_H -// ============================================================================ diff --git a/Phys/LoKiPhysMC/python/LoKiPhysMC/PV2MC_Configuration.py b/Phys/LoKiPhysMC/python/LoKiPhysMC/PV2MC_Configuration.py deleted file mode 100755 index c9a960bd18255e67f2c32a8ef46404286f6f6733..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/python/LoKiPhysMC/PV2MC_Configuration.py +++ /dev/null @@ -1,57 +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. # -############################################################################### -## @file -# The configuration file to run PV --> MC & PV --> GenCollision stuff 'on-demand' -# -# This file is a part of LoKi project - -# "C++ ToolKit for Smart and Friendly Physics Analysis" -# -# The package has been designed with the kind help from -# Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, -# contributions and advices from G.Raven, J.van Tilburg, -# A.Golutvin, P.Koppenburg have been used in the design. -# -# @see Kernel/PV2MC.h -# @see LoKi::PV2MCAlg -# @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl -# @date 2008-11-04 -# ============================================================================= -""" -The configuration file to run PV --> MC & PV --> GenCollision stuff 'on-demand' - -This file is a part of LoKi project - -\"C++ ToolKit for Smart and Friendly Physics Analysis\" - -The package has been designed with the kind help from -Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, -contributions and advices from G.Raven, J.van Tilburg, -A.Golutvin, P.Koppenburg have been used in the design. -""" -# ============================================================================= -__author__ = " Vanya BELYAEV Ivan.Belyaev@nikhef.nl " -# ============================================================================= - -from Gaudi.Configuration import * -from Configurables import DataOnDemandSvc -from Configurables import LoKi__PV2MCAlg - -alg = LoKi__PV2MCAlg() - -dod = DataOnDemandSvc() -dod.AlgMap['Relations/Rec/Vertex/Primary'] = alg.getFullName() -dod.AlgMap['Relations/Rec/Vertex/Primary2Collision'] = alg.getFullName() - -#needed for the proper work: -import LoKiPhysMC.Track2MC_Configuration - -# ============================================================================= -# The END -# ============================================================================= diff --git a/Phys/LoKiPhysMC/python/LoKiPhysMC/Track2MC_Configuration.py b/Phys/LoKiPhysMC/python/LoKiPhysMC/Track2MC_Configuration.py deleted file mode 100755 index 0885add7b9c340e8a64fef14c1503de32e190281..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/python/LoKiPhysMC/Track2MC_Configuration.py +++ /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. # -############################################################################### -## @file -# The configuration file to run Track --> MC 'on-demand' -# -# This file is a part of LoKi project - -# "C++ ToolKit for Smart and Friendly Physics Analysis" -# -# The package has been designed with the kind help from -# Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, -# contributions and advices from G.Raven, J.van Tilburg, -# A.Golutvin, P.Koppenburg have been used in the design. -# -# @see Kernel/Track2MC.h -# @see LoKi::Track2MC -# @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl -# @date 2008-11-04 -# ============================================================================= -""" -# The configuration file to run Track --> MC 'on-demand' - -This file is a part of LoKi project - -\"C++ ToolKit for Smart and Friendly Physics Analysis\" - -The package has been designed with the kind help from -Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, -contributions and advices from G.Raven, J.van Tilburg, -A.Golutvin, P.Koppenburg have been used in the design. -""" -# ============================================================================= -__author__ = " Vanya BELYAEV Ivan.Belyaev@nikhef.nl " -# ============================================================================= - -from Gaudi.Configuration import * -from Configurables import DataOnDemandSvc -from Configurables import LoKi__Track2MC - -alg = LoKi__Track2MC() - -dod = DataOnDemandSvc() -dod.AlgMap['Relations/Rec/Track/Default'] = alg.getFullName() - -# ============================================================================= -# The END -# ============================================================================= diff --git a/Phys/LoKiPhysMC/python/LoKiPhysMC/__init__.py b/Phys/LoKiPhysMC/python/LoKiPhysMC/__init__.py deleted file mode 100755 index 7e6cd57f61942e023bb6fa5e5b7a9007dbd0c61c..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/python/LoKiPhysMC/__init__.py +++ /dev/null @@ -1,25 +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. # -############################################################################### -# ============================================================================= -## @file LoKiPhysMC/__init__.py -# Helper file to manage LoKiPhysMC package -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-05-29 -# ============================================================================= -""" Helper file to manage LoKiPhysMC package """ -_author_ = "Vanya BELYAEV ibelyaev@physics.syr.edu" -# ============================================================================= -# import LoKiPhys.decorators -# import LoKiMC.decorators -# import LoKiGenMC.decorators -# ============================================================================= -# The END -# ============================================================================= diff --git a/Phys/LoKiPhysMC/python/LoKiPhysMC/decorators.py b/Phys/LoKiPhysMC/python/LoKiPhysMC/decorators.py deleted file mode 100755 index 441c65e8437f659dad7a3fc996234567109656da..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/python/LoKiPhysMC/decorators.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -############################################################################### -# (c) Copyright 2000-2020 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. # -############################################################################### -# ============================================================================= -## @file decorators.py LoKiPhysMC/decorators.py -# The set of basic decorator for objects from LoKiPhysMC library -# The file is a part of LoKi and Bender projects -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# ============================================================================= -""" -The set of basic decorators for obejcts from LoKiPhysMC library -""" -# ============================================================================= -from __future__ import print_function -__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu" -# ============================================================================= - -from LoKiPhysMC.functions import * - - -# ============================================================================= -## decorate MCMatch object: -def _valid_(s): - """ - Check the validity of MCMatch-object - - >>> matcher = ... - >>> if matcher.valid() : ... - - """ - return LoKi.Dicts.MCMatchDicts.valid(s) - - -# ============================================================================= -## update the documentation -_valid_.__doc__ += LoKi.Dicts.MCMatchDicts.valid.__doc__ - - -# ============================================================================= -## decorate MCMatch object: -def _not_valid_(s): - """ - Check the validity of the MCMatch object - - >>> matcher = ... - >>> if not matcher : ... - - """ - return not s.valid() - - -# ============================================================================= -## decorate MCMatch object: -def _match_(s, particle, mcobject): - """ - Check MC-matching - - >>> matcher=... - >>> particle = ... - >>> mcobject = .. - >>> matcher.match(particle,mcobject) - - """ - return LoKi.Dicts.MCMatchDicts.match(s, particle, mcobject) - - -# ============================================================================= -## update the documentation -_match_.__doc__ += LoKi.Dicts.MCMatchDicts.match.__doc__ -# ============================================================================= -LoKi.MCMatch.valid = _valid_ -LoKi.MCMatch.match = _match_ -LoKi.MCMatch.__invert__ = _not_valid_ - -_name = __name__ -# ============================================================================= -from LoKiPhys.decorators import _decorate as _decorate1 -from LoKiMC.decorators import _decorate as _decorate2 - - -## Make the decoration of functions and predicates -def _decorate(name=_name): - """ - Make the decoration of functions and predicates - """ - import LoKiMC.decorators as _LMC - import LoKiPhys.decorators as _LRC - import LoKiCore.decorators as _L - _decorated = _decorate1(name) - _decorated |= _decorate2(name) - - ## (re) decorate pids (Comparison with strings, integers and ParticleID objects: - for t in (_LMC.MCID, _LMC.MCABSID, _LRC.ID, _LRC.ABSID): - t = type(t) - _L.decoratePID(t, LoKi.Dicts.PIDOps(t)) - _decorated.add(t) - - ## - return _decorated ## RETURN - - -# ============================================================================= - -# ============================================================================= -## Perform the actual decoration -_decorated = _decorate(_name) -# ============================================================================= - -# ============================================================================= -if '__main__' == __name__: - print('Number of properly decorated types: %s' % len(_decorated)) - for o in _decorated: - print(o) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/Phys/LoKiPhysMC/python/LoKiPhysMC/functions.py b/Phys/LoKiPhysMC/python/LoKiPhysMC/functions.py deleted file mode 100755 index a7158ffc1efd256be8d7988611b4d054517efeb5..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/python/LoKiPhysMC/functions.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python -############################################################################### -# (c) Copyright 2000-2020 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. # -############################################################################### -# ============================================================================= -## @file decorators.py LoKiPhysMC/decorators.py -# The set of basic decorator for objects from LoKiPhysMC library -# The file is a part of LoKi and Bender projects -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# ============================================================================= -""" -The set of basic decorators for obejcts from LoKiPhysMC library -""" -# ============================================================================= -from __future__ import print_function -__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu" -# ============================================================================= - -from LoKiCore.decorators import LoKi -from LoKiCore.decorators import LHCb - -MCTRUTH = LoKi.PhysMCParticles.MCTruth -RCTRUTH = LoKi.PhysMCParticles.RCTruth - -MCSELMATCH = LoKi.PhysMCParticles.MCSelMatch -MCTREEMATCH = LoKi.PhysMCParticles.MCTreeMatch -MCNODEMATCH = LoKi.PhysMCParticles.MCNodeMatch - -MCMATCH = MCTREEMATCH - - -# ============================================================================= -def _mcMatch(func, obj, *args): - """ - Helper function to create functor for Monte Carlo truth match - - """ - from LoKiCore.functions import strings - - if not args: return func(obj) - - _args = [] - for a in args: - if isinstance(a, (tuple, list)): _args.append(strings(a)) - else: _args.append(a) - - _args = tuple(_args) - - return func(obj, *_args) - - -# ============================================================================= -def mcMatch(obj, *args): - """ - Helper function to define MC-truth matchig functor - - - >>> cut1 = mcMatch ( 'B0->pi+ pi-' ) - - - >>> cut2 = mcMatch ( 'B0-> ^pi+ ^pi-' ) - - - >>> cut3 = mcMatch ( 'pi+' == MCABSID ) - - - >>> cut4 = mcMatch ( Nodes.StableCharged ) - - - ATTENTION: It is only for - CombineParticles/FilterDesktop/DecaytreeTuple framework - - """ - from PartProp.Nodes import iNode - from LoKiMC.decorators import iMCTree - from LoKiMC.decorators import MCCuts - # - if issubclass(obj.__class__, str): - return _mcMatch(MCTREEMATCH, obj, *args) - elif issubclass(obj.__class__, iNode): - return _mcMatch(MCNODEMATCH, obj, *args) - elif issubclass(obj.__class__, MCCuts): - return _mcMatch(MCSELMATCH, obj, *args) - elif issubclass(obj.__class__, iMCTree): - return _mcMatch(MCTREEMATCH, obj, *args) - - raise AttributeError('Unknown object type %s' % type(obj)) - - -# ============================================================================= -if '__main__' == __name__: - for o in dir(): - print(o) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/Phys/LoKiPhysMC/python/LoKiPhysMC/tests.py b/Phys/LoKiPhysMC/python/LoKiPhysMC/tests.py deleted file mode 100755 index 1d3c5287482114660b902f612adc40a12bc54ebe..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/python/LoKiPhysMC/tests.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -############################################################################### -# (c) Copyright 2000-2020 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. # -############################################################################### -# ============================================================================= -## @file LoKiPhysMC/tests.py -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-05-29 -# ============================================================================= -""" The basic tests for LoKiGenMC package """ -from __future__ import print_function -_author_ = "Vanya BELYAEV ibelyaev@physics.syr.edu" - - -# ============================================================================= -## The most trivial test function -def test(): - """ The most trivial test function """ - from LoKiPhysMC.decorators import _decorated - print('LoKiPhysMCTest: decorated objects %s' % len(_decorated)) - pass - - -# ============================================================================= -## Perform all known tests -def testAll(): - """ Perform all known tests """ - test() - - -# ============================================================================= -if '__main__' == __name__: - testAll() - # ============================================================================= - - # ============================================================================= - # The END - # ============================================================================= diff --git a/Phys/LoKiPhysMC/src/Components/LoKi_Track2MC.cpp b/Phys/LoKiPhysMC/src/Components/LoKi_Track2MC.cpp deleted file mode 100644 index ce8d673b96d257c9e7f01787055c5e4c1e4359c9..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/LoKi_Track2MC.cpp +++ /dev/null @@ -1,141 +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 "GaudiAlg/GaudiAlgorithm.h" - -#include "Event/MCParticle.h" -#include "Event/Track.h" - -#include "Relations/IRelationWeighted.h" -#include "Relations/IRelationWeighted2D.h" -#include "Relations/RelationWeighted.h" -#include "Relations/RelationWeighted2D.h" - -#include "Kernel/Track2MC.h" - -#include "Linker/LinkedTo.h" - -/** @file - * - * Simple algorithm for conversion of Track->MC links from - * "linker" form into usable form of relation table - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-08-17 - */ -namespace LoKi { - /** @class Track2MC - * - * Simple algorithm for conversion of Track->MC links from - * "linker" form into usable form of relation table - * - * Many thanks to Edwin Bos for kind help! - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-08-17 - */ - class Track2MC : public GaudiAlgorithm { - public: - /// execution of the algorithm - StatusCode execute() override; - /// standard constructor - Track2MC( const std::string& name, ISvcLocator* pSvc ) - : GaudiAlgorithm( name, pSvc ), m_tracks(), m_output( LHCb::Track2MCLocation::Default ) { - m_tracks.push_back( LHCb::TrackLocation::Default ); - m_tracks.push_back( LHCb::TrackLocation::Velo ); - - declareProperty( "Tracks", m_tracks, "The list of TES locations of Track->MC contariners/linkers" ); - declareProperty( "Output", m_output, "The TES locations of Track->MC realtiontable (LHcb::Track2MC)" ); - } - - private: - typedef std::vector<std::string> Addresses; - /// addresses for the tracks - Addresses m_tracks; // addresses for the tracks - /// the address of the output table - std::string m_output; // the address of the output table - - mutable Gaudi::Accumulators::StatCounter<size_t> m_linksCounter{this, "#links"}; - mutable Gaudi::Accumulators::StatCounter<size_t> m_tracksCounter{this, "#tracks"}; - }; -} // end of namespace LoKi - -#define INHERITS( T1, T2 ) \ - ( Relations::IsConvertible<const T1*, const T2*>::value && !Relations::IsConvertible<const T1*, const void*>::same ) - -// ============================================================================ -// execution of the algorithm -// ============================================================================ -StatusCode LoKi::Track2MC::execute() { - // avoid long names - typedef LHCb::RelationWeighted2D<LHCb::Track, LHCb::MCParticle, double> Table; - // check the inheritance scheme - BOOST_STATIC_ASSERT( INHERITS( Table, LHCb::Track2MC2D ) ); - - // create the new relation table and register it in TES - Table* table = new Table( 100 ); - put( table, m_output ); - - // for statistics - size_t nTracks = 0; - // loop over all input track containers - for ( Addresses::const_iterator iaddr = m_tracks.begin(); m_tracks.end() != iaddr; ++iaddr ) { - if ( !exist<LHCb::Tracks>( *iaddr ) ) { - Warning( " No tracks at location '" + ( *iaddr ) + "' are found!" ).ignore(); - continue; - } - const LHCb::Tracks* tracks = get<LHCb::Tracks>( *iaddr ); - if ( 0 == tracks ) { continue; } // CONTINUE - nTracks += tracks->size(); // Retrieve the Linker table made by the TrackAssociator - LinkedTo<LHCb::MCParticle, LHCb::Track> linker( evtSvc(), msgSvc(), *iaddr ); - if ( linker.notFound() ) { - Warning( "The linker table '" + ( *iaddr ) + "' is not found!" ).ignore(); - continue; // CONTINUE - } - // loop over the tracks: - for ( LHCb::Tracks::const_iterator itrack = tracks->begin(); tracks->end() != itrack; ++itrack ) { - const LHCb::Track* track = *itrack; - if ( 0 == track ) { continue; } // CONTINUE - // get the links form linker object - const LHCb::MCParticle* mcp = linker.first( track ); - while ( 0 != mcp ) { - table->i_push( track, mcp, linker.weight() ); // NB! i_push is used! - mcp = linker.next(); - } - // - } // end of the loop over tracks in the container - } // end of loop over containers - - /// MANDATORY usage of i_sort after i_push - table->i_sort(); // ATTENTION! - - // check for some "strange" status - if ( table->i_relations().empty() ) { Warning( "Empty relation table!" ).ignore(); } - - // a bit of statistics - if ( msgLevel( MSG::DEBUG ) ) { - m_tracksCounter += nTracks; - m_linksCounter += table->i_relations().size(); - } - // - return StatusCode::SUCCESS; -} - -// Declaration of the Algorithm Factory -DECLARE_COMPONENT( LoKi::Track2MC ) diff --git a/Phys/LoKiPhysMC/src/Components/MCTruthPhoton.cpp b/Phys/LoKiPhysMC/src/Components/MCTruthPhoton.cpp deleted file mode 100644 index 816e27e0a7334767eabcc850e5edfaebed702b12..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/MCTruthPhoton.cpp +++ /dev/null @@ -1,278 +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 "GaudiKernel/SystemOfUnits.h" - -#include "GaudiAlg/GaudiAlgorithm.h" - -#include "Event/CaloCluster.h" -#include "Event/CaloHypo.h" -#include "Event/MCParticle.h" -#include "Event/MCVertex.h" -#include "Event/ProtoParticle.h" - -#include "Relations/RelationWeighted1D.h" - -#include "LoKi/BasicFunctors.h" -#include "LoKi/IMCHybridFactory.h" -#include "LoKi/MCParticleCuts.h" -#include "LoKi/MCTypes.h" - -namespace LoKi { - - /** @class MCTruthPhoton - * Dedicated algorithm to create - * the relation table ProtoPatricle --> MCParticle - * for photons using the custom criteria - * @author Vanya BELYAEV Ivan.Belyaev@itep.ru - * @date 2017-02-06 - */ - class MCTruthPhoton : public GaudiAlgorithm { - public: - /// standard algorithm - MCTruthPhoton( const std::string& name, ISvcLocator* pSvc ) - : GaudiAlgorithm( name, pSvc ) - /// input neutral protoparticles - , m_input( LHCb::ProtoParticleLocation::Neutrals ) - // default name of output relation table - , m_output( "Relations/Rec/ProtoP/" + name ) - // maximal accepted chi2 (very loose...) - , m_chi2( 4.0 ) // maximal accepted chi2 (very loose) - /// interval for Emc/Erec - , m_eRatio( 0.2, 2 ) // interval for Emc/Erec - // the preambulo - , m_preambulo() - // the factory - , m_factory( "LoKi::Hybrid::MCTool/MCFACTORY" ) - // - , m_mccut_str( "MCALL" ) - , m_mccut( LoKi::BasicFunctors<const LHCb::MCParticle*>::BooleanConstant( true ) ) { - declareProperty( "Input", m_input, - "Input locations of neutral protoparticles: '" + - std::string( LHCb::ProtoParticleLocation::Neutrals ) + "'" ); - declareProperty( "Output", m_output, "Output location of PP->MCP relation table: 'Relations/Rec/ProtoP/<NAME>'" ); - declareProperty( "MaxChi2", m_chi2, "Maximal accepted chi2-distance" ); - declareProperty( "EnergyFraction", m_eRatio, "Interval for Emc/Erec" ); - declareProperty( "Factory", m_factory, "Type/Name for C++/Python Hybrid Factory" ) - ->declareUpdateHandler( &LoKi::MCTruthPhoton::propHandler, this ); - // the preambulo - declareProperty( "Preambulo", m_preambulo, "The preambulo to be used for Bender/Python script" ) - ->declareUpdateHandler( &LoKi::MCTruthPhoton::propHandler, this ); - declareProperty( "Code", m_mccut_str, "Code to select ``good''photons" ) - ->declareUpdateHandler( &LoKi::MCTruthPhoton::propHandler, this ); - } - - MCTruthPhoton() = delete; - MCTruthPhoton( const MCTruthPhoton& ) = delete; - - public: - StatusCode initialize() override; - StatusCode execute() override; - - /// the update handler - void propHandler( Gaudi::Details::PropertyBase& /* p */ ) { - if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) { return; } - StatusCode sc = initVar(); - Assert( sc.isSuccess(), "Unable to set 'Code'", sc ); - } - /// initialize variables - StatusCode initVar(); - - private: - inline std::pair<double, double> xy_pos( const LHCb::MCParticle* mcp, const double z ) const { - if ( nullptr == mcp ) { return std::make_pair( -1 * Gaudi::Units::km, -1 * Gaudi::Units::km ); } - static const Gaudi::XYZPoint s_null{0, 0, 0}; - const LHCb::MCVertex* mcv = mcp->originVertex(); - const Gaudi::XYZPoint& p0 = ( nullptr == mcv ) ? s_null : mcv->position(); - const Gaudi::LorentzVector& vct = mcp->momentum(); - // trivial linear extrapolation: - const double x = p0.x() + vct.Px() * ( z - p0.z() ) / vct.Pz(); - const double y = p0.y() + vct.Py() * ( z - p0.z() ) / vct.Pz(); - return std::make_pair( x, y ); - } - - inline double match( const LHCb::MCParticle* mcp, const LHCb::CaloPosition* pos, const double delta = 0 ) { - if ( nullptr == mcp || nullptr == pos ) { return false; } - double mcx, mcy; - std::tie( mcx, mcy ) = xy_pos( mcp, pos->z() ); - const Gaudi::Vector2 v2( mcx, mcy ); - Gaudi::SymMatrix2x2 icov2{pos->spread()}; - if ( 0 < delta ) { - const double d2 = delta * delta; - icov2( 0, 0 ) += d2; - icov2( 1, 1 ) += d2; - } - // use Manuel's inverter: - const bool ok = icov2.InvertChol(); - if ( !ok ) { - Warning( "Can't invert ``spread''-matrix" ).ignore(); - return false; - } - // - // const double xp = pos->parameters()[0] ; - // const double yp = pos->parameters()[1] ; - // return ROOT::Math::Similarity ( v2 - Gaudi::Vector2( xp , yp ) , icov2 ) ; - // - return ROOT::Math::Similarity( v2 - pos->center(), icov2 ); - } - - /// input neutral protoparticles - std::string m_input; - /// the output TES location of relation table - std::string m_output; - /// maximal accepted chi2-distance - double m_chi2; // maximal accepted chi2-distance - /// accepted interval for Emc/Erec - std::pair<double, double> m_eRatio; // accepted interval for Emc/Erec - /// preambulo - std::vector<std::string> m_preambulo; // preambulo - /// the factory - std::string m_factory; // the factory - /// criteria for MC photon selection - std::string m_mccut_str; // criteria for MC photon selection - LoKi::Types::MCCut m_mccut; - - mutable Gaudi::Accumulators::StatCounter<size_t> m_goodMCCounter{this, "#good-MC"}; - mutable Gaudi::Accumulators::BinomialCounter<> m_goodMCFoundCounter{this, "#good-MC-found"}; - mutable Gaudi::Accumulators::StatCounter<size_t> m_linksCounter{this, "#links"}; - }; -} // namespace LoKi - -StatusCode LoKi::MCTruthPhoton::initialize() { - StatusCode sc = GaudiAlgorithm::initialize(); - if ( sc.isFailure() ) { return sc; } - return initVar(); -} - -namespace { - /// construct the preambulo string - inline std::string _preambulo_( const std::vector<std::string>& lines ) { - std::string result; - for ( std::vector<std::string>::const_iterator iline = lines.begin(); lines.end() != iline; ++iline ) { - if ( lines.begin() != iline ) { result += "\n"; } - result += ( *iline ); - } - return result; - } -} // end of anonymous namespace - -StatusCode LoKi::MCTruthPhoton::initVar() { - // locate the factory - IMCHybridFactory* factory = tool<IMCHybridFactory>( m_factory, this ); - // - StatusCode sc = factory->get( m_mccut_str, m_mccut, _preambulo_( m_preambulo ) ); - if ( sc.isFailure() ) { return Error( "Unable to decode: \"" + m_mccut_str + "\"", sc ); } - // - // add some "protection" - m_mccut = LoKi::Cuts::MCVALID && ( LoKi::Cuts::MCID == "gamma" ) && m_mccut; - // - release( factory ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - // - if ( 0 >= m_chi2 ) { return Error( "Invalid chi2 cut is specified!" ); } - if ( m_eRatio.first < m_eRatio.second && ( 1 < m_eRatio.first || 1 > m_eRatio.second ) ) { - return Error( "Weird setting of ``EnergyFraction''" ); - } - // - return StatusCode::SUCCESS; -} - -StatusCode LoKi::MCTruthPhoton::execute() { - // ProtoParticle -> MCParticle relations (MC output) - typedef LHCb::RelationWeighted1D<LHCb::ProtoParticle, LHCb::MCParticle, double> Table; - - // create the output relation table and put it into TES - Table* table = new Table( 20 ); - put( table, m_output ); - - // 1) get neutral protoparticles - const LHCb::ProtoParticle::Container* pps = get<LHCb::ProtoParticle::Container>( m_input ); - if ( nullptr == pps || pps->empty() ) { - return Warning( "Empty input container of ProtoParticles", StatusCode::SUCCESS ); - } - - // 2) select good MC-photons - LHCb::MCParticle::ConstVector mcgood; - mcgood.reserve( 20 ); - // get input MC-particles - const LHCb::MCParticle::Container* mcall = get<LHCb::MCParticle::Container>( LHCb::MCParticleLocation::Default ); - - std::copy_if( mcall->begin(), mcall->end(), std::back_inserter( mcgood ), std::cref( m_mccut ) ); - - std::stable_sort( mcgood.begin(), mcgood.end() ); - LHCb::MCParticle::ConstVector::iterator idup = std::unique( mcgood.begin(), mcgood.end() ); - mcgood.erase( idup, mcgood.end() ); - - m_goodMCCounter += mcgood.size(); - m_goodMCFoundCounter += !mcgood.empty(); - - if ( mcgood.empty() ) { return Warning( "No good MC-photons are found", StatusCode::SUCCESS ); } - - for ( const LHCb::ProtoParticle* pp : *pps ) { - // 1) skip invalid or charged - if ( nullptr == pp || nullptr != pp->track() ) { continue; } // CONTINUE - - // 2) find proper CaloHypo object - const LHCb::CaloHypo* hypo = nullptr; - const SmartRefVector<LHCb::CaloHypo>& hypos = pp->calo(); - for ( const LHCb::CaloHypo* h : hypos ) { - if ( 0 != h && LHCb::CaloHypo::Photon == h->hypothesis() ) { - hypo = h; - break; - } - } - if ( nullptr == hypo ) { continue; } - - // 3) get CaloPosition for the hypos - const LHCb::CaloPosition* pos = hypo->position(); - // 3') make a try to get CaloPosition from the first CaloCluster - if ( nullptr == pos ) { - // get the position from cluster - const SmartRefVector<LHCb::CaloCluster>& clusters = hypo->clusters(); - if ( clusters.empty() ) { continue; } // CONTINUE - const LHCb::CaloCluster* cluster = clusters.front(); - if ( nullptr == cluster ) { continue; } // CONTNINUE - pos = &( cluster->position() ); - } - - // 4) make a loop over selected MC-photons - for ( const LHCb::MCParticle* mcp : mcgood ) { - // 5) skip nulls - if ( nullptr == mcp ) { continue; } // skip NULLs - - // 6) (fast) check Emc/Ecalo ratio (if specified) - if ( m_eRatio.first < m_eRatio.second ) { - const double eR = mcp->momentum().E() / pos->e(); - if ( eR < m_eRatio.first || eR > m_eRatio.second ) { continue; } - } - - // 7) perform chi2-match - const double chi2 = match( mcp, pos, 1 * Gaudi::Units::cm ); - - // 8) check chi2-matching quality - if ( m_chi2 < chi2 ) { continue; } - - // 9) add the entry into the relation table using fast "i_push" - table->i_push( pp, mcp, pos->e() / mcp->momentum().E() ); - - } // End of the loop over MC particles - } // End of the loop over protoparticles - - /// 10) sort relation table - table->i_sort(); // IMPORTANT: sort relation table! - - /// some statistics - m_linksCounter += table->relations().size(); - - return StatusCode::SUCCESS; // RETURN -} - -/// Declaration of the Factory -DECLARE_COMPONENT( LoKi::MCTruthPhoton ) diff --git a/Phys/LoKiPhysMC/src/Components/P2MC.cpp b/Phys/LoKiPhysMC/src/Components/P2MC.cpp deleted file mode 100644 index 95f5933f8e773c352c4983129efc1ea59421661f..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/P2MC.cpp +++ /dev/null @@ -1,104 +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 -// =========================================================================== -// Relations -// =========================================================================== -#include "Relations/Relation2D.h" -// =========================================================================== -// DaVinciMCKernel -// =========================================================================== -#include "Kernel/Particle2MC.h" -// =========================================================================== -// Local -// =========================================================================== -#include "P2MCBase.h" -// =========================================================================== -/** @file - * - * Simple algorithm for conversion of Particle->MC links from - * "linker" form into usable form of relation table - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-08-17 - */ -// ============================================================================ -namespace LoKi { - /** @class P2MC - * - * Simple algorithm for conversion of Particle->MC links from - * "linker" form into usable form of relation table - * - * Many thanks to Edwin Bos for kind help! - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-08-17 - */ - class P2MC : public LoKi::P2MCBase { - public: - // ======================================================================== - /// execution of the algorithm - StatusCode execute() override { - // avoid long names - typedef LHCb::Relation2D<LHCb::Particle, LHCb::MCParticle> Table; - // check the inheritance scheme - BOOST_STATIC_ASSERT( INHERITS( Table, LHCb::P2MC2D ) ); - // create the new relation table and register it in TES - Table* table = new Table( 100 ); - put( table, m_output ); - // copy all links from the linker to the table - return fillTable( table ); - } - // ======================================================================== - /// initialize the algorithm - StatusCode initialize() override { - StatusCode sc = LoKi::P2MCBase::initialize(); - if ( sc.isFailure() ) { return sc; } - // check the method - switch ( m_method ) { - case Particle2MCMethod::Chi2: - break; // BREAK - case Particle2MCMethod::Links: - break; // BREAK - case Particle2MCMethod::Composite: - break; // BREAK - case Particle2MCMethod::WithChi2: - Warning( "Weighted method is selected", sc ).ignore(); - break; - default: - return Error( "Invalid method is choosen!" ); // RETURN - } - return StatusCode::SUCCESS; // RETURN - } - /// standard constructor - P2MC( const std::string& name, ISvcLocator* pSvc ) : LoKi::P2MCBase( name, pSvc ) { - m_method = Particle2MCMethod::Chi2; - }; - // ======================================================================== - }; - // ========================================================================== -} // namespace LoKi -// ============================================================================ -/// Declaration of the Algorithm Factory -// ============================================================================ -DECLARE_COMPONENT( LoKi::P2MC ) -// ============================================================================ -/// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/Components/P2MCBase.cpp b/Phys/LoKiPhysMC/src/Components/P2MCBase.cpp deleted file mode 100644 index 46a149c0095e25dbe1c4b159c9a9dbab1084759d..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/P2MCBase.cpp +++ /dev/null @@ -1,95 +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 "P2MCBase.h" - -/** @file - * - * Implementation file for class LoKi::P2MCBase - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - */ -// ============================================================================ -// standard constructor -// ============================================================================ -LoKi::P2MCBase::P2MCBase( const std::string& name, ISvcLocator* pSvc ) - : GaudiAlgorithm( name, pSvc ), m_inputs(), m_method( Particle2MCMethod::No ), m_output(), m_linker( 0 ) { - declareProperty( "Inputs", m_inputs ); - declareProperty( "Method", m_method ); - declareProperty( "Output", m_output ); - // declare handlers - m_inputs.declareUpdateHandler( &LoKi::P2MCBase::inputsHandler, this ); - m_method.declareUpdateHandler( &LoKi::P2MCBase::methodHandler, this ); -} -// ============================================================================ -// virtual protected destructors -// ============================================================================ -LoKi::P2MCBase::~P2MCBase() {} -// ============================================================================ -// initialize the algorithm -// ============================================================================ -StatusCode LoKi::P2MCBase::initialize() { - // inittialize the base - StatusCode sc = GaudiAlgorithm::initialize(); - if ( sc.isFailure() ) { return sc; } // RETURN - // check the inputs - if ( m_inputs.value().empty() ) { Warning( "Empty list of inputs!" ).ignore(); } - /// delete linker - if ( 0 != m_linker ) { - delete m_linker; - m_linker = 0; - } - return StatusCode::SUCCESS; // RETURN -} -// ============================================================================ -// finalize the algorithm -// ============================================================================ -StatusCode LoKi::P2MCBase::finalize() { - // delete linker if needed - if ( 0 != m_linker ) { - delete m_linker; - m_linker = 0; - } - // finalize the base class - return GaudiAlgorithm::finalize(); -} -// ============================================================================ -// handler for inputs -// ============================================================================ -void LoKi::P2MCBase::inputsHandler( Gaudi::Details::PropertyBase& /* p */ ) { - if ( 0 == m_linker ) { return; } // NO ACTION - // linker exists (and probably initialized already) - warning() << "Linker must be reinitialized for " << m_inputs << endmsg; - if ( 0 != m_linker ) { - delete m_linker; - m_linker = 0; - } -} -// ============================================================================ -// handler for method -// ============================================================================ -void LoKi::P2MCBase::methodHandler( Gaudi::Details::PropertyBase& /* p */ ) { - if ( 0 == m_linker ) { return; } // NO ACTION - // linker exists (and probably initialized already) - warning() << "Linker must be reinitialized for " << m_method << endmsg; - if ( 0 != m_linker ) { - delete m_linker; - m_linker = 0; - } -} diff --git a/Phys/LoKiPhysMC/src/Components/P2MCBase.h b/Phys/LoKiPhysMC/src/Components/P2MCBase.h deleted file mode 100644 index ca0d4c77ac636bc6a32e315cfd8613024d640819..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/P2MCBase.h +++ /dev/null @@ -1,191 +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/GaudiAlgorithm.h" - -#include "Event/MCParticle.h" -#include "Event/Particle.h" - -#include "Relations/IRelationWeightedBase.h" -#include "Relations/IsConvertible.h" - -#include "Kernel/Particle2MCLinker.h" -#include "Kernel/Particle2MCMethod.h" - -namespace LoKi { - - /** @class P2MCBase - * - * Helper base class for decoding of Linkers into Relation Tables - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2007-02-24 - */ - class P2MCBase : public GaudiAlgorithm { - public: - // the linker from Orsay - typedef Object2MCLinker<LHCb::Particle> MCLinker; - - /// initialize the algorithm - StatusCode initialize() override; - /// finalize the algorithm - StatusCode finalize() override; - - protected: - /// standard constructor - P2MCBase( const std::string& name, ISvcLocator* pSvc ); - /// virtual destructor - virtual ~P2MCBase(); - - public: - // handler for inputs - void inputsHandler( Gaudi::Details::PropertyBase& ); ///< handler for inputs - // handler for method - void methodHandler( Gaudi::Details::PropertyBase& ); ///< handler for method - - private: - // default constructor is disabled - P2MCBase(); - // copy constructor is disabled - P2MCBase( const P2MCBase& ); - // assignement operator is disabled - P2MCBase& operator=( const P2MCBase& ); - - mutable Gaudi::Accumulators::StatCounter<size_t> m_particlesCounter{this, "#particles"}; - mutable Gaudi::Accumulators::StatCounter<size_t> m_linksCounter{this, "#links"}; - - protected: - /// copy links from linker to relation table - template <class TABLE> - inline StatusCode fillTable( TABLE* table ); - - typedef std::vector<std::string> Addresses; - // list of inputs - SimpleProperty<Addresses> m_inputs; ///< list of inputs - // the method - IntegerProperty m_method; ///< the method - // output table - std::string m_output; ///< output Relation table - // linker object - MCLinker* m_linker; ///< linker object - }; -} // end of namespace LoKi - -#define INHERITS( T1, T2 ) \ - ( Relations::IsConvertible<const T1*, const T2*>::value && !Relations::IsConvertible<const T1*, const void*>::same ) - -// ============================================================================ -// anonymous namespace to hide some implementation detailes -// ============================================================================ -namespace { - /// just the forward decalrations - template <class TABLE, bool> - struct _iGet; - - /** @struct _iGet - * The helper structure to copy the information from linker - * @author Vanya BELYAEV Ivan.BElyaev@nikhef.nl - */ - template <class TABLE, bool> - struct _iGet { - void copy( LoKi::P2MCBase::MCLinker* linker, const LHCb::Particle* particle, TABLE* table ) const { - if ( 0 == linker || 0 == table ) { return; } - double weight = 0.0; - const LHCb::MCParticle* mc = linker->first( particle, weight ); - while ( 0 != mc ) { - table->i_push( particle, mc, weight ); - mc = linker->next( weight ); - } - } - }; - - /// dispatch for non-weighted relations - template <class TABLE> - struct _iGet<TABLE, false> { - void copy( LoKi::P2MCBase::MCLinker* linker, const LHCb::Particle* particle, TABLE* table ) const { - if ( 0 == linker || 0 == table ) { return; } - const LHCb::MCParticle* mc = linker->first( particle ); - while ( 0 != mc ) { - table->i_push( particle, mc ); - mc = linker->next(); - } - } - }; - - /** @struct iGet - * The actual helper structure to copy the information from linker - * @author Vanya BELYAEV Ivan.BElyaev@nikhef.nl - */ - template <class TABLE> - struct iGet : public _iGet<TABLE, INHERITS( TABLE, IRelationWeightedBase )> {}; -} // end of anonymous namespace - -// ============================================================================ -/// copy links from linker to relation table -// ============================================================================ -template <class TABLE> -inline StatusCode LoKi::P2MCBase::fillTable( TABLE* table ) { - Assert( 0 != table, "Invalid Relation Table" ); - // create linker if needed - if ( 0 == m_linker ) { m_linker = new MCLinker( this, m_method, m_inputs ); } - // just for convinience - const StatusCode OK = StatusCode::SUCCESS; - // Helper object to copy links - iGet<TABLE> getter; - // for statistics - size_t nParticles = 0; - // loop over input linkers - const Addresses& addresses = m_inputs; - for ( Addresses::const_iterator iaddr = addresses.begin(); addresses.end() != iaddr; ++iaddr ) { - const std::string loc = ( *iaddr ) + "/Particles"; - // - LHCb::Particle::Range range; - if ( exist<LHCb::Particle::Range>( loc ) ) { - range = get<LHCb::Particle::Range>( loc ); - } else if ( exist<LHCb::Particle::Range>( *iaddr ) ) { - range = get<LHCb::Particle::Range>( *iaddr ); - } else { - Error( "No valid LHCb::Particle::Range found for '" + ( *iaddr ) + "'", OK ).ignore(); - continue; // CONTINUE - } - // for statistics - nParticles += range.size(); - // loop over all particles - for ( LHCb::Particle::Range::iterator ipart = range.begin(); range.end() != ipart; ++ipart ) { - const LHCb::Particle* p = *ipart; - if ( 0 == p ) { continue; } // CONTINUE - // copy the links - getter.copy( m_linker, p, table ); // ATTENTION i_push - } // end f the loop over particles in the container - // - } // end of the loop over input containers - - // MANDATORY call of i_sort after i_push! - table->i_sort(); // MANDATORY i_sort - // simple check - if ( table->i_relations().empty() ) { Warning( "Empty relation table!" ).ignore(); } - // a bit of statistics - if ( msgLevel( MSG::DEBUG ) ) { - m_particlesCounter += nParticles; - m_linksCounter += table->i_relations().size(); - } - - return StatusCode::SUCCESS; -} diff --git a/Phys/LoKiPhysMC/src/Components/P2MCW.cpp b/Phys/LoKiPhysMC/src/Components/P2MCW.cpp deleted file mode 100644 index 5863e30ded81e901f7039cef5ce88dbbac08037e..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/P2MCW.cpp +++ /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. * -\*****************************************************************************/ -// ============================================================================ -// Include files -// =========================================================================== -// Relations -// =========================================================================== -#include "Relations/RelationWeighted2D.h" -// =========================================================================== -// DaVinciMCKernel -// =========================================================================== -#include "Kernel/Particle2MC.h" -// =========================================================================== -// LoKi -// =========================================================================== -#include "P2MCBase.h" -// =========================================================================== -/** @file - * - * Simple algorithm for conversion of Particle->MC links from - * "linker" form into usable form of relation table with weight - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-08-17 - */ -// ============================================================================ -namespace LoKi { - /** @class P2MCW - * - * Simple algorithm for conversion of Particle->MC links from - * "linker" form into usable form of relation table with weight - * - * Many thanks to Edwin Bos for kind help! - * - * @todo replace 'include Particle2MCLinker' with - * 'include Particle2MCmethod' from new package DaVinciMCTools - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-08-17 - */ - class P2MCW : public LoKi::P2MCBase { - public: - // ======================================================================== - /// execution of the algorithm - StatusCode execute() override { - // avoid long names - typedef LHCb::RelationWeighted2D<LHCb::Particle, LHCb::MCParticle, double> Table; - // check the inheritance scheme - BOOST_STATIC_ASSERT( INHERITS( Table, LHCb::P2MC2DW ) ); - // create the new relation table and register it in TES - Table* table = new Table( 100 ); - put( table, m_output ); - // copy all links from the linker to the table - return fillTable( table ); - } - /// initialize the algorithm - StatusCode initialize() override { - // inittialize the base - StatusCode sc = LoKi::P2MCBase::initialize(); - if ( sc.isFailure() ) { return sc; } - // check the method - switch ( m_method ) { - case Particle2MCMethod::WithChi2: - break; - case Particle2MCMethod::Chi2: - case Particle2MCMethod::Links: - case Particle2MCMethod::Composite: - Warning( "Unweighted method is selected!", sc ).ignore(); - break; - default: - return Error( "Invalid method is choosen!" ); - } - // - return StatusCode::SUCCESS; // RETURN - } - /// standard constructor - P2MCW( const std::string& name, ISvcLocator* pSvc ) : LoKi::P2MCBase( name, pSvc ) { - m_method = Particle2MCMethod::WithChi2; - } - // ======================================================================== - }; - // ========================================================================== -} // end of namespace LoKi -// ============================================================================ -/// Declaration of the Algorithm Factory -// ============================================================================ -DECLARE_COMPONENT( LoKi::P2MCW ) -// ============================================================================ -/// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/Components/PV2MC.cpp b/Phys/LoKiPhysMC/src/Components/PV2MC.cpp deleted file mode 100644 index 47e2cfda70321e037ff13ddf64f0d0003aad9e5e..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/PV2MC.cpp +++ /dev/null @@ -1,461 +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 <algorithm> -#include <functional> -#include <utility> - -#include "GaudiKernel/IIncidentListener.h" -#include "GaudiKernel/IIncidentSvc.h" - -#include "GaudiAlg/GaudiTool.h" - -#include "Relations/IRelation.h" -#include "Relations/IRelationWeighted.h" -#include "Relations/IRelationWeighted2D.h" -#include "Relations/Relation2Weighted.h" - -#include "Event/GenCollision.h" -#include "Event/MCVertex.h" -#include "Event/RecVertex.h" - -#include "Kernel/IMC2Collision.h" -#include "Kernel/IPV2MC.h" -#include "Kernel/MC2Collision.h" -#include "Kernel/PV2MC.h" -#include "Kernel/Track2MC.h" - -#include "LoKi/Geometry.h" -#include "LoKi/ILoKiSvc.h" -#include "LoKi/Inherits.h" -#include "LoKi/MCVertexCuts.h" -#include "LoKi/PhysTypes.h" -#include "LoKi/Vertices1.h" - -#include "boost/static_assert.hpp" - -/** @file - * - * Implementation file for class LoKi::PV2MC - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-19 - */ -namespace LoKi { - - /** @class PV2MC - * - * helper tool to access LHCb::RecVertex <---> LHCb::MCVertex and - * LHCb::RecVertex <--> LHCb::GenCollision relations - * - * @see IPV2MC - * @see LHCb::RecVertex - * @see LHCb::GenCollision - * @see LHCb::MCVertex - * @see LHCb::PV2MC - * @see LoKi_PV2MCAlg - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-18 - */ - class PV2MC : public virtual IPV2MC, public virtual IIncidentListener, public GaudiTool { - public: - /** return a relation table for - * LHCb::RecVertex ---> LHCb::MCVertex relations - * - * @code - * - * typedef IPV2MC::PV2MC Table ; - * typedef Table::Range Range ; - * - * // tool itself - * const IPV2MC* tool = ... ; - * // get a table form the tool - * const Table* table = tool->pv2MC() ; - * // primary vertex: - * const LHCb::RecVertex* prim = ... ; - * // get all related MC-vertices - * Range links = table->relations( prim ) ; - * // make a loop over all links: - * for ( Range::iterator ilink = links.begin() ; - * links.end() != ilink ; ++ilink ) - * { - * // (primary) MC-vertex: - * const LHCb::MCVertex* mc = ilink->to() ; - * // number of true MC track from the given primary MC: - * const int nTrack = ilink->weight().first ; - * // chi2 of th editance in between MC and RC vertex: - * const double chi2 = ilink->weight().second ; - * } - * - * @endcode - * - * @see LHCb::PV2MC - * @see LHCb::RecVertex - * @see LHCb::MCVertex - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-19 - */ - const IPV2MC::PV2MC* pv2MC() const override { - // the table is valid , get it! - if ( valid1() ) { return m_table1.direct(); } - // build & validate - StatusCode sc = build1(); - // the final checks - Assert( sc.isSuccess(), "Unable to build the table_1", sc ); - Assert( valid1(), "The table_1 is invalid!" ); - // - return m_table1.direct(); - } - - /** return a relation table for - * (primary)LHCb::MCVertex --> LHCb::RecVertex relations - * - * @see LHCb::MC2PV - * @see LHCb::RecVertex - * @see LHCb::MCVertex - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-19 - */ - const IPV2MC::MC2PV* mc2PV() const override { - // the table is valid , get it! - if ( valid1() ) { return m_table1.inverse(); } - // build & validate - StatusCode sc = build1(); - // the final checks - Assert( sc.isSuccess(), "Unable to build the table_1", sc ); - Assert( valid1(), "The table_1 is invalid!" ); - // - return m_table1.inverse(); - } - - /** return a relation table for - * LHCb::RecVertex ---> LHCb::GenCollision relations - * - * @code - * - * typedef IPV2MC::PV2Collision Table ; - * typedef Table::Range Range ; - * - * // tool itself - * const IPV2MC* tool = ... ; - * // get a table form the tool - * const Table* table = tool->pv2Collision() ; - * // primary vertex: - * const LHCb::RecVertex* prim = ... ; - * // get all related pp-Collisions - * Range links = table->relations( prim ) ; - * // make a loop over all links: - * for ( Range::iterator ilink = links.begin() ; - * links.end() != ilink ; ++ilink ) - * { - * // pp-Collision - * const LHCb::GenCollision* collision = ilink->to() ; - * // number of true MC track from the given primary MC: - * const int nTrack = ilink->weight().first ; - * // chi2 of the distance in between MC and RC vertex: - * const double chi2 = ilink->weight().second ; - * } - * - * @endcode - * - * @see LHCb::PV2Collision - * @see LHCb::RecVertex - * @see LHCb::GenCollision - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-19 - */ - const IPV2MC::PV2Collision* pv2Collision() const override { - // the table is valid , get it! - if ( valid2() ) { m_table2.direct(); } - // build & validate - StatusCode sc = build2(); - // the final checks - Assert( sc.isSuccess(), "Unable to build the table_2", sc ); - Assert( valid2(), "The table_2 is invalid!" ); - // - return m_table2.direct(); - } - - /** return a relation table for - * LHCb::GenCollision --> LHCb::RecVertex relations - * - * @see LHCb::Collision2PV - * @see LHCb::RecVertex - * @see LHCb::GenCollision - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-19 - */ - const IPV2MC::Collision2PV* collision2PV() const override { - // the table is valid , get it! - if ( valid2() ) { return m_table2.inverse(); } - // build & validate - StatusCode sc = build1(); - // the final checks - Assert( sc.isSuccess(), "Unable to build the table_2", sc ); - Assert( valid2(), "The table_2 is invalid!" ); - // - return m_table2.inverse(); - } - - /// standard initialization of the tool - StatusCode initialize() override { - StatusCode sc = GaudiTool::initialize(); - if ( sc.isFailure() ) { return sc; } - - IIncidentSvc* isvc = incSvc(); - Assert( isvc, "IIncidentSvc* points to NULL" ); - isvc->addListener( this, IncidentType::BeginEvent, 10 ); - - // load LoKi service - svc<LoKi::ILoKiSvc>( "LoKiSvc" ); - - return StatusCode::SUCCESS; - } - /// handle new incident : invalidate the tables - void handle( const Incident& ) override { - m_valid1 = false; - m_table1.clear().ignore(); - m_valid2 = false; - m_table2.clear().ignore(); - } - /** standart constructor - * @param type tool type - * @param name tool name - * @param parent parent object - */ - PV2MC( const std::string& type, const std::string& name, const IInterface* parent ) - : GaudiTool( type, name, parent ) - /// - , m_primaries( LHCb::RecVertexLocation::Primary ) - , m_vertices( LHCb::MCVertexLocation::Default ) - , m_track2MC( LHCb::Track2MCLocation::Default ) - , m_mc2colName( "LoKi::MC2GenCollision/MC2GenCollision" ) - // - , m_mc2col( (IMC2Collision*)0 ) - /// - , m_table1() - , m_table2() - , m_valid1( false ) - , m_valid2( false ) { - declareInterface<IIncidentListener>( this ); - declareInterface<IPV2MC>( this ); - - declareProperty( "Primaries", m_primaries, "The TES location of Primary Vertices (LHCb::RecVertex)" ); - declareProperty( "MCVertices", m_vertices, "The TES location of Monte Carlo Vertices (LHCb::MCVertex)" ); - declareProperty( "Track2MC", m_track2MC, "The TES location of Track->MC table (LHCb::Track2MC)" ); - declareProperty( "MC2Collision", m_mc2colName, "Type/nemae of IMC2Collision tool" ); - } - - protected: - /// build the first table - StatusCode build1() const; - /// build the second table - StatusCode build2() const; - /// get the validity flag for the first table - bool valid1() const { return m_valid1; } - /// get the validity flag for the second table - bool valid2() const { return m_valid2; } - - private: - /// the location of the primary vertices - std::string m_primaries; // the location of the primary vertices - /// the location of the Monte-Carlo vertices - std::string m_vertices; // the location of Monte Carlo vertices - /// location of track -> MC relation table - std::string m_track2MC; // location of track -> MC relation table - - /// the type/name of tool for MCVertex <---> GenCollision relations - std::string m_mc2colName; // the tool for MCVertex <---> GenCollision - /// the tool for MC Vertex <---> GenCollision links - mutable LoKi::Interface<IMC2Collision> m_mc2col; - - // the actual inte - typedef Relations::Relation2Weighted<LHCb::RecVertex, LHCb::MCVertex, LHCb::Relations_::PV2MCWeight> Table1; - typedef Relations::Relation2Weighted<LHCb::RecVertex, LHCb::GenCollision, LHCb::Relations_::PV2MCWeight> Table2; - /// check the types - BOOST_STATIC_ASSERT( INHERITS( Table1, LHCb::PV2MC2D ) ); - BOOST_STATIC_ASSERT( INHERITS( Table2, LHCb::PV2Collision2D ) ); - - /// the actual relation table - mutable Table1 m_table1; // the actual relation table - /// the actual relation table - mutable Table2 m_table2; // the actual relation table - /// the validity flag - mutable bool m_valid1; // the validity flag - /// the validity flag - mutable bool m_valid2; // the validity flag - - mutable Gaudi::Accumulators::StatCounter<size_t> m_pv2MCVertexCounter{this, "#PV->MCVertex"}; - mutable Gaudi::Accumulators::StatCounter<size_t> m_pv2genCollisionCounter{this, "#PV->GenCollision"}; - mutable Gaudi::Accumulators::BinomialCounter<> m_ghostEffCounter{this, "ghost eff"}; - }; -} // end of namespace LoKi - -// ============================================================================ -// build the first table -// ============================================================================ -StatusCode LoKi::PV2MC::build1() const { - // invalidate the tables - m_valid1 = false; - m_table1.clear().ignore(); - m_valid2 = false; - m_table2.clear().ignore(); - - using namespace LoKi::Types; - using namespace LoKi::Cuts; - - // type of container for primary MC-vertices - typedef std::vector<const LHCb::MCVertex*> PRIMARIES; - - // get the primary vertices from TES - const LHCb::RecVertices* primaries = get<LHCb::RecVertices>( m_primaries ); - if ( !primaries ) { return StatusCode::FAILURE; } // RETURN - - // get MC-vertices from TES - const LHCb::MCVertices* vertices = get<LHCb::MCVertices>( m_vertices ); - if ( !vertices ) { return StatusCode::FAILURE; } // RETURN - - // the actual table for track-> relations - const LHCb::Track2MC* track2MC = get<LHCb::Track2MC>( m_track2MC ); - if ( !track2MC ) { return StatusCode::FAILURE; } // RETURN - - // from all MC-vertices select only the primaries - PRIMARIES prims0; - std::copy_if( vertices->begin(), vertices->end(), std::back_inserter( prims0 ), std::cref( MCPRIMARY ) ); - if ( prims0.empty() ) { - Warning( " Empty container of primary MC-vertices! " ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - } - - typedef std::map<const LHCb::MCVertex*, size_t> MAP; - typedef const SmartRefVector<LHCb::Track> TRACKS; - - auto ghostEffCounterBuf = m_ghostEffCounter.buffer(); - const bool countGhosts = msgLevel( MSG::DEBUG ); - - // double loop - for ( auto ipv = primaries->begin(); primaries->end() != ipv; ++ipv ) { - const LHCb::RecVertex* pv = *ipv; - if ( !pv ) { continue; } // CONTINUE - MAP _map; - const TRACKS& trs = pv->tracks(); - for ( auto itr = trs.begin(); trs.end() != itr; ++itr ) { - const LHCb::Track* track = *itr; - if ( !track ) { continue; } // CONTINUE - // get MC-truth for the given track - LHCb::Track2MC::Range r = track2MC->relations( track ); - // count ghosts - if ( countGhosts ) { ghostEffCounterBuf += !r.empty(); } - // ghost ? - if ( r.empty() ) { continue; } // CONTINUE - const LHCb::MCParticle* mcp = r.front().to(); - if ( !mcp ) { continue; } // CONTINUE - // get the primary vertex!!! - const LHCb::MCVertex* mcpv = mcp->primaryVertex(); - if ( !mcpv ) { continue; } // CONTINUE - // fill the temporary map (count number of tracks from MC-vertices) - _map[mcpv] += 1; - } - - for ( auto imc = prims0.begin(); prims0.end() != imc; ++imc ) { - const LHCb::MCVertex* mc = *imc; - if ( !mc ) { continue; } // CONTINUE - - // chi2 distance from the given point - VFun vd = LoKi::Vertices::VertexChi2Distance( mc->position() ); - - // find the chi2 of distance - const double chi2 = vd( pv ); - auto ic = _map.find( mc ); - const size_t nTrack = _map.end() == ic ? 0 : _map[mc]; - - LHCb::PV2MCWeight weight( nTrack, -chi2 ); - - // Fill the relation table LHCb::RecVertes <--> LHCb::MCParticle - m_table1.i_relate( pv, mc, weight ).ignore(); - - } // end of loop over Monte Carlo primary vertices - } // end of loop over reconstructed primary vertices - // - // DECORATION: make a statistics - if ( msgLevel( MSG::DEBUG ) ) { m_pv2MCVertexCounter += m_table1.relations().size(); } - // - // ATTENTION!! - m_valid1 = true; // ATTENTION!! - // - return StatusCode::SUCCESS; -} -// ============================================================================ -// build the second table -// ============================================================================ -StatusCode LoKi::PV2MC::build2() const { - // invalidate the second table: - m_valid2 = false; - m_table2.clear().ignore(); - // check the first table: - if ( !valid1() ) { - StatusCode sc = build1(); - if ( sc.isFailure() ) { return Error( "build2: error from build1", sc ); } - } - // - if ( !valid1() ) { return Error( "build2: the first table is invalid!" ); } - // locate the tool (if needed) - if ( !m_mc2col ) { m_mc2col = tool<IMC2Collision>( m_mc2colName, this ); } - // - // get the relation table form the tool - typedef IMC2Collision::MCVertex2Collision MC2C; - // - const MC2C* mc2col = m_mc2col->vertex2collision(); - // - if ( !mc2col ) { return Error( "IMC2Collision::MCVertex2Collision* points to NULL!" ); } - // - // make the loop over the first table - Table1::Range r1 = m_table1.relations(); - for ( auto it = r1.begin(); r1.end() != it; ++it ) { - const LHCb::RecVertex* rv = it->from(); - if ( !rv ) { continue; } // CONTINUE - const LHCb::MCVertex* mc = it->to(); - if ( !mc ) { continue; } // CONTINUE - // get the collision for MC-vertex - MC2C::Range r = mc2col->relations( mc ); - if ( r.empty() ) { - Warning( "Empty MCVertex->GenCollision range" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - continue; - } // CONTINUE - if ( 1 != r.size() ) { Warning( " No 1<-->1 link " ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); } - const LHCb::GenCollision* gc = r.front().to(); - if ( !gc ) { continue; } // CONTINUE - // fill the relation - m_table2.i_relate( rv, gc, it->weight() ).ignore(); - } - // - if ( m_table1.relations().size() != m_table2.relations().size() ) { - Warning( "mismatchion table1/table2 size!" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - } - // - // make a statistics - if ( msgLevel( MSG::DEBUG ) ) { m_pv2genCollisionCounter += m_table2.relations().size(); } - // - // ATTENTION!! - m_valid2 = true; // ATTENTION!! - // - return StatusCode::SUCCESS; -} - -DECLARE_COMPONENT( LoKi::PV2MC ) diff --git a/Phys/LoKiPhysMC/src/Components/PV2MCAlg.cpp b/Phys/LoKiPhysMC/src/Components/PV2MCAlg.cpp deleted file mode 100644 index 3478cb8ba05d9e90e516b27af15f359d2fc97bb8..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/Components/PV2MCAlg.cpp +++ /dev/null @@ -1,185 +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 <utility> - -#include "GaudiAlg/GaudiAlgorithm.h" - -#include "Relations/IRelation.h" -#include "Relations/RelationWeighted1D.h" -#include "Relations/RelationWeighted2D.h" - -#include "Event/MCVertex.h" -#include "Event/RecVertex.h" - -#include "Kernel/IMC2Collision.h" -#include "Kernel/IPV2MC.h" -#include "Kernel/MC2Collision.h" -#include "Kernel/PV2MC.h" -#include "Kernel/Track2MC.h" - -#include "LoKi/ILoKiSvc.h" -#include "LoKi/Inherits.h" - -#include "boost/static_assert.hpp" - -/** @file - * - * Implementation file for class LoKi::PV2MCAlg - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-19 - */ -namespace LoKi { - - /** @class PV2MCAlg - * - * helper algorthm to build LHCb::PrimVertex <---> LHCb::MCVertex relations - * - * It associates the LHCb::PrimVertex "vP" to (primary)LHCb::MCVertex - * with the weight, which is a pair of - * - number of true MC tracks from the given collision - * used in the reconstruction of primary vertex - * - chi2 of the distance in between recontricted and MC vertices - * - * @see LHCb::MCVertex - * @see LHCb::PrimVertex - * @see LHCb::PV2MC - * - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - * @date 2005-07-13 - */ - class PV2MCAlg : public GaudiAlgorithm { - public: - /// initialization of the algorithm - StatusCode initialize() override { - StatusCode sc = GaudiAlgorithm::initialize(); - if ( sc.isFailure() ) { return sc; } - // load LoKi service - svc<LoKi::ILoKiSvc>( "LoKiSvc" ); - // - // get the tool - m_pv2mc = tool<IPV2MC>( m_pv2mcName, this ); - /// private tool? - if ( this != m_pv2mc->parent() ) { return Error( "The tool must be private tool!" ); } - /// set the properties of the private tool - sc = Gaudi::Utils::setProperty( m_pv2mc, "Primaries", m_primaries ); - if ( sc.isFailure() ) { return Error( "Unable to (re)set property 'Primaries' ", sc ); } - /// set the properties of the private tool - sc = Gaudi::Utils::setProperty( m_pv2mc, "MCVertices", m_vertices ); - if ( sc.isFailure() ) { return Error( "Unable to (re)set property 'MCVertices' ", sc ); } - /// set the properties of the private tool - sc = Gaudi::Utils::setProperty( m_pv2mc, "Track2MC", m_track2MC ); - if ( sc.isFailure() ) { return Error( "Unable to (re)set property 'Track2MC' ", sc ); } - /// set the properties of the private tool - sc = Gaudi::Utils::setProperty( m_pv2mc, "MC2Collision", m_mc2collision ); - if ( sc.isFailure() ) { return Error( "Unable to (re)set property 'MC2Collision'", sc ); } - // - return StatusCode::SUCCESS; - } - /// execution of the algorithm - StatusCode execute() override; - /**standard constructor - * @param name algorithm instance name - * @param pSvc pointer to Service Locator - */ - PV2MCAlg( const std::string& name, ISvcLocator* pSvc ) - : GaudiAlgorithm( name, pSvc ) - , m_primaries( LHCb::RecVertexLocation::Primary ) - , m_vertices( LHCb::MCVertexLocation::Default ) - , m_track2MC( LHCb::Track2MCLocation::Default ) - , m_mc2collision( "LoKi::MC2GenCollision/MC2GenCollision" ) - , m_pv2mcName( "LoKi::PV2MC/PV2MC" ) - , m_pv2mc( 0 ) - , m_output1( LHCb::PV2MCLocation::Default ) - , m_output2( LHCb::PV2CollisionLocation::Default ) { - declareProperty( "Primaries", m_primaries, "The TES location of Primary Vertices (LHCb::RecVertex)" ); - declareProperty( "MCVertices", m_vertices, "The TES location of Monte Carlo Vertices (LHCb::MCVertex)" ); - declareProperty( "Track2MC", m_track2MC, "The TES location of Track->MC table (LHCb::Track2MC)" ); - declareProperty( "MC2Collision", m_mc2collision, "Type/nemae of IMC2Collision tool" ); - declareProperty( "PV2MC", m_pv2mcName, "The type/name of IPVMC tool " ); - declareProperty( "OutputPV2MC", m_output1, "The TES location of (output) RecVertex->MCVertex table " ); - declareProperty( "OutputPV2Collision", m_output2, "The TES location of (output) RecVertex->GenCollision table " ); - } - - private: - /// TES address of primary vertices - std::string m_primaries; // TES address of primary vertices - /// TES address of MC vertices - std::string m_vertices; // TES address of MC vertices - /// TES address of MC->Collision links - std::string m_collision; // TES address of MC->Collision links - /// TES address of Track->MC links - std::string m_track2MC; // TES address of Track->MC links - /// name of MCVertex->GenCollision tool - std::string m_mc2collision; // name of MCVeretx->GenCollision tool - - /// name of PV->MC tool - std::string m_pv2mcName; // name of PV->MC tool - /// the tool itself - IPV2MC* m_pv2mc; // the tool itself - - /// TES location of output relation table - std::string m_output1; // TES location of output relation table - /// TES location of output relation table - std::string m_output2; // TES location of output relation table - - mutable Gaudi::Accumulators::StatCounter<size_t> m_pv2MCCounter{this, "#PV->MC"}; - mutable Gaudi::Accumulators::StatCounter<size_t> m_pv2genCollisionCounter{this, "#PV->GenCollision"}; - }; -} // end of namespace LoKi - -namespace { - /// the actual type of relation table in TES - typedef LHCb::RelationWeighted2D<LHCb::RecVertex, LHCb::MCVertex, LHCb::PV2MCWeight> Table1; - /// the actual type of relation table in TES - typedef LHCb::RelationWeighted2D<LHCb::RecVertex, LHCb::GenCollision, LHCb::PV2MCWeight> Table2; - - /// check the types - BOOST_STATIC_ASSERT( INHERITS( Table1, LHCb::PV2MC2D ) ); - BOOST_STATIC_ASSERT( INHERITS( Table2, LHCb::PV2Collision2D ) ); -} // namespace - -// ============================================================================ -// execution of the algorithm -// ============================================================================ -StatusCode LoKi::PV2MCAlg::execute() { - // get the tool - Assert( 0 != m_pv2mc, "IPV2MC* points to NULL!" ); - - const IPV2MC::PV2MC* t1 = m_pv2mc->pv2MC(); - Assert( 0 != t1, "IPV2MC::PV2MC* pooint to NULL" ); - Table1* table1 = new Table1( *t1 ); - put( table1, m_output1 ); - - const IPV2MC::PV2Collision* t2 = m_pv2mc->pv2Collision(); - Assert( 0 != t2, "IPV2MC::PV2Collision* pooint to NULL" ); - Table2* table2 = new Table2( *t2 ); - put( table2, m_output2 ); - - // make a statistics - if ( msgLevel( MSG::DEBUG ) ) { - m_pv2MCCounter += table1->relations().size(); - m_pv2genCollisionCounter += table2->relations().size(); - } - - return StatusCode::SUCCESS; -} - -DECLARE_COMPONENT( LoKi::PV2MCAlg ) diff --git a/Phys/LoKiPhysMC/src/LoKiPhysMC.cpp b/Phys/LoKiPhysMC/src/LoKiPhysMC.cpp deleted file mode 100644 index ae6426007f7d9d8ebfcbe7e937f0344fc22f540e..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/LoKiPhysMC.cpp +++ /dev/null @@ -1,39 +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 -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -#include "LoKi/LoKiPhysMC.h" -// ============================================================================ - -// ============================================================================ -/** @file - * - * Implementation file for the package Phys/LoKiPhysMC - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-11 - */ -// ============================================================================ - -// ============================================================================ -// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/MCMatch.cpp b/Phys/LoKiPhysMC/src/MCMatch.cpp deleted file mode 100644 index 183241b19dc9d91e762ce8330e7e4ba895a54649..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/MCMatch.cpp +++ /dev/null @@ -1,48 +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 -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -#include "LoKi/MCMatch.h" -#include "LoKi/MCMatchObj.h" -// ============================================================================ -/** @file - * - * Implementation file for class LoKi::MCMatch - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-11 - */ -// ============================================================================ -/// Standard constructor from the object and reporter -// ============================================================================ -LoKi::MCMatch::MCMatch( const LoKi::MCMatchObj* object ) : LoKi::Interface<LoKi::MCMatchObj>( object ) {} -// ============================================================================ -/// destructor -// ============================================================================ -LoKi::MCMatch::~MCMatch() {} -// ============================================================================ -/// implicit conversion to the pointer -// ============================================================================ -LoKi::MCMatch::operator const LoKi::MCMatchObj*() const { return getObject(); } -// ============================================================================ -// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/MCMatchDicts.cpp b/Phys/LoKiPhysMC/src/MCMatchDicts.cpp deleted file mode 100644 index ad2df0604f52fce9ce3f2561cf74b93e81803371..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/MCMatchDicts.cpp +++ /dev/null @@ -1,74 +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 -// ============================================================================ -// LoKi -// ============================================================================ -#include "LoKi/MCMatchDicts.h" -#include "LoKi/MCMatch.h" -#include "LoKi/MCMatchObj.h" -#include "LoKi/MCTypes.h" -// ============================================================================ -/** @file - * Implementation file for class LoKi::Dicts::MCMatchDicts - * @date 2007-06-06 - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - */ -// ============================================================================ -// valid object? -// ============================================================================ -bool LoKi::Dicts::MCMatchDicts::valid( const LoKi::MCMatch& m ) { return m.validPointer(); } -// ============================================================================ -/// do these MC particles make contribution to this RC particle? -// ============================================================================ -bool LoKi::Dicts::MCMatchDicts::match( const LoKi::MCMatch& m, const LHCb::Particle* p, const LHCb::MCParticle* mc ) { - return m.validPointer() ? m->match( p, mc ) : false; -} -// ============================================================================ -// do these MC particles make contribution to this RC particle? -// ============================================================================ -bool LoKi::Dicts::MCMatchDicts::match( const LoKi::MCMatch& m, const LHCb::Particle* p, - const LoKi::Types::MCRange& mc ) { - return m.validPointer() ? mc.end() != m->match( p, mc.begin(), mc.end() ) : false; -} -// ============================================================================ -// do these MC particles make contribution to this RC particle? -// ============================================================================ -bool LoKi::Dicts::MCMatchDicts::match( const LoKi::MCMatch& m, const LHCb::Particle* p, - const LHCb::MCParticle::Vector& mc ) { - return m.validPointer() ? mc.end() != m->match( p, mc.begin(), mc.end() ) : false; -} -// ============================================================================ -// do these MC particles make contribution to this RC particle? -// ============================================================================ -bool LoKi::Dicts::MCMatchDicts::match( const LoKi::MCMatch& m, const LHCb::Particle* p, - const LHCb::MCParticle::ConstVector& mc ) { - return m.validPointer() ? mc.end() != m->match( p, mc.begin(), mc.end() ) : false; -} -// ============================================================================ -// do these MC particles make contribution to this RC particle? -// ============================================================================ -bool LoKi::Dicts::MCMatchDicts::match( const LoKi::MCMatch& m, const LHCb::Particle* p, - const LoKi::Keeper<LHCb::MCParticle>& mc ) { - return m.validPointer() ? mc.end() != m->match( p, mc.begin(), mc.end() ) : false; -} -// ============================================================================ -// do these MC particles make contribution to this RC particle? -// ============================================================================ -bool LoKi::Dicts::MCMatchDicts::match( const LoKi::MCMatch& m, const LHCb::Particle* p, - const LoKi::UniqueKeeper<LHCb::MCParticle>& mc ) { - return m.validPointer() ? mc.end() != m->match( p, mc.begin(), mc.end() ) : false; -} - -// ============================================================================ -// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/MCMatchObj.cpp b/Phys/LoKiPhysMC/src/MCMatchObj.cpp deleted file mode 100644 index a5ecb366db376af8a0ebfc04e39478c9200f3b4d..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/MCMatchObj.cpp +++ /dev/null @@ -1,185 +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 -// ============================================================================ -// STD & STL -// ============================================================================ -#include <algorithm> -#include <functional> -// ============================================================================ -// LoKiPhys -// ============================================================================ -#include "LoKi/PhysExtract.h" -// ============================================================================ -// LoKiMC -// ============================================================================ -#include "LoKi/MCExtract.h" -// ============================================================================ -#include "LoKi/MCChild.h" -#include "LoKi/MCMatchObj.h" -// ============================================================================ -/** @file - * - * Implementation file for class LoKi::MCMatchObj - * - * This file is a part of LoKi project - - * ``C++ ToolKit for Smart and Friendly Physics Analysis'' - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-10 - */ -// ============================================================================ -namespace { - // ========================================================================== - struct BasicP : public std::unary_function<const LHCb::Particle*, bool> { - inline bool operator()( const LHCb::Particle* p ) const { - return 0 != p && ( p->isBasicParticle() || ( p->daughters().empty() && 0 == p->endVertex() ) ); - } - }; - // ========================================================================== -} // end of anonymous namespace -// ============================================================================ -/* Standard constructor - * @param name object name - * @param reporter error reporter - */ -// ============================================================================ -LoKi::MCMatchObj::MCMatchObj( const std::string& name, const LoKi::IReporter* reporter ) - : LoKi::Base( name, reporter ) {} -// ============================================================================ -// destructor -// ============================================================================ -LoKi::MCMatchObj::~MCMatchObj() {} -// ============================================================================ -/* check the match of MC truth information - * @param particle pointer to Particle object - * @param range range of MC particles - * @return true if particle matches at least 1 MC particle from range - */ -// ============================================================================ -bool LoKi::MCMatchObj::match( const LHCb::Particle* particle, const LoKi::Types::MCRange& range ) const { - return range.end() != match( particle, range.begin(), range.end() ); -} -// ============================================================================ -/* check the match of MC truth information - * @param particle pointer to Particle object - * @param mcparticle pointer to MCParticle object - * @return true if the particle and mcparticle has "match" - */ -// ============================================================================ -bool LoKi::MCMatchObj::match( const LHCb::Particle* particle, const LHCb::MCParticle* mcparticle ) const { - if ( 0 == particle ) { - Warning( "match(): Particle* points to NULL" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; - } else if ( 0 == mcparticle ) { - Warning( "match(): MCParticle* points to NULL" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; - } - - // look throught the existing tables: - - // 1) Particle->MCParticle - if ( matchInTables( m_tableP2MC, particle, mcparticle ) ) { return true; } // RETURN - // 2) Particle->MCParticle with weight - if ( matchInTables( m_tableP2MCW, particle, mcparticle ) ) { return true; } // RETURN - - // check ProtoParticle? - if ( !m_tablePP2MC.empty() ) { - // check for the protoparticle - const LHCb::ProtoParticle* proto = particle->proto(); - if ( 0 != proto ) { - // 3) ProtoParticle -> MCParticle with weight - if ( matchInTables( m_tablePP2MC, proto, mcparticle ) ) { return true; } // RETURN - } - } - // - if ( !m_tableT2MC.empty() || !m_tableT2MCW.empty() ) { - const LHCb::ProtoParticle* proto = particle->proto(); - if ( 0 != proto ) { - // check for the track - const LHCb::Track* track = proto->track(); - if ( 0 != track ) { - // 4) Track->MCParticle - if ( matchInTables( m_tableT2MC, track, mcparticle ) ) { return true; } // RETURN - // 5) Track->MCParticle with weight - if ( matchInTables( m_tableT2MCW, track, mcparticle ) ) { return true; } // RETURN - } - } - } - - /// get the list of daughters to initiate the recursion - LoKi::MCTypes::MCContainer children; - children.reserve( 20 ); - LoKi::MCChild::daughters( mcparticle, children ); - - // the further action differ for composed and basic particles: - BasicP basic; - - if ( basic( particle ) ) { - // A) For *BASIC* particles: - // match a particle with at least one MCParticle from the expanded MC-tree - return children.end() != match( particle, children.begin(), children.end() ); - } - // - // B) For *COMPOSED* Particles: - // require that *ALL* daughters are matched - // if ( match ( particle->daughters() .begin () , - // particle->daughters() .end () , - // children .begin () , - // children .end () ) ) { return true ; } - // - // B') try also 1D-step - // - const LHCb::MCParticle** mcp_1 = &mcparticle; - const LHCb::MCParticle** mcp_2 = mcp_1 + 1; - // - return match( particle->daughters().begin(), particle->daughters().end(), mcp_1, mcp_2 ) || - children.end() != match( particle, children.begin(), children.end() ); - // - // B') the last check for nontrivial structure - // the case has been pointed by Steve Blusk - // - // if ( particle->daughters().size() != - // std::count_if ( particle->daughters().begin () , - // particle->daughters().end () , BasicP() ) ) - // { - // LHCb::Particle::ConstVector vct ; - // vct.reserve ( 16 ) ; - // LoKi::Extract::particles ( particle , std::back_inserter( vct ) , BasicP() ) ; - // // - // return match ( vct . begin () , - // vct . end () , - // children .begin () , - // children .end () ) ; // RETURN - // - // } - // // - // return false ; -} -// ============================================================================ -// clear the internal storage -// ============================================================================ -void LoKi::MCMatchObj::clear() { - m_tableP2MC.clear(); - m_tableP2MCW.clear(); - m_tablePP2MC.clear(); - m_tableT2MC.clear(); - m_tableT2MC.clear(); -} -// ============================================================================ -// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/MCMatcher.cpp b/Phys/LoKiPhysMC/src/MCMatcher.cpp deleted file mode 100644 index 07a42283877c3dfa43e2439974d1ed2f9bc9bca1..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/MCMatcher.cpp +++ /dev/null @@ -1,648 +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 <functional> -// ============================================================================ -// GaudiKernel -// ============================================================================ -#include "GaudiKernel/IAlgContextSvc.h" -#include "GaudiKernel/IAlgManager.h" -#include "GaudiKernel/SmartIF.h" -#include "GaudiKernel/ToStream.h" -// ============================================================================ -// GaudiAlg -// ============================================================================ -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiAlg/GetAlgs.h" -// ============================================================================ -// PartProp -// ============================================================================ -#include "Kernel/IParticlePropertySvc.h" -// ============================================================================ -// Event -// ============================================================================ -#include "Event/MCParticle.h" -#include "Event/ProtoParticle.h" -// ============================================================================ -// LoKiCore -// ============================================================================ -#include "LoKi/IReporter.h" -#include "LoKi/Trees.h" -// ============================================================================ -// LoKiMC -// ============================================================================ -#include "LoKi/IMCDecay.h" -#include "LoKi/MCParticles1.h" -// ============================================================================ -// local -// ============================================================================ -#include "LoKi/MCMatch.h" -#include "LoKi/MCMatchObj.h" -#include "LoKi/MCMatcher.h" -// ============================================================================ -/** @file - * Implementation file for class LoKi::PhysMCParticles::MCMatcher - * @date 2009-08-11 - * @author Vanya BELYAEV ibelyaev@nikhef.nl - */ -// ============================================================================ -namespace { - // ========================================================================== - // Suppress Intel compiler warnings about missing default constructor - // In this case the compiler generated constructor is fine, since there are - // no member data to be initialised -#ifdef __INTEL_COMPILER -# pragma warning( disable : 854 ) -# pragma warning( push ) -#endif - // ========================================================================== - /// validation of decay finder - inline StatusCode _validate( const LoKi::PhysMCParticles::MCTreeMatch::iTree& tree, - const LHCb::IParticlePropertySvc* svc ) { - return tree.validate( svc ); - } - // ========================================================================== - /// get gaudi algorithm from the context - GaudiAlgorithm* _getAlg( LoKi::ILoKiSvc* loki ) { - SmartIF<IAlgContextSvc> cntx( loki ); - GaudiAlgorithm* g = Gaudi::Utils::getGaudiAlg( cntx ); - if ( g ) { return g; } - // - // try to create dedicated algorithm - SmartIF<IAlgManager> iam( loki ); - if ( !iam ) { return nullptr; } - SmartIF<IAlgorithm>& iap = iam->algorithm( "GaudiAlgorithm/#MCMATCHER#", true ); - if ( !iap ) { return nullptr; } - // - return dynamic_cast<GaudiAlgorithm*>( iap.get() ); - } - // ========================================================================== - /// invalid decay - const Decays::Trees::Types_<const LHCb::MCParticle*>::Invalid s_INVALID{}; - // ========================================================================== - inline std::string rels0( const std::string& loc ) { - if ( std::string::npos != loc.find( "Relations" ) ) { return loc; } - if ( 0 == loc.find( '/' ) ) { return loc; } - return "Relations/" + loc; - } - // ========================================================================== -#ifdef __INTEL_COMPILER -# pragma warning( pop ) -#endif - // ========================================================================== -} // end of anonymous namespace -// ============================================================================ -/* constructor from the decay and MC-truth matching tables - * @param locations the location of MCtruth relation tables - */ -// ============================================================================ -LoKi::PhysMCParticles::MCMatcherBase::MCMatcherBase( LoKi::PhysMCParticles::MCMatcherBase::Locations locations, - std::string thehead ) - : LoKi::AuxFunBase( std::tie( locations, thehead ) ) - , m_locations( std::move( locations ) ) - , m_head( std::move( thehead ) ) { - if ( m_head.empty() ) m_head = LHCb::MCParticleLocation::Default; -} -// ============================================================================ -/* constructor from the decay and MC-truth matching tables - * @param locations the location of MCtruth relation tables - */ -// ============================================================================ -LoKi::PhysMCParticles::MCMatcherBase::MCMatcherBase( const LoKi::PhysMCParticles::ProtoPMatch& protoMatch, - std::string thehead ) - : MCMatcherBase( protoMatch == Neutral - ? Locations{rels0( LHCb::ProtoParticleLocation::Neutrals )} - : protoMatch == ChargedLong - ? Locations{rels0( LHCb::ProtoParticleLocation::Charged )} - : protoMatch == Charged ? Locations{rels0( LHCb::ProtoParticleLocation::Charged ), - rels0( LHCb::ProtoParticleLocation::Upstream )} - : Locations{rels0( LHCb::ProtoParticleLocation::Charged ), - rels0( LHCb::ProtoParticleLocation::Upstream ), - rels0( LHCb::ProtoParticleLocation::Neutrals )}, - std::move( thehead ) ) {} -// ============================================================================ -// copy constructor -// ============================================================================ -LoKi::PhysMCParticles::MCMatcherBase::MCMatcherBase( const LoKi::PhysMCParticles::MCMatcherBase& right ) - : LoKi::AuxFunBase( right ) - , LoKi::PhysMCParticles::MCTruth() // NB: do not copy MCTruth!! - , m_locations( right.m_locations ) - , m_head( right.m_head ) - , m_alg( nullptr ) // do not copy the algorithm -{} -// ============================================================================ -// destructor -// ============================================================================ -LoKi::PhysMCParticles::MCMatcherBase::~MCMatcherBase() { - clearAll(); - // - LoKi::MCMatchObj* _m = match(); - if ( _m && 1 > _m->refCount() ) { _m->release(); } -} -// ============================================================================ -// clear all storages -// ============================================================================ -void LoKi::PhysMCParticles::MCMatcherBase::clearAll() const { - // clear the list of MC-particles - storage().clear(); - // clear the relation tables - if ( !( !match() ) ) { match()->clear(); } -} -// ============================================================================ -// load the data -// ============================================================================ -StatusCode LoKi::PhysMCParticles::MCMatcherBase::load() const // load the data -{ - - if ( !match() ) { - // get GaudiAlgorithm - if ( !alg() ) { setAlg( _getAlg( lokiSvc() ) ); } - Assert( alg(), "GaudiAlgorithm* points to NULL" ); - LoKi::IReporter* rep = alg()->tool<LoKi::IReporter>( "LoKi::Reporter/" + this->printOut(), alg() ); - LoKi::MCMatchObj* _m = new MCMatchObj( this->printOut(), rep ); - setMatch( _m ); - } - - /// clear all storages - clearAll(); - - // get GaudiAlgorithm - if ( !alg() ) { setAlg( _getAlg( lokiSvc() ) ); } - Assert( alg(), "GaudiAlgorithm* points to NULL" ); - - // locate the data - for ( Locations::const_iterator item = m_locations.begin(); m_locations.end() != item; ++item ) { - if ( alg()->exist<LoKi::Types::TableP2MC>( *item ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableP2MC>( *item ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TableP2MCW>( *item ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableP2MCW>( *item ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TablePP2MC>( *item ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TablePP2MC>( *item ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TableT2MC>( *item ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableT2MC>( *item ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TableT2MCW>( *item ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableT2MCW>( *item ) ); - continue; - } else { - const std::string loc = rels0( *item ); - if ( *item == loc ) { - Error( "No valid relation table at '" + ( *item ) + "'" ) - .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - continue; - } else if ( alg()->exist<LoKi::Types::TableP2MC>( loc ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableP2MC>( loc ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TableP2MCW>( loc ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableP2MCW>( loc ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TablePP2MC>( loc ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TablePP2MC>( loc ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TableT2MC>( loc ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableT2MC>( loc ) ); - continue; - } else if ( alg()->exist<LoKi::Types::TableT2MCW>( loc ) ) { - match()->addMatchInfo( alg()->get<LoKi::Types::TableT2MCW>( loc ) ); - continue; - } - // - Error( "No valid relation table at '" + ( *item ) + "'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - } - } - // - if ( match()->empty() ) { - Error( "Empty list of relation tables, MC-truth matching is disabled" ) - .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - } - // get MC-particles - const LHCb::MCParticle::Container* mcparticles = m_alg->get<LHCb::MCParticle::Container>( m_head ); - - /// load Monte Carlo particles - StatusCode sc = getMCParticles( *mcparticles ); - if ( sc.isSuccess() ) { setEvent(); } - - if ( empty() ) { return Warning( "load(): No MC-Particles are selected", StatusCode::SUCCESS ); } - - return StatusCode::SUCCESS; -} -// ====================================================================== - -// ====================================================================== -/* constructor from MC-selector and TES-locations - * @param selector Monte Carlo selector - * @param locations TES-locations of relation tables - */ -// ====================================================================== -LoKi::PhysMCParticles::MCSelMatch::MCSelMatch( const LoKi::PhysMCParticles::MCSelMatch::MCCuts& selector, - const LoKi::PhysMCParticles::MCMatcherBase::Locations& locations, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( selector, locations, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( locations, thehead ) - , m_cuts( selector ) {} -// ====================================================================== -/* constructor from MC-selector and TES-locations - * @param selector Monte Carlo selector - */ -// ====================================================================== -LoKi::PhysMCParticles::MCSelMatch::MCSelMatch( const LoKi::PhysMCParticles::MCSelMatch::MCCuts& selector, - const std::string& location ) - : LoKi::AuxFunBase( std::tie( selector, location ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location ) - , m_cuts( selector ) {} -// ====================================================================== -/* constructor from MC-selector and TES-locations - * @param selector Monte Carlo selector - */ -// ====================================================================== -LoKi::PhysMCParticles::MCSelMatch::MCSelMatch( const LoKi::PhysMCParticles::MCSelMatch::MCCuts& selector, - const std::string& location1, const std::string& location2 ) - : LoKi::AuxFunBase( std::tie( selector, location1, location2 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2 ) - , m_cuts( selector ) {} -// ====================================================================== -/* constructor from MC-selector and TES-locations - * @param selector Monte Carlo selector - */ -// ====================================================================== -LoKi::PhysMCParticles::MCSelMatch::MCSelMatch( const LoKi::PhysMCParticles::MCSelMatch::MCCuts& selector, - const std::string& location1, const std::string& location2, - const std::string& location3 ) - : LoKi::AuxFunBase( std::tie( selector, location1, location2, location3 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2, location3 ) - , m_cuts( selector ) {} -// ====================================================================== -/* constructor from MC-selector and TES-locations - * @param selector Monte Carlo selector - */ -// ====================================================================== -LoKi::PhysMCParticles::MCSelMatch::MCSelMatch( const LoKi::PhysMCParticles::MCSelMatch::MCCuts& selector, - const LoKi::PhysMCParticles::ProtoPMatch& protoMatch, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( selector, protoMatch, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( protoMatch, thehead ) - , m_cuts( selector ) {} -// ============================================================================ -// destructor -// ============================================================================ -LoKi::PhysMCParticles::MCSelMatch::~MCSelMatch() {} -// ============================================================================ -// MANDATORY: clone method ("virtual constructor") -// ============================================================================ -LoKi::PhysMCParticles::MCSelMatch* LoKi::PhysMCParticles::MCSelMatch::clone() const { - return new LoKi::PhysMCParticles::MCSelMatch( *this ); -} -// ============================================================================ -// MANDATORY: the only one essential method -// ============================================================================ -LoKi::PhysMCParticles::MCSelMatch::result_type LoKi::PhysMCParticles::MCSelMatch:: - operator()( LoKi::PhysMCParticles::MCSelMatch::argument p ) const { - if ( !p ) { - Error( "LHCb::Particle* point to NULL, return false" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; - } - // the same event ? - if ( !sameEvent() ) { load().ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); } - // - return match( p ); -} -// ============================================================================ -// OPTIONAL: nice printout -// ============================================================================ -std::ostream& LoKi::PhysMCParticles::MCSelMatch::fillStream( std::ostream& s ) const { - s << "MCSELMATCH(" << m_cuts << ","; - // - if ( head() != LHCb::MCParticleLocation::Default ) { - return Gaudi::Utils::toStream( locations(), s ) << ", '" << head() << "')"; - } - // - switch ( locations().size() ) { - case 1: - return s << "'" << locations()[0] << "')"; - case 2: - return s << "'" << locations()[0] << "','" << locations()[1] << "')"; - case 3: - return s << "'" << locations()[0] << "','" << locations()[1] << "','" << locations()[2] << "')"; - default: - break; - } - - return Gaudi::Utils::toStream( locations(), s ) << ")"; -} -// ============================================================================ -// get MC-particles -// ============================================================================ -StatusCode LoKi::PhysMCParticles::MCSelMatch::getMCParticles( const LHCb::MCParticle::Container& cnt ) const { - // clear MC-particles ; - storage().clear(); - - if ( cnt.empty() ) { return Warning( "Empty input container of MC-particles" ); } - - std::copy_if( cnt.begin(), cnt.end(), std::back_inserter( storage() ), std::cref( m_cuts ) ); - - return StatusCode::SUCCESS; -} -// ============================================================================ - -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const LoKi::PhysMCParticles::MCTreeMatch::iTree& decay, - const LoKi::PhysMCParticles::MCMatcherBase::Locations& locations, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( decay, locations, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( locations, thehead ) - , m_finder( decay ) { - checkFinder(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const LoKi::PhysMCParticles::MCTreeMatch::iTree& decay, - const std::string& location ) - : LoKi::AuxFunBase( std::tie( decay, location ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location ) - , m_finder( decay ) { - checkFinder(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const LoKi::PhysMCParticles::MCTreeMatch::iTree& decay, - const std::string& location1, const std::string& location2 ) - : LoKi::AuxFunBase( std::tie( decay, location1, location2 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2 ) - , m_finder( decay ) { - checkFinder(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const LoKi::PhysMCParticles::MCTreeMatch::iTree& decay, - const std::string& location1, const std::string& location2, - const std::string& location3 ) - : LoKi::AuxFunBase( std::tie( decay, location1, location2, location3 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2, location3 ) - , m_finder( decay ) { - checkFinder(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const LoKi::PhysMCParticles::MCTreeMatch::iTree& decay, - const LoKi::PhysMCParticles::ProtoPMatch& protoMatch, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( decay, protoMatch, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( protoMatch, thehead ) - , m_finder( decay ) { - checkFinder(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const std::string& decay, - const LoKi::PhysMCParticles::MCMatcherBase::Locations& locations, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( decay, locations, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( locations, thehead ) - , m_finder( s_INVALID ) { - getFinder( decay ); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const std::string& decay, const std::string& location ) - : LoKi::AuxFunBase( std::tie( decay, location ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location ) - , m_finder( s_INVALID ) { - getFinder( decay ); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const std::string& decay, const std::string& location1, - const std::string& location2 ) - : LoKi::AuxFunBase( std::tie( decay, location1, location2 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2 ) - , m_finder( s_INVALID ) { - getFinder( decay ); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const std::string& decay, const std::string& location1, - const std::string& location2, const std::string& location3 ) - : LoKi::AuxFunBase( std::tie( decay, location1, location2, location3 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2, location3 ) - , m_finder( s_INVALID ) { - getFinder( decay ); -} -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::MCTreeMatch( const std::string& decay, - const LoKi::PhysMCParticles::ProtoPMatch& protoMatch, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( decay, protoMatch, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( protoMatch, thehead ) - , m_finder( s_INVALID ) { - getFinder( decay ); -} -// ============================================================================ -// destructor -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::~MCTreeMatch() {} -// ============================================================================ -// MANDATORY: clone method ("virtual constructor") -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch* LoKi::PhysMCParticles::MCTreeMatch::clone() const { - return new LoKi::PhysMCParticles::MCTreeMatch( *this ); -} -// ============================================================================ -void LoKi::PhysMCParticles::MCTreeMatch::checkFinder() { - if ( !m_finder ) { - // try to locate IParticle property service - SmartIF<LHCb::IParticlePropertySvc> ppSvc( lokiSvc().getObject() ); - const iTree& tree = m_finder; - Assert( !( !ppSvc ), "LHCb::IParticleProperty is not available for '" + tree.toString() + "'" ); - StatusCode sc = _validate( m_finder, ppSvc ); - Assert( sc.isSuccess(), "Can't validate the decay descritor '" + tree.toString() + "'" ); - } -} -// ============================================================================ -// check the decay descriptor -// ============================================================================ -void LoKi::PhysMCParticles::MCTreeMatch::getFinder( const std::string& decay ) { - // get GaudiAlgorithm - if ( !alg() ) { setAlg( _getAlg( lokiSvc() ) ); } - // - Assert( alg(), "Context: GaudiAlgorithm* points to NULL" ); - // get the factory: - Decays::IMCDecay* factory = alg()->tool<Decays::IMCDecay>( "LoKi::MCDecay", alg() ); - // get the decay finder from the factory - m_finder = Finder( factory->tree( decay ) ); - // - checkFinder(); -} -// ============================================================================ -// MANDATORY: the only one essential method -// ============================================================================ -LoKi::PhysMCParticles::MCTreeMatch::result_type LoKi::PhysMCParticles::MCTreeMatch:: - operator()( LoKi::PhysMCParticles::MCTreeMatch::argument p ) const { - if ( !p ) { - Error( "LHCb::Particle* point to NULL, return false" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; - } - // the same event ? - if ( !sameEvent() ) { load().ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); } - // - return match( p ); -} -// ============================================================================ -// OPTIONAL: nice printout -// ============================================================================ -std::ostream& LoKi::PhysMCParticles::MCTreeMatch::fillStream( std::ostream& s ) const { - s << "MCMATCH('" << m_finder << "',"; - // - if ( head() != LHCb::MCParticleLocation::Default ) { - return Gaudi::Utils::toStream( locations(), s ) << ", '" << head() << "')"; - } - // - switch ( locations().size() ) { - case 1: - return s << "'" << locations()[0] << "')"; - case 2: - return s << "'" << locations()[0] << "','" << locations()[1] << "')"; - case 3: - return s << "'" << locations()[0] << "','" << locations()[1] << "','" << locations()[2] << "')"; - default: - break; - } - - return Gaudi::Utils::toStream( locations(), s ) << ")"; -} -// ============================================================================ -// get MC-particles -// ============================================================================ -StatusCode LoKi::PhysMCParticles::MCTreeMatch::getMCParticles( const LHCb::MCParticle::Container& cnt ) const { - // clear MC-particles ; - storage().clear(); - - if ( cnt.empty() ) { return Warning( "Empty input container of MC-particles" ); } - - m_finder( cnt.begin(), cnt.end(), std::back_inserter( storage() ) ); - - return StatusCode::SUCCESS; -} -// ============================================================================ - -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch::MCNodeMatch( const LoKi::PhysMCParticles::MCNodeMatch::iNode& node, - const LoKi::PhysMCParticles::MCMatcherBase::Locations& locations, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( node, locations, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( locations, thehead ) - , m_node( node ) { - checkNode(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch::MCNodeMatch( const LoKi::PhysMCParticles::MCNodeMatch::iNode& node, - const std::string& location ) - : LoKi::AuxFunBase( std::tie( node, location ) ), LoKi::PhysMCParticles::MCMatcherBase( location ), m_node( node ) { - checkNode(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch::MCNodeMatch( const LoKi::PhysMCParticles::MCNodeMatch::iNode& node, - const std::string& location1, const std::string& location2 ) - : LoKi::AuxFunBase( std::tie( node, location1, location2 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2 ) - , m_node( node ) { - checkNode(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch::MCNodeMatch( const LoKi::PhysMCParticles::MCNodeMatch::iNode& node, - const std::string& location1, const std::string& location2, - const std::string& location3 ) - : LoKi::AuxFunBase( std::tie( node, location1, location2, location3 ) ) - , LoKi::PhysMCParticles::MCMatcherBase( location1, location2, location3 ) - , m_node( node ) { - checkNode(); -} -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch::MCNodeMatch( const LoKi::PhysMCParticles::MCNodeMatch::iNode& node, - const LoKi::PhysMCParticles::ProtoPMatch& protoMatch, - const std::string& thehead ) - : LoKi::AuxFunBase( std::tie( node, protoMatch, thehead ) ) - , LoKi::PhysMCParticles::MCMatcherBase( protoMatch, thehead ) - , m_node( node ) { - checkNode(); -} -// ============================================================================ -// destructor -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch::~MCNodeMatch() {} -// ============================================================================ -// MANDATORY: clone method ("virtual constructor") -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch* LoKi::PhysMCParticles::MCNodeMatch::clone() const { - return new LoKi::PhysMCParticles::MCNodeMatch( *this ); -} -// ============================================================================ -void LoKi::PhysMCParticles::MCNodeMatch::checkNode() { - if ( !m_node ) { - // try to locate IParticle property service - SmartIF<LHCb::IParticlePropertySvc> ppSvc( lokiSvc().getObject() ); - Assert( !( !ppSvc ), "LHCb::IParticleProperty is not available for '" + m_node.toString() + "'" ); - StatusCode sc = m_node.validate( ppSvc ); - Assert( sc.isSuccess(), "Can't validate the node descritor '" + m_node.toString() + "'" ); - } -} -// ============================================================================ -// MANDATORY: the only one essential method -// ============================================================================ -LoKi::PhysMCParticles::MCNodeMatch::result_type LoKi::PhysMCParticles::MCNodeMatch:: - operator()( LoKi::PhysMCParticles::MCNodeMatch::argument p ) const { - if ( !p ) { - Error( "LHCb::Particle* point to NULL, return false" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; - } - // the same event ? - if ( !sameEvent() ) { load().ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); } - // - return match( p ); -} -// ============================================================================ -// OPTIONAL: nice printout -// ============================================================================ -std::ostream& LoKi::PhysMCParticles::MCNodeMatch::fillStream( std::ostream& s ) const { - s << "MCNODEMATCH('" << m_node << "',"; - // - if ( head() != LHCb::MCParticleLocation::Default ) { - return Gaudi::Utils::toStream( locations(), s ) << ", '" << head() << "')"; - } - // - switch ( locations().size() ) { - case 1: - return s << "'" << locations()[0] << "')"; - case 2: - return s << "'" << locations()[0] << "','" << locations()[1] << "')"; - case 3: - return s << "'" << locations()[0] << "','" << locations()[1] << "','" << locations()[2] << "')"; - default: - break; - } - - return Gaudi::Utils::toStream( locations(), s ) << ")"; -} -// ============================================================================ -// get MC-particles -// ============================================================================ -StatusCode LoKi::PhysMCParticles::MCNodeMatch::getMCParticles( const LHCb::MCParticle::Container& cnt ) const { - // clear MC-particles ; - storage().clear(); - - if ( cnt.empty() ) { return Warning( "Empty input container of MC-particles" ); } - - std::copy_if( cnt.begin(), cnt.end(), std::back_inserter( storage() ), LoKi::MCParticles::DecNode( m_node ) ); - - return StatusCode::SUCCESS; -} -// ============================================================================ - -// ============================================================================ -// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/MCTruth.cpp b/Phys/LoKiPhysMC/src/MCTruth.cpp deleted file mode 100644 index afb24616e18f38d55864c81d2facf75cb03e732a..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/MCTruth.cpp +++ /dev/null @@ -1,225 +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 -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -#include "LoKi/MCTruth.h" -#include "LoKi/MCMatch.h" -#include "LoKi/MCMatchObj.h" -// ============================================================================ -/** @file - * - * Implementation file for fuctions form the file LoKi/PhysMCParticles.h - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-13 - */ -// ============================================================================ -namespace { - // ========================================================================== - const LoKi::MCMatchObj* const s_MCMATCH = 0; - // ========================================================================== -} // namespace -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param particle pointer to MC particle object - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::MCMatch& match, const LHCb::MCParticle* particle ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( particle ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::MCMatch& match, const LoKi::MCTypes::MCRange& range ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::MCMatch& match, const LHCb::MCParticle::Vector& range ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::MCMatch& match, const LHCb::MCParticle::ConstVector& range ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::MCMatch& match, const LoKi::Keeper<LHCb::MCParticle>& range ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::MCMatch& match, const LoKi::UniqueKeeper<LHCb::MCParticle>& range ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param particle pointer to MC particle object - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LHCb::MCParticle* particle, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( particle ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::MCTypes::MCRange& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LHCb::MCParticle::Vector& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LHCb::MCParticle::ConstVector& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::Keeper<LHCb::MCParticle>& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range range of MC particles - */ -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::UniqueKeeper<LHCb::MCParticle>& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate() - , LoKi::Keeper<LHCb::MCParticle>( range ) - , m_match( match ) {} -// ============================================================================ -// copy constructor -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth( const LoKi::PhysMCParticles::MCTruth& right ) - : LoKi::AuxFunBase( right ) - , LoKi::BasicFunctors<const LHCb::Particle*>::Predicate( right ) - , LoKi::Keeper<LHCb::MCParticle>( right ) - , m_match( right.m_match ) {} -// ============================================================================ -// MANDATORY: virual destructor -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::~MCTruth() {} -// ============================================================================ -// MANDATORY: clone method ("virtual constructor") -// ============================================================================ -LoKi::PhysMCParticles::MCTruth* LoKi::PhysMCParticles::MCTruth::clone() const { return new MCTruth( *this ); } -// ============================================================================ -// MANDATORY: the only one essential method ("function") -// ============================================================================ -bool LoKi::PhysMCParticles::MCTruth::match( LoKi::PhysMCParticles::MCTruth::argument p ) const { - if ( 0 == p ) { - Error( "Invalid Particle! return 'False'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; // RETURN - } - if ( empty() ) { - Warning( "Empty container of MC, return 'False'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; // RETURN - } - if ( !m_match.validPointer() ) { - Error( "LoKi::MCMatch is invalid! return 'False'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; // RETURN - } - if ( m_match->empty() ) { - Warning( "Empty list of Relation Tables, return 'False'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; // RETURN - } - // - return end() != m_match->match( p, begin(), end() ); -} -// ============================================================================ -// OPTIONAL: the specific printout -// ============================================================================ -std::ostream& LoKi::PhysMCParticles::MCTruth::fillStream( std::ostream& s ) const { return s << "MCTRUTH"; } -// ============================================================================ -// protected defauls contructor -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::MCTruth() - : LoKi::BasicFunctors<const LHCb::Particle*>::Predicate(), LoKi::Keeper<LHCb::MCParticle>(), m_match( s_MCMATCH ) {} -// ============================================================================ -// set new mc match object -// ============================================================================ -void LoKi::PhysMCParticles::MCTruth::setMatch( const LoKi::MCMatch& m ) const { - LoKi::MCMatch& tmp = const_cast<LoKi::MCMatch&>( m_match ); - tmp = m; -} -// ============================================================================ -// clear the list of particles -// ============================================================================ -LoKi::PhysMCParticles::MCTruth::Keeper& LoKi::PhysMCParticles::MCTruth::storage() const { - const Keeper& keeper = *this; - return const_cast<Keeper&>( keeper ); -} -// ============================================================================ -// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/src/PhysMCParticles.cpp b/Phys/LoKiPhysMC/src/PhysMCParticles.cpp deleted file mode 100644 index 9d657270704115c6a225091f76e33581190b19de..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/src/PhysMCParticles.cpp +++ /dev/null @@ -1,201 +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 -// ============================================================================ -// LoKiPhysMC -// ============================================================================ -#include "LoKi/PhysMCParticles.h" -#include "LoKi/MCMatch.h" -#include "LoKi/MCMatchObj.h" -// ============================================================================ -/** @file - * - * Implementation file for fuctions form the file LoKi/PhysMCParticles.h - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - * - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-03-13 - */ -// ============================================================================ - -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param particle pointer to particle object - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::MCMatch& match, const LHCb::Particle* particle ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( particle ) - , m_match( match ) {} -// ============================================================================ -/* constructor a - * @param match MCMatch object (working horse) - * @param range "container" of particles - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::MCMatch& match, const LoKi::Types::Range& range ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::MCMatch& match, const LHCb::Particle::Vector& range ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::MCMatch& match, const LHCb::Particle::ConstVector& range ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::MCMatch& match, const LoKi::Keeper<LHCb::Particle>& range ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param match MCMatch object (working horse) - * @param range container of particles - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::MCMatch& match, const LoKi::UniqueKeeper<LHCb::Particle>& range ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param particle pointer to particle object - * @param match MCMatch object (working horse) - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LHCb::Particle* particle, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( particle ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param range "container" of particles - * @param match MCMatch object (working horse) - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::Types::Range& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LHCb::Particle::Vector& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LHCb::Particle::ConstVector& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range.begin(), range.end() ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::Keeper<LHCb::Particle>& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range ) - , m_match( match ) {} -// ============================================================================ -/* constructor - * @param range container of particles - * @param match MCMatch object (working horse) - */ -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::UniqueKeeper<LHCb::Particle>& range, const LoKi::MCMatch& match ) - : LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate() - , LoKi::Keeper<LHCb::Particle>( range ) - , m_match( match ) {} -// ============================================================================ -// copy constructor -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::RCTruth( const LoKi::PhysMCParticles::RCTruth& right ) - : LoKi::AuxFunBase( right ) - , LoKi::BasicFunctors<const LHCb::MCParticle*>::Predicate( right ) - , LoKi::Keeper<LHCb::Particle>( right ) - , m_match( right.m_match ) {} -// ============================================================================ -// MANDATORY : virtual destructor destructor -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::~RCTruth() {} -// ============================================================================ -// MANDATORY: clone method ("virtual constructor") -// ============================================================================ -LoKi::PhysMCParticles::RCTruth* LoKi::PhysMCParticles::RCTruth::clone() const { return new RCTruth( *this ); } -// ============================================================================ -// MANDATORY: the only one essential method ("function") -// ============================================================================ -LoKi::PhysMCParticles::RCTruth::result_type LoKi::PhysMCParticles::RCTruth:: - operator()( LoKi::PhysMCParticles::RCTruth::argument p ) const { - if ( 0 == p ) { - Error( "Invalid Particle! return 'False'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; // RETURN - } - if ( empty() ) { - Warning( "Empty container of RC, return 'False'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; // RETURN - } - if ( !m_match.validPointer() ) { - Error( "MCMatchObj* is invalid! return 'False'" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - return false; // RETURN - } - // - return end() != m_match->match( begin(), end(), p ); -} -// ============================================================================ -// OPTIONAL: the specific printout -// ============================================================================ -std::ostream& LoKi::PhysMCParticles::RCTruth::fillStream( std::ostream& s ) const { return s << "RCTRUTH"; } -// ============================================================================ - -// ============================================================================ -// The END -// ============================================================================ diff --git a/Phys/LoKiPhysMC/tests/qmtest/lokiphysmc0.qmt b/Phys/LoKiPhysMC/tests/qmtest/lokiphysmc0.qmt deleted file mode 100644 index fb904a6ec55b17bca9a80f1b977f576738f1e134..0000000000000000000000000000000000000000 --- a/Phys/LoKiPhysMC/tests/qmtest/lokiphysmc0.qmt +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.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. ---> -<!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"> <text>../../python/LoKiPhysMC/tests.py</text></argument> -</extension> diff --git a/Phys/Particle2MCTruth/CMakeLists.txt b/Phys/Particle2MCTruth/CMakeLists.txt deleted file mode 100644 index 4a7463fa2734ed81ef88a4d86d13204859fae747..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################### -# (c) Copyright 2000-2021 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. # -############################################################################### -#[=======================================================================[.rst: -Phys/Particle2MCTruth ---------------------- -#]=======================================================================] - -gaudi_add_library(Particle2MCTruthLib - SOURCES - src/Lib/P2MCPBase.cpp - LINK - PUBLIC - Gaudi::GaudiAlgLib - Gaudi::GaudiKernel - LHCb::LoKiMCLib - LHCb::MCAssociators - LHCb::MCEvent - LHCb::PhysEvent - LHCb::RelationsLib - Rec::DaVinciMCKernelLib -) - -gaudi_add_module(Particle2MCTruth - SOURCES - src/MCMatchObjP2MCRelator.cpp - src/P2MCRelatorAlg.cpp - LINK - Analysis::LoKiPhysMCLib - Boost::headers - Gaudi::GaudiAlgLib - Gaudi::GaudiKernel - LHCb::LoKiCoreLib - LHCb::LoKiMCLib - Particle2MCTruthLib - Rec::DaVinciMCKernelLib -) - -gaudi_add_dictionary(P2MCPDict - HEADERFILES dict/Particle2MCTruthDict.h - SELECTION dict/Particle2MCTruthDict.xml - LINK Particle2MCTruthLib -) diff --git a/Phys/Particle2MCTruth/dict/Particle2MCTruthDict.h b/Phys/Particle2MCTruth/dict/Particle2MCTruthDict.h deleted file mode 100644 index a829fe0c2011ebeec7ce8b8dbbdc06156dd7904b..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/dict/Particle2MCTruthDict.h +++ /dev/null @@ -1,28 +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 DICT_PARTICLE2MCTRUTHDICT_H -# define DICT_PARTICLE2MCTRUTHDICT_H 1 - -// Include files - -/** @file dict/Particle2MCTruthDict.h - * - * - * @author Juan PALACIOS - * @date 2009-03-10 - */ -# include "P2MCP/IP2MCP.h" -# include "P2MCP/P2MCPTypes.h" -#endif // DICT_PARTICLE2MCTRUTHDICT_H - -namespace { - std::vector<LHCb::MCParticle::ConstVector> __stdvector_mcpVC; -} diff --git a/Phys/Particle2MCTruth/dict/Particle2MCTruthDict.xml b/Phys/Particle2MCTruth/dict/Particle2MCTruthDict.xml deleted file mode 100644 index 6465e094e64d71da06b07a729057509701dbb3f1..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/dict/Particle2MCTruthDict.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - (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. ---> -<!--- Author : Juan PALACIOS --> -<!--- Created : 2009-03-10 --> - -<lcgdict> -<!-- P2MCP --> - <class name = "IP2MCP"/> - <class name = "P2MCP::DecayLines"/> -</lcgdict> diff --git a/Phys/Particle2MCTruth/doc/release.notes b/Phys/Particle2MCTruth/doc/release.notes deleted file mode 100644 index ad716b067f1b4db45c091bfcd806439b405d5eb5..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/doc/release.notes +++ /dev/null @@ -1,228 +0,0 @@ -!----------------------------------------------------------------------------- -! Package : Phys/Particle2MCTruth -! Responsible : DaVinci coordinator -! Purpose : Collection of implementations of IP2MCP and -! P2MCPBase for Particle -> MCTruth matching -!----------------------------------------------------------------------------- - -!===================== Particle2MCTruth v2r7 2015-06-13 ====================== - -! 2016-06-03 - Stefano Perazzini - - Added location to match MC particles for Turbo - -!===================== Particle2MCTruth v2r6 2015-12-03 ====================== - -! 2015-11-09 - Gerhard Raven - - replace LoKi::Select with std::copy_if - -!========================= Particle2MCTruth v2r5p1 2013-12-18 ========================= - -! 2013-11-15 - Marco Clemencic - - Fixed genreflex XML selection file. - -!========================= Particle2MCTruth v2r5 2012-11-30 ========================= - -! 2012-11-29 - Marco Clemencic - - Added CMake configuration file. - -! 2012-11-08 - Chris Jones - - Improvements to the MC association tools to better support uDSTs - -!========================= Particle2MCTruth v2r4p1 2012-02-09 ========================= - -! 2012-02-09 - Chris Jones - - Remove obsolete dll.cpp file - -!========================= Particle2MCTruth v2r4 2011-12-15 ========================= - -! 2011-12-12 - Chris Jones - - Tidy up - -! 2011-11-11 - Chris Jones - - Update MCMatchObjP2MCRelator to make it more inteligent in where it - looks for the relations tables. Will now try to look in the same place in - the TES location as the input Particle container, which helps when running - on uDSTs. - -! ======================== Particle2MCTruth v2r3p6 2010-04-29 =============== -! 2011-04-08 - Juan Palacios - - src/MCMatchObjP2MCRelator.cpp - . Check matcher poitner before dereferencing. - - cmt/requirements - . Increase to v2r3p6 - -! ======================== Particle2MCTruth v2r3p5 2010-05-28 =============== - -! 2010-05-28 - Juan Palacios - - src/P2MCRelatorAlg.cpp - . Protect against Particle::Range not being found. - - cmt/requirements - . Increase to v2r3p5 - -! ======================== Particle2MCTruth v2r3p4 2010-05-18 =============== - -! 2010-05-18 - Juan Palacios - - src/P2MCRelatorAlg.cpp - . Suppress warnings until end of job. - . Fix trivial but crucial bug. - - cmt/requirements - . Increase to v2r3p4 - -! ======================== Particle2MCTruth v2r3p3 2010-04-30 =============== - -! 2010-04-15 - Juan Palacios - - src/P2MCRelatorAlg.cpp - . Use Particle::Range for input particles. - - cmt/requirements - . Increase version to v2r3p3 - -! ======================== Particle2MCTruth v2r3p2 2009-10-28 =============== - -! 2009-10-27 - Vanya Belyaev - - - MCMatchObjP2MCRelator - - change a bit the initialization logic: - postpone the loading of the relation tables - to the first actual usage of them.. - - -! 2009-10-22 - Chris Jones - - Add private usage of CLHEP (needed for linking on OSX) - -! 2009-10-15 - Juan PALACIOS - - P2MCP/IP2MCP.h - . Add missing GAUDI_API - - - cmt/requirements - . Increase version to v2r3p2 - -! ======================== Particle2MCTruth v2r3 2009-08-27 ================= - -! 2009-08-25 - Juan PALACIOS - - src/P2MCRelatorAlg{.h, .cpp} - . Allow for list of input locations - - cmt/requirements - . Increase version vo v2r3 - -! ======================== Particle2MCTruth v2r2 2009-08-11 ================= - -! 2009-07-30 - Juan PALACIOS - - Use new Gaudi v21 interface mechanism. - - Remove src/Lib/Particle2MCTruthInterfaces.cpp - - cmt/requirements - . Increase version to v2r2 - -! ======================== Particle2MCTruth v2r1 2009-07-15 ================= - -! 2009-07-13 - Juan PALACIOS - - src/MCMatchObjP2MCRelator.h - . Make an IIncidentListener - - src/MCMatchObjP2MCRelator.cpp - . IncidentListener now uses to trigger loading of input relations tables and - clearing of LoKi::MCMatchObj data member. Considerably speeds up - associations. Move initialization of MCMatchObj to initialize method. - - cmt/requirements - . Increase version to v2r1 - -! ======================== Particle2MCTruth v2r0 2009-07-02 ================= - -! 2009-06-30 - Juan PALACIOS - - - Add new class DecayLines (P2MCP/DecayLines.h) - . Wrapper around vector of vectors of const LHCb::MCParticle*. It splits and - sorts an input single vector on construction. The sorting and splitting is - according to position in decay tree. There is no write access to the - internal data structure, so the particles are guaranteed to be sorted and - split on construction of an instance of P2MCP::DecayLines. - - - P2MCP/IP2MCP.h - . Return P2MCP::DecayLines instead of P2MCP::Types::FlatTrees. - - - P2MCP/P2MCPBase,h, src/Lib/P2MCPBase.cpp - . Adapt to interface changes. - . No sort methods needed any more since DecayLines is self-sorted. Derived - classes only have to implement the isMatched method. - - - src/MCMatchObjP2MCRelator{.cpp, .h} - . Remove sort methods. Class now only needs to take care od deciding if an - MCParticle is matched to a Particle. - - - dict/Particle2MCTruthDict.xml - . Add dict for P2MCP::DecayLines and remove FlatTrees dicts. - - - cmt/requirements - . Increase version to v2r0 - -! 2009-06-25 - Juan PALACIOS - - P2MCP/P2MCPBase.h, P2MCP/IP2MCP.h - . Fix header location in doxygen - - cmt/requirements - . Increase version to v1r0p1 - -! ======================== Particle2MCTruth v1r0 2009-05-11 ================= - -! 2009-05-07 - Juan PALACIOS - - P2MCP/P2MCPBase.h, src/Lib/P2MCPBase.cpp - . Add implementation for IParticle2MCAssociator::operator()(const LHCb::Particle*) - -! 2009-04-28 - Juan PALACIOS - - MCMatchObjP2MCRelator - . Input relations tables are now a property, "RelTableLocations". The - tool accepts ProtoParticle->MCP and Particle->MCP (LoKi::Types::TablePP2MC - and LoKi::Types::TableP2MC respectively). By default, tool loads - "Relations/" + LHCb::ProtoParticleLocation::Charged, - "Relations/" + LHCb::ProtoParticleLocation::Upstream and - "Relations/" + LHCb::ProtoParticleLocation::Neutrals using the DataOnDemand - service, as before. - -! 2009-04-16 - Juan PALACIOS - - src/P2MCRelatorAlg.cpp - - src/P2MCRelatorAlg.h - . New GaudiAlgorithm that takes an MCParticle and Particle location, and uses - an IP2MCP to create a Particle2MCParticle::Table of associations between - Particles and MCParticles that pass IP2MCP::isMatched. - -! 2009-03-31 - Juan PALACIOS - - P2MCP/IP2MCP.h - . Now inherits from IParticle2MCAssociator (DaVinciMCKernel) - - P2MCP/P2MCPBase.h - . restRelatedMCP -> relatedMCP to conform to Particle2MCAssociator interface. - - src/Lib/P2MCPBase.cpp - . Add method relatedMCP(const LHCb::Particle* particle, - const std::string& mcParticleLocation) - -! 2009-03-13 - Juan PALACIOS - - P2MCP/IP2MCP.h - . Clean up. Return P2MCPTypes::FlatTrees - - P2MCP/P2MCPBase.h, src/Lib/P2MCP/P2MCPBase.cpp - . Big changes adapt to IP2MCP. - - P2MCP/P2MCPTypes.h - . Nested P2MCP::Types namespace. - . Clean up. - - Add P2MCP/P2MCPFunctors.h - . Useful sorting and other functors in P2MCP::Functors namespace. - - src/MCMatchObjP2MCRelator.h src/MCMatchObjP2MCRelator.cpp - . Use new functors - - dict/Particle2MCTruthDict{.h, .xml} - . Add dicts and instantiations for P2MCP::Types::FlatTree and P2MCP::Types::FlatTree -! 2009-03-10 - Juan PALACIOS - - cmt/requirements - . Add linker library and export include P2MCP - - Add: - . P2MCP/IP2MCP.h : IParticle2MCAssociator.h clone - . P2MCP/P2MCPBase.h : Base implementation of IP2MCP - . src/Lib/P2MCPBase.cpp : " " " " - . dict/Particle2MCTruthDict{.h, .xml} : dictionaries for IP2MCP - . P2MCP/P2MCPTypes.h : typedefs for IP2MCP - - src/MCMatchObjP2MCRelator{.cpp, .h} - . Inherit from IP2MCP and P2MCPBase - -! 2009-03-06 - Juan PALACIOS - - src/MCMatchObjP2MCRelator.h - . Add virtual private sort methods to over-ride those defined in Particle2MCAssociatorBase - - src/MCMatchObjP2MCRelator.cpp - . Implement sort methods and add relations tables for PP->MCP - -! 2009-03-04 - Juan PALACIOS - - First import. Add MCMatchObjP2MCRelator, uses LoKi stuff. diff --git a/Phys/Particle2MCTruth/include/P2MCP/DecayLines.h b/Phys/Particle2MCTruth/include/P2MCP/DecayLines.h deleted file mode 100644 index 27e0e7c04c303cb9c4d152cf796d2d3aca04397a..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/include/P2MCP/DecayLines.h +++ /dev/null @@ -1,61 +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 P2MCP_DECAYLINES_H -#define P2MCP_DECAYLINES_H 1 - -// Include files -#include "P2MCP/P2MCPFunctors.h" -#include "P2MCP/P2MCPTypes.h" -/** @class DecayLines DecayLines.h P2MCP/DecayLines.h - * - * Class containing sorted, segmented sequences of LHCb::MCParticles. - * Underying data structure is a container of LHCb::MCParticle::ConstVectors. - * Each entry contains MCParticles that come from one line in a decay tree. - * They are sorted according to position in that line, with the parent in - * first position and each generation following. - * - * @author Juan PALACIOS - * @date 2009-06-30 - */ - -namespace P2MCP { - - class DecayLines { - public: - inline explicit DecayLines( const LHCb::MCParticle::ConstVector& mcParticles ) - : m_treeSorter(), m_lines( m_treeSorter( mcParticles ) ) {} - - inline explicit DecayLines( const LHCb::MCParticle::Container& mcParticles ) - : m_treeSorter(), m_lines( m_treeSorter( mcParticles ) ) {} - - inline DecayLines() : m_lines( 0 ) {} - - virtual ~DecayLines() {} ///< Destructor - - inline size_t size() { return m_lines.size(); } - - inline bool empty() { return m_lines.empty(); } - - inline LHCb::MCParticle::ConstVector& operator[]( size_t index ) { return m_lines[index]; } - - inline P2MCP::Types::FlatTrees::const_iterator begin() { return m_lines.begin(); } - - inline P2MCP::Types::FlatTrees::const_iterator end() { return m_lines.begin(); } - - private: - P2MCP::Functors::SortIntoTrees<P2MCP::Functors::InTree, P2MCP::Functors::SortInTrees> m_treeSorter; - - P2MCP::Types::FlatTrees m_lines; - }; - -} // namespace P2MCP - -#endif // P2MCP_DECAYLINES_H diff --git a/Phys/Particle2MCTruth/include/P2MCP/IP2MCP.h b/Phys/Particle2MCTruth/include/P2MCP/IP2MCP.h deleted file mode 100644 index 9bbf97f145b6b2261bea9ac8d3bfa0350daaa0ac..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/include/P2MCP/IP2MCP.h +++ /dev/null @@ -1,123 +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 P2MCP_IP2MCP_H -#define P2MCP_IP2MCP_H 1 - -// Include files -// from STL -#include <string> - -// from Gaudi -#include "GaudiKernel/IAlgTool.h" -// from LHCb -#include "Event/MCParticle.h" -// from DaVinciMCKernel -#include "Kernel/IParticle2MCAssociator.h" -// from Particle2MCTruth -#include "P2MCP/DecayLines.h" - -namespace LHCb { - class Particle; -} - -/** @class IP2MCP IP2MCP.h P2MCP/IP2MCP.h - * - * Tool interface to generate weighted associations between one or many - * LHCb::Particles and return them to the user in different formats. The - * user is in control of the resulting associations and the invoking interface - * methods should have no side-effects. TES access should be read-only. - * Interface implementations should not populate the TES with their results - * directly or indirectly, and should not have any runtime configuration - * that alters the result, except for the assumed TES location of the - * LHCb::MCParticles for the relevant methods. - * - * @author Juan PALACIOS - * @date 2009-01-19 - */ -class GAUDI_API IP2MCP : virtual public IParticle2MCAssociator { -public: - DeclareInterfaceID( IP2MCP, 2, 0 ); - - /** - * Calculate and return the weighted associations between an - * LHCb::Particle and some LHCb::MCParticles from a TES locaiton. - * @param particle LHCb::Particle* to be associated - * @return P2MCP::Types::FlatTrees containing - * tree-sorted weighted relations between the - * LHCb::Particle and the LCHb::MCParticles - * @author Juan Palacios juan.palacios@nikhef.nl - * @date 2009-02-02 - * - **/ - virtual P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle ) const = 0; - - /** - * - * Calculate and return the weighted associations between an - * LHCb::Particle and some LHCb::MCParticles from a TES locaiton. - * @param particle LHCb::Particle* to be associated - * @param mcParticleLocation TES location of LHCb::MCParticles to base the - * association on. - * @return P2MCP::Types::FlatTrees containing tree-sorted - * weighted relations between the LHCb::Particle and the LCHb::MCParticles - * @author Juan Palacios juan.palacios@nikhef.nl - * @date 2009-02-02 - * - **/ - virtual P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle, - const std::string& mcParticleLocation ) const = 0; - - /** - * - * Calculate and return the weighted associations between a container of - * LHCb::Particles and a container of LHCb::MCParticles. - * @param particles Container of LHCb::Particles to be associated - * @param mcParticles Container of LHCb::MCParticles to base the - * association on. - * @return P2MCP::Types::FlatTrees containing tree-sorted - * relations between the LHCb::Particles and the LCHb::MCParticles - * @author Juan Palacios juan.palacios@nikhef.nl - * @date 2009-02-02 - * - **/ - virtual P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle, - const LHCb::MCParticle::ConstVector& mcParticles ) const = 0; - - /** - * - * Calculate and return the weighted associations between a container of - * LHCb::Particles and a container of LHCb::MCParticles. - * @param particles Container of LHCb::Particles to be associated - * @param mcParticles Container of LHCb::MCParticles to base the - * association on. - * @return P2MCP::Types::FlatTrees Relations table containing tree-sorted - * relations between the LHCb::Particles and the LCHb::MCParticles - * @author Juan Palacios juan.palacios@nikhef.nl - * @date 2009-02-02 - * - **/ - virtual P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle, - const LHCb::MCParticle::Container& mcParticles ) const = 0; - - /** - * Calculate the association between an LHCb::Particle and an - * LHCb::MCParticle. - * - * @author Juan Palacios juan.palacios@nikhef.nl - * @date 2009-02-02 - * - **/ - virtual bool isMatched( const LHCb::Particle* particle, const LHCb::MCParticle* mcParticle ) const = 0; - -protected: - virtual ~IP2MCP() {} ///< virtual and protected destructor -}; -#endif // P2MCP_IP2MCP_H diff --git a/Phys/Particle2MCTruth/include/P2MCP/P2MCPBase.h b/Phys/Particle2MCTruth/include/P2MCP/P2MCPBase.h deleted file mode 100644 index 99e78380bdaf6691a4d0f7b056e707cf98b632b2..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/include/P2MCP/P2MCPBase.h +++ /dev/null @@ -1,99 +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 P2MCP_P2MCPBASE_H -#define P2MCP_P2MCPBASE_H 1 - -// Include files -// from Gaudi -#include "GaudiAlg/GaudiTool.h" -// local -#include "P2MCP/IP2MCP.h" // Interface - -/** @class P2MCPBase P2MCPBase.h P2MCP/P2MCPBase.h - * - * Common implementation for descendants of IParticle2MCAssociator. - * Mainly inline helper methods for common implementation of host of - * similar methods in the interface. - * Set of methods is self-consistent. Derived classes only need to implement - * method - * @code - * bool isMatched(const LHCb::Particle*, const LHCb::MCParticle) - * @endcode - * and - * - * @author Juan PALACIOS - * @date 2009-01-30 - */ -class GAUDI_API P2MCPBase : public extends1<GaudiTool, IP2MCP> { -public: - /// Standard constructor - P2MCPBase( const std::string& type, const std::string& name, const IInterface* parent ); - - StatusCode initialize() override; - - StatusCode finalize() override; - - virtual ~P2MCPBase(); - - const LHCb::MCParticle* relatedMCP( const LHCb::Particle* particle ) const override; - - const LHCb::MCParticle* operator()( const LHCb::Particle* particle ) const override; - - const LHCb::MCParticle* relatedMCP( const LHCb::Particle*, const std::string& mcParticleLocation ) const override; - - const LHCb::MCParticle* relatedMCP( const LHCb::Particle* particle, - const LHCb::MCParticle::ConstVector& mcParticles ) const override; - - const LHCb::MCParticle* relatedMCP( const LHCb::Particle* particle, - const LHCb::MCParticle::Container& mcParticles ) const override; - - P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle ) const override; - - P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle, const std::string& mcParticleLocation ) const override; - - P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle, - const LHCb::MCParticle::ConstVector& mcParticles ) const override; - - P2MCP::DecayLines relatedMCPs( const LHCb::Particle* particle, - const LHCb::MCParticle::Container& mcParticles ) const override; - - bool isMatched( const LHCb::Particle* particle, const LHCb::MCParticle* mcParticle ) const override; - -private: - inline LHCb::MCParticle::Container* i_MCParticles( const std::string& location ) const { - return ( exist<LHCb::MCParticle::Container>( location ) ) ? get<LHCb::MCParticle::Container>( location ) : 0; - } - - template <typename Iter> - const LHCb::MCParticle* i_bestMCP( const LHCb::Particle* particle, Iter begin, Iter end ) const { - P2MCP::DecayLines trees = i_relatedMCPs( particle, begin, end ); - return ( trees.empty() ) ? 0 : trees[0].back(); - } - - template <typename Iter> - P2MCP::DecayLines i_relatedMCPs( const LHCb::Particle* particle, Iter begin, Iter end ) const { - if ( 0 != particle ) { - LHCb::MCParticle::ConstVector mcps; - for ( Iter iMCP = begin; iMCP != end; ++iMCP ) { - const bool match = isMatched( particle, *iMCP ); - if ( match ) mcps.push_back( *iMCP ); - } - return P2MCP::DecayLines( mcps ); - } else { - Warning( "No particle!" ).ignore(); - return P2MCP::DecayLines(); - } - } - -private: - std::string m_defMCLoc; -}; -#endif // P2MCP_P2MCPBASE_H diff --git a/Phys/Particle2MCTruth/include/P2MCP/P2MCPFunctors.h b/Phys/Particle2MCTruth/include/P2MCP/P2MCPFunctors.h deleted file mode 100644 index 92bb655fc6ecfd4bf94e895a3f5ba312ab0f7670..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/include/P2MCP/P2MCPFunctors.h +++ /dev/null @@ -1,77 +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 P2MCP_P2MCPFUNCTORS_H -#define P2MCP_P2MCPFUNCTORS_H 1 - -// Include files -#include "LoKi/BuildMCTrees.h" -#include "P2MCP/P2MCPTypes.h" -#include <algorithm> -#include <functional> -/** @namespace P2MCP::Functors P2MCP/P2MCPFunctors.h - * - * - * @author Juan Palacios - * @date 2009-03-13 - */ -namespace P2MCP { - namespace Functors { - - struct SortInTrees : public std::binary_function<const LHCb::MCParticle*, const LHCb::MCParticle*, bool> { - - bool operator()( const LHCb::MCParticle* p1, const LHCb::MCParticle* p2 ) const { - LoKi::MCParticles::FromMCDecayTree fromDecay( p1 ); - return fromDecay( p2 ); - } - }; - - struct InTree : public std::unary_function<const LHCb::MCParticle*, bool> { - - InTree( const LHCb::MCParticle* head ) : m_head( head ) {} - - bool operator()( const LHCb::MCParticle* mc ) const { - P2MCP::Functors::SortInTrees sorter; - return sorter( m_head, mc ); - } - - private: - InTree() {} - - private: - const LHCb::MCParticle* m_head; - }; - - template <class Selector, class Sorter> - struct SortIntoTrees { - - template <class InputContainer> - P2MCP::Types::FlatTrees operator()( const InputContainer& mcps ) const { - LHCb::MCParticle::ConstVector heads = LoKi::MCTrees::buildTrees( mcps ); - - P2MCP::Types::FlatTrees output; - - LHCb::MCParticle::ConstVector::iterator itHead = heads.begin(); - - for ( ; itHead != heads.end(); ++itHead ) { - Selector selector( *itHead ); - P2MCP::Types::FlatTree tree; - std::copy_if( mcps.begin(), mcps.end(), std::back_inserter( tree ), std::cref( selector ) ); - std::stable_sort( tree.begin(), tree.end(), Sorter() ); - output.push_back( tree ); - } - return output; - } - }; - - } // namespace Functors - -} // namespace P2MCP -#endif // P2MCP_P2MCPFUNCTORS_H diff --git a/Phys/Particle2MCTruth/include/P2MCP/P2MCPTypes.h b/Phys/Particle2MCTruth/include/P2MCP/P2MCPTypes.h deleted file mode 100644 index 42d5ae99d1b377b4819c0ce8ed2a0683b7e4db7f..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/include/P2MCP/P2MCPTypes.h +++ /dev/null @@ -1,50 +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 P2MCP_P2MCPTYPES_H -#define P2MCP_P2MCPTYPES_H 1 - -// Include files -#include "Event/MCParticle.h" -#include "Event/Particle.h" -#include "Kernel/MCAssociation.h" -#include "Relations/Relation.h" -#include "Relations/Relation1D.h" -#include <vector> -/** @namespace P2MCPTypes P2MCP/P2MCPTypes.h - * - * - * Namespace containing types corresponding to the Particle -> MCParticle - * uni-directional weighted relationship. - * - * @author Juan PALACIOS - * @date 2009-03-10 - */ -namespace P2MCP { - - namespace Types { - - typedef LHCb::MCParticle::ConstVector FlatTree; - typedef std::vector<FlatTree> FlatTrees; - - typedef LHCb::Relation1D<LHCb::Particle, LHCb::MCParticle> Table; - - typedef Relations::Relation<LHCb::Particle, LHCb::MCParticle> LightTable; - typedef Table::Range Range; - typedef Table::IBase::Entry Relation; - typedef Table::IBase::Entries Relations; - typedef Table::To To; - typedef Table::From From; - - typedef std::vector<MCAssociation> ToVector; - } // namespace Types - -} // namespace P2MCP -#endif // P2MCP_P2MCPTYPES_H diff --git a/Phys/Particle2MCTruth/src/Lib/P2MCPBase.cpp b/Phys/Particle2MCTruth/src/Lib/P2MCPBase.cpp deleted file mode 100644 index 70862104a6da6e4c08d67a434b75f90bc8b2ab66..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/src/Lib/P2MCPBase.cpp +++ /dev/null @@ -1,92 +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 "P2MCP/P2MCPBase.h" - -//----------------------------------------------------------------------------- -// Implementation file for class : P2MCPBase -// -// 2009-01-30 : Juan PALACIOS -//----------------------------------------------------------------------------- - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -P2MCPBase::P2MCPBase( const std::string& type, const std::string& name, const IInterface* parent ) - : base_class( type, name, parent ), m_defMCLoc( LHCb::MCParticleLocation::Default ) { - declareProperty( "MCParticleDefaultLocation", m_defMCLoc ); -} -//============================================================================= -const LHCb::MCParticle* P2MCPBase::relatedMCP( const LHCb::Particle* particle ) const { - const LHCb::MCParticle::Container* mcParticles = i_MCParticles( m_defMCLoc ); - return ( 0 == mcParticles ) ? 0 : i_bestMCP( particle, mcParticles->begin(), mcParticles->end() ); -} -//============================================================================= -const LHCb::MCParticle* P2MCPBase::operator()( const LHCb::Particle* particle ) const { - const LHCb::MCParticle::Container* mcParticles = i_MCParticles( m_defMCLoc ); - return ( 0 == mcParticles ) ? 0 : i_bestMCP( particle, mcParticles->begin(), mcParticles->end() ); -} -//============================================================================= -const LHCb::MCParticle* P2MCPBase::relatedMCP( const LHCb::Particle* particle, - const std::string& mcParticleLocation ) const { - LHCb::MCParticle::Container* mcps = i_MCParticles( mcParticleLocation ); - return ( 0 != mcps ) ? i_bestMCP( particle, mcps->begin(), mcps->end() ) : 0; -} -//============================================================================= -const LHCb::MCParticle* P2MCPBase::relatedMCP( const LHCb::Particle* particle, - const LHCb::MCParticle::ConstVector& mcParticles ) const { - return i_bestMCP( particle, mcParticles.begin(), mcParticles.end() ); -} -//============================================================================= -const LHCb::MCParticle* P2MCPBase::relatedMCP( const LHCb::Particle* particle, - const LHCb::MCParticle::Container& mcParticles ) const { - return i_bestMCP( particle, mcParticles.begin(), mcParticles.end() ); -} -//============================================================================= -P2MCP::DecayLines P2MCPBase::relatedMCPs( const LHCb::Particle* particle ) const { - return relatedMCPs( particle, m_defMCLoc ); -} -//============================================================================= -P2MCP::DecayLines P2MCPBase::relatedMCPs( const LHCb::Particle* particle, - const std::string& mcParticleLocation ) const { - LHCb::MCParticle::Container* mcps = i_MCParticles( mcParticleLocation ); - if ( 0 != mcps ) { - return i_relatedMCPs( particle, mcps->begin(), mcps->end() ); - } else { - return P2MCP::DecayLines(); - } -} -//============================================================================= -P2MCP::DecayLines P2MCPBase::relatedMCPs( const LHCb::Particle* particle, - const LHCb::MCParticle::ConstVector& mcParticles ) const { - return i_relatedMCPs( particle, mcParticles.begin(), mcParticles.end() ); -} -//============================================================================= -P2MCP::DecayLines P2MCPBase::relatedMCPs( const LHCb::Particle* particle, - const LHCb::MCParticle::Container& mcParticles ) const { - return i_relatedMCPs( particle, mcParticles.begin(), mcParticles.end() ); -} -//============================================================================= -bool P2MCPBase::isMatched( const LHCb::Particle* /*particle */, const LHCb::MCParticle* /* mcParticle */ ) const { - return false; -} -//============================================================================= -// initialize -//============================================================================= -StatusCode P2MCPBase::initialize() { return base_class::initialize(); } -//============================================================================= -// finalize -//============================================================================= -StatusCode P2MCPBase::finalize() { return base_class::finalize(); } -//============================================================================= -// Destructor -//============================================================================= -P2MCPBase::~P2MCPBase() {} -//============================================================================= diff --git a/Phys/Particle2MCTruth/src/MCMatchObjP2MCRelator.cpp b/Phys/Particle2MCTruth/src/MCMatchObjP2MCRelator.cpp deleted file mode 100644 index ae946c758c7e2cd898ccdefc2013ba46fe68b1c7..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/src/MCMatchObjP2MCRelator.cpp +++ /dev/null @@ -1,181 +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 - -// LoKi -#include "LoKi/IReporter.h" -// P2MCP -#include "P2MCP/P2MCPFunctors.h" -// local -#include "MCMatchObjP2MCRelator.h" -// boost -#include "boost/algorithm/string.hpp" - -//----------------------------------------------------------------------------- -// Implementation file for class : MCMatchObjP2MCRelator -// -// 2009-03-04 : Juan PALACIOS -//----------------------------------------------------------------------------- - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -MCMatchObjP2MCRelator::MCMatchObjP2MCRelator( const std::string& type, const std::string& name, - const IInterface* parent ) - : base_class( type, name, parent ), m_reporter( NULL ), m_matcher( NULL ), m_loaded( false ) { - m_tables.clear(); - m_tables.push_back( "Relations/" + LHCb::ProtoParticleLocation::Charged ); - m_tables.push_back( "Relations/" + LHCb::ProtoParticleLocation::Upstream ); - m_tables.push_back( "Relations/" + LHCb::ProtoParticleLocation::Neutrals ); - m_tables.push_back( "Turbo/Relations/Turbo/Protos" ); - m_tables.push_back( "Turbo/Relations/Rec/ProtoP/Charged" ); - declareProperty( "RelTableLocations", m_tables ); - // setProperty( "OutputLevel", 2 ); -} - -//============================================================================= - -StatusCode MCMatchObjP2MCRelator::initialize() { - StatusCode sc = base_class::initialize(); - if ( sc.isFailure() ) return sc; - - m_reporter = tool<LoKi::IReporter>( "LoKi::Reporter", this ); - - if ( msgLevel( MSG::VERBOSE ) ) { - verbose() << "RelTableLocations: " << endmsg; - for ( Addresses::const_iterator iAddr = m_tables.begin(); iAddr != m_tables.end(); ++iAddr ) { - verbose() << "\t" << *iAddr << endmsg; - } - } - - // Incident service call back - incSvc()->addListener( this, IncidentType::EndEvent ); - - // create the new matcher - m_matcher = new LoKi::MCMatchObj( "P2MCRelator", m_reporter ); - - // increment the reference counter - m_matcher->addRef(); - - m_loaded = false; - m_pLocDoneMap.clear(); - - // return - return sc; -} - -//============================================================================= - -StatusCode MCMatchObjP2MCRelator::finalize() { - m_matcher->clear(); - long count = m_matcher->refCount(); - while ( 0 < count ) { count = m_matcher->release(); } - m_matcher = NULL; - m_loaded = false; - m_pLocDoneMap.clear(); - return base_class::finalize(); -} - -//============================================================================= - -bool MCMatchObjP2MCRelator::isMatched( const LHCb::Particle* particle, const LHCb::MCParticle* mcParticle ) const { - if ( !particle ) { - mcParticle = NULL; - return false; - } - - if ( !m_loaded ) { - addTables(); - m_loaded = true; - } - - // First try the DST way, with the default tables - bool match = matcher()->match( particle, mcParticle ); - if ( !match ) { - // No match found the 'normal' way. Try the Particle location dependent (uDST) way. - addTable( particle ); - match = matcher()->match( particle, mcParticle ); - } - - if ( msgLevel( MSG::DEBUG ) ) { - if ( match ) { - debug() << " -> Matched Particle PID " << particle->particleID().pid() << " to MCParticle PID " - << mcParticle->particleID().pid() << endmsg; - } else if ( msgLevel( MSG::VERBOSE ) ) { - verbose() << " -> No match for Particle PID " << particle->particleID().pid() << endmsg; - } - } - - return match; -} - -//============================================================================= - -void MCMatchObjP2MCRelator::addTable( const LHCb::Particle* particle ) const { - // Try Particle specific locations for relations tables - std::string pLoc = objectLocation( particle->parent() ); - if ( !m_pLocDoneMap[pLoc] ) { - m_pLocDoneMap[pLoc] = true; - - // Form the relations TES location for this Particles location - boost::replace_all( pLoc, "/Particles", "/P2MCPRelations" ); - - // load the table - loadTable( pLoc ); - } -} - -//============================================================================= - -void MCMatchObjP2MCRelator::addTables() const { - for ( Addresses::const_iterator item = m_tables.begin(); item != m_tables.end(); ++item ) { loadTable( *item ); } - m_loaded = true; -} - -//============================================================================= - -void MCMatchObjP2MCRelator::loadTable( const std::string& address ) const { - // First try respecting the RootInTES settings. - if ( exist<LoKi::Types::TablePP2MC>( address ) ) { - LoKi::Types::TablePP2MC* table = get<LoKi::Types::TablePP2MC>( address ); - m_matcher->addMatchInfo( table ); - } else if ( exist<LoKi::Types::TableP2MC>( address ) ) { - LoKi::Types::TableP2MC* table = get<LoKi::Types::TableP2MC>( address ); - m_matcher->addMatchInfo( table ); - } - // If that fails, try without RootInTES - else if ( exist<LoKi::Types::TablePP2MC>( address, false ) ) { - LoKi::Types::TablePP2MC* table = get<LoKi::Types::TablePP2MC>( address, false ); - m_matcher->addMatchInfo( table ); - } else if ( exist<LoKi::Types::TableP2MC>( address, false ) ) { - LoKi::Types::TableP2MC* table = get<LoKi::Types::TableP2MC>( address, false ); - m_matcher->addMatchInfo( table ); - } -} - -//============================================================================= - -void MCMatchObjP2MCRelator::handle( const Incident& ) { - m_matcher->clear(); - m_loaded = false; - m_pLocDoneMap.clear(); -} - -//============================================================================= -// Destructor -//============================================================================= -MCMatchObjP2MCRelator::~MCMatchObjP2MCRelator() {} -//============================================================================= - -// Declaration of the Tool Factory -DECLARE_COMPONENT( MCMatchObjP2MCRelator ) - -//============================================================================= diff --git a/Phys/Particle2MCTruth/src/MCMatchObjP2MCRelator.h b/Phys/Particle2MCTruth/src/MCMatchObjP2MCRelator.h deleted file mode 100644 index 43538398683ebdbd490b0ae4e14f160c8d12a767..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/src/MCMatchObjP2MCRelator.h +++ /dev/null @@ -1,92 +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 MCMATCHOBJP2MCRELATOR_H -#define MCMATCHOBJP2MCRELATOR_H 1 - -// Include files -#include <functional> -#include <map> -#include <string> - -// from Gaudi -#include "LoKi/MCMatch.h" -#include "LoKi/MCMatchObj.h" -#include "LoKi/MCParticles.h" -#include "P2MCP/P2MCPBase.h" -#include <GaudiKernel/IIncidentListener.h> -#include <GaudiKernel/IIncidentSvc.h> -// forward declarations -namespace LoKi { - class IReporter; -} - -/** @class MCMatchObjP2MCRelator MCMatchObjP2MCRelator.h - * - * - * @author Juan PALACIOS - * @date 2009-03-04 - */ -class MCMatchObjP2MCRelator : public extends1<P2MCPBase, IIncidentListener> { - -public: - /// Standard constructor - MCMatchObjP2MCRelator( const std::string& type, const std::string& name, const IInterface* parent ); - - virtual ~MCMatchObjP2MCRelator(); ///< Destructor - - StatusCode initialize() override; - - StatusCode finalize() override; - -public: - bool isMatched( const LHCb::Particle* particle, const LHCb::MCParticle* mcParticle ) const override; - -public: - void handle( const Incident& ) override; - -private: - inline LoKi::MCMatch matcher() const { return LoKi::MCMatch( m_matcher ); } - - void addTables() const; - - void addTable( const LHCb::Particle* particle ) const; - - void loadTable( const std::string& address ) const; - - void printMCPIDs( const LHCb::MCParticle::ConstVector& mcps ) const { - always() << "==================================" << endmsg; - for ( LHCb::MCParticle::ConstVector::const_iterator mcp = mcps.begin(); mcp != mcps.end(); ++mcp ) { - always() << "\tMCP PID " << ( *mcp )->particleID().pid() << endmsg; - } - } - - /** Returns the full location of the given object in the Data Store - * - * @param pObj Data object - * - * @return Location of given data object - */ - inline std::string objectLocation( const DataObject* pObj ) const { - return ( !pObj ? "Null DataObject !" : ( pObj->registry() ? pObj->registry()->identifier() : "UnRegistered" ) ); - } - -private: - LoKi::IReporter* m_reporter; - LoKi::MCMatchObj* m_matcher; - - typedef std::vector<std::string> Addresses; - Addresses m_tables; - - mutable bool m_loaded; - mutable std::map<std::string, bool> m_pLocDoneMap; -}; - -#endif // MCMATCHOBJP2MCPRELATOR_H diff --git a/Phys/Particle2MCTruth/src/P2MCRelatorAlg.cpp b/Phys/Particle2MCTruth/src/P2MCRelatorAlg.cpp deleted file mode 100644 index e02bab8ddeca298fb36288282e5c62cb8b370246..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/src/P2MCRelatorAlg.cpp +++ /dev/null @@ -1,101 +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 - -// local -#include "P2MCRelatorAlg.h" - -//----------------------------------------------------------------------------- -// Implementation file for class : P2MCRelatorAlg -// -// 2009-04-16 : Juan PALACIOS -//----------------------------------------------------------------------------- - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -P2MCRelatorAlg::P2MCRelatorAlg( const std::string& name, ISvcLocator* pSvcLocator ) - : GaudiAlgorithm( name, pSvcLocator ) - , m_mcpLocation( LHCb::MCParticleLocation::Default ) - , m_p2mcp( NULL ) - , m_p2mcpType( "MCMatchObjP2MCRelator" ) { - declareProperty( "ParticleLocations", m_particleLocations ); - declareProperty( "MCParticleLocation", m_mcpLocation ); - declareProperty( "IP2MCP", m_p2mcpType ); - // setProperty( "OutputLevel", 2 ); -} - -//============================================================================= -// Destructor -//============================================================================= -P2MCRelatorAlg::~P2MCRelatorAlg() {} - -//============================================================================= -// Initialization -//============================================================================= -StatusCode P2MCRelatorAlg::initialize() { - const StatusCode sc = GaudiAlgorithm::initialize(); - if ( sc.isFailure() ) return sc; - - m_p2mcp = tool<IP2MCP>( m_p2mcpType, "MCMatcherForP2MCRelatorAlg" ); - - return sc; -} - -//============================================================================= -// Main execution -//============================================================================= -StatusCode P2MCRelatorAlg::execute() { - if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Execute" << endmsg; - - m_mcParticles = getIfExists<LHCb::MCParticle::Container>( m_mcpLocation, false ); - if ( !m_mcParticles ) { return Warning( "Found no MCParticles in " + m_mcpLocation, StatusCode::SUCCESS, 0 ); } - - // Clear the tables - m_tables.clear(); - - // Create and fill the tables - typedef std::vector<std::string> StringVector; - for ( StringVector::const_iterator iLoc = m_particleLocations.begin(); iLoc != m_particleLocations.end(); ++iLoc ) { - const LHCb::Particle::Range particles = getIfExists<LHCb::Particle::Range>( *iLoc ); - if ( !particles.empty() ) { i_particleLoop( particles.begin(), particles.end() ); } - } - - // Loop over the final saved tables and save them - for ( Tables::iterator iT = m_tables.begin(); iT != m_tables.end(); ++iT ) { - ( *iT ).second.i_sort(); - Particle2MCParticle::Table* table = new Particle2MCParticle::Table( ( *iT ).second ); - put( table, ( *iT ).first ); - } - - return StatusCode::SUCCESS; -} - -//============================================================================= - -std::string P2MCRelatorAlg::relationsLocation( const DataObject* pObj ) const { - // Get the parent container TES location - std::string pLoc = objectLocation( pObj ); - if ( pLoc.empty() ) { return pLoc; } - - // Form the relations TES location for this location - boost::replace_all( pLoc, "/Particles", "/P2MCPRelations" ); - - // return the new location - return pLoc; -} - -//============================================================================= - -// Declaration of the Algorithm Factory -DECLARE_COMPONENT( P2MCRelatorAlg ) - -//============================================================================= diff --git a/Phys/Particle2MCTruth/src/P2MCRelatorAlg.h b/Phys/Particle2MCTruth/src/P2MCRelatorAlg.h deleted file mode 100644 index e61fabf7494febb66b8440b73aa4cbd609ed9948..0000000000000000000000000000000000000000 --- a/Phys/Particle2MCTruth/src/P2MCRelatorAlg.h +++ /dev/null @@ -1,117 +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 P2MCRELATORALG_H -#define P2MCRELATORALG_H 1 - -// from Gaudi -#include "GaudiAlg/GaudiAlgorithm.h" -// from LHCb -#include "Kernel/Particle2MCParticle.h" -// from P2MCP -#include "P2MCP/IP2MCP.h" -// boost -#include "boost/algorithm/string.hpp" - -/** @class P2MCRelatorAlg P2MCRelatorAlg.h - * - * GaudiAlgorithm that takes an MCParticle and Particle location, and uses - * an IP2MCP to create a Particle2MCParticle::Table of associations between - * Particles and MCParticles that pass IP2MCP::isMatched. - * The relations table is written to the parent of ParticleLocation + "P2MCPRelations". - * - * <b> Properties</b> - * - * ParticleLocations: TES location of input LHCb::Particles - * - * MCParticleLocation: TES location of input LHCb::Particles. Default: LHCb::MCParticleLocation::Default - * - * IP2MCP: Implementation name of IP2MCP interface. Default: MCMatchObjP2MCRelator - * - * <b>Example</b>: Create relations table for LHCb::MCParticles associated to - * LHCb::Particles in "Phys/DC06selBd2Jpsi2MuMu_Kst2KPi/Particles". Table is - * written to "Phys/DC06selBd2Jpsi2MuMu_Kst2KPi/P2MCPRelations" - * - * @code - * from Configurables import P2MCRelatorAlg - * p2mc = P2MCRelatorAlg() - * p2mc.ParticleLocations = ["Phys/DC06selBd2Jpsi2MuMu_Kst2KPi/Particles"] - * # Add it to a selection sequence - * seq = GaudiSequencer('SeqDC06selBd2Jpsi2MuMu_Kst2KPi') - * seq.Members += [p2mc] - * @endcode - * - * - * @author Juan PALACIOS - * @date 2009-04-16 - */ -class P2MCRelatorAlg : public GaudiAlgorithm { - -public: - /// Standard constructor - P2MCRelatorAlg( const std::string& name, ISvcLocator* pSvcLocator ); - - virtual ~P2MCRelatorAlg(); ///< Destructor - - StatusCode initialize() override; ///< Algorithm initialization - StatusCode execute() override; ///< Algorithm execution - -private: - /** Returns the full location of the given object in the Data Store - * - * @param pObj Data object - * - * @return Location of given data object - */ - inline std::string objectLocation( const DataObject* pObj ) const { - return ( !pObj ? "" : ( pObj->registry() ? pObj->registry()->identifier() : "" ) ); - } - - template <class Iter> - void i_particleLoop( const Iter begin, const Iter end, const std::string level = "" ) { - for ( Iter it = begin; it != end; ++it ) { - if ( msgLevel( MSG::DEBUG ) ) - debug() << level << "-> " << objectLocation( ( *it )->parent() ) << " : key=" << ( *it )->key() - << " PID=" << ( *it )->particleID().pid() << endmsg; - for ( LHCb::MCParticle::Container::const_iterator iMCP = m_mcParticles->begin(); iMCP != m_mcParticles->end(); - ++iMCP ) { - if ( m_p2mcp->isMatched( *it, *iMCP ) ) { - // Get the TES location for the relations for this Particle - const std::string pLoc = relationsLocation( ( *it )->parent() ); - if ( msgLevel( MSG::DEBUG ) ) - debug() << level << " -> Found MCMatch : key=" << ( *iMCP )->key() - << " MCPID=" << ( *iMCP )->particleID().pid() << " : Filling " << pLoc << endmsg; - if ( !pLoc.empty() ) { - // Fill table for this location - m_tables[pLoc].i_push( *it, *iMCP ); - } else { - Warning( "Particle parent not in the TES" ).ignore(); - } - } - } - // Recursively save the relations for the daughters - const SmartRefVector<LHCb::Particle>& daughters = ( *it )->daughters(); - if ( !daughters.empty() ) { i_particleLoop( daughters.begin(), daughters.end(), level + " " ); } - } - } - - std::string relationsLocation( const DataObject* pObj ) const; - -private: - std::vector<std::string> m_particleLocations; - std::string m_mcpLocation; - IP2MCP* m_p2mcp; - std::string m_p2mcpType; - typedef std::map<std::string, Particle2MCParticle::LightTable> Tables; - Tables m_tables; - LHCb::MCParticle::Container* m_mcParticles; -}; - -#endif // P2MCRELATORALG_H