From 3318b745d2708b7e09573d96512be98cbb14a3ac Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <fwinkl@cern> Date: Tue, 10 Nov 2020 15:38:01 +0100 Subject: [PATCH] AnalysisTest: delete obsolete package None of this code seems relevant anymore and most of it is likely broken. --- .../AnalysisTest/AnalysisTest/NavTest.h | 36 - .../AnalysisTest/ReadConstituent.h | 62 -- .../AnalysisTest/ReadConstituent.icc | 124 --- .../AnalysisTest/AnalysisTest/ReadElectron.h | 31 - .../AnalysisTest/ReadINav4MomAssocs.h | 103 --- .../AnalysisTest/AnalysisTest/ReadMuon.h | 31 - .../AnalysisTest/AnalysisTest/ReadParticle.h | 59 -- .../AnalysisTest/ReadParticle.icc | 107 --- .../AnalysisTest/AnalysisTest/ReadPhoton.h | 31 - .../AnalysisTest/AnalysisTest/ReadTauJet.h | 31 - .../AnalysisTest/ReadTrackParticle.h | 40 - .../AnalysisTest/AnalysisTest/ReadTrigger.h | 36 - .../AnalysisTest/ReadTruthParticle.h | 31 - .../AnalysisTest/ReadVxContainer.h | 40 - .../AnalysisTest/AnalysisTest/Readegamma.h | 40 - .../AnalysisTest/WriteINav4MomAssocs.h | 114 --- .../AnalysisTest/CMakeLists.txt | 48 -- .../AnalysisTest/doc/packagedoc.h | 28 - .../AnalysisTest/share/AODTest_topOptions.py | 116 --- .../share/AODTriggerRead_topOptions.py | 35 - .../share/AODTriggerWrite_topOptions.py | 58 -- .../AnalysisTest/share/BJetCBNT_jobOptions.py | 49 -- .../share/EventTagTest_topOptions.py | 79 -- .../AnalysisTest/share/NavTest_topOptions.py | 23 - .../share/ReadINav4MomAssocs_jobOptions.py | 122 --- .../share/WriteINav4MomAssocs_jobOptions.py | 131 --- .../AnalysisTest/src/NavTest.cxx | 79 -- .../AnalysisTest/src/ReadElectron.cxx | 7 - .../AnalysisTest/src/ReadINav4MomAssocs.cxx | 87 -- .../AnalysisTest/src/ReadMuon.cxx | 7 - .../AnalysisTest/src/ReadPhoton.cxx | 7 - .../AnalysisTest/src/ReadTauJet.cxx | 7 - .../AnalysisTest/src/ReadTrackParticle.cxx | 17 - .../AnalysisTest/src/ReadTrigger.cxx | 85 -- .../AnalysisTest/src/ReadTruthParticle.cxx | 7 - .../AnalysisTest/src/ReadVxContainer.cxx | 17 - .../AnalysisTest/src/Readegamma.cxx | 41 - .../AnalysisTest/src/WriteINav4MomAssocs.cxx | 136 ---- .../src/components/AnalysisTest_entries.cxx | 29 - .../AnalysisTest/test/AnalysisTest.sh | 13 - .../test/AssocFilterTest_CppUnit.cxx | 462 ----------- .../test/CategoryIdFilterTest_CppUnit.cxx | 765 ------------------ .../test/ChargeFilterTest_CppUnit.cxx | 163 ---- .../test/DecayParserTest_CppUnit.cxx | 122 --- .../test/FilterRangeTest_CppUnit.cxx | 286 ------- .../test/IParticleAssocFilterTest_CppUnit.cxx | 507 ------------ .../test/McVtxFilterTest_CppUnit.cxx | 712 ---------------- .../test/MomentumFilterTest_CppUnit.cxx | 664 --------------- .../test/PdgIdFilterTest_CppUnit.cxx | 247 ------ 49 files changed, 6072 deletions(-) delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/NavTest.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.icc delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadElectron.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadINav4MomAssocs.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadMuon.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.icc delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadPhoton.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTauJet.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrackParticle.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrigger.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTruthParticle.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadVxContainer.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/Readegamma.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/WriteINav4MomAssocs.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/doc/packagedoc.h delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTest_topOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerRead_topOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerWrite_topOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/BJetCBNT_jobOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/EventTagTest_topOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/NavTest_topOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/ReadINav4MomAssocs_jobOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/WriteINav4MomAssocs_jobOptions.py delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/NavTest.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadElectron.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadINav4MomAssocs.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadMuon.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadPhoton.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTauJet.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrackParticle.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrigger.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTruthParticle.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadVxContainer.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/Readegamma.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/WriteINav4MomAssocs.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/components/AnalysisTest_entries.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AnalysisTest.sh delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AssocFilterTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/CategoryIdFilterTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/ChargeFilterTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/DecayParserTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/FilterRangeTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/IParticleAssocFilterTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/MomentumFilterTest_CppUnit.cxx delete mode 100644 PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/NavTest.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/NavTest.h deleted file mode 100644 index 9b70c40f073..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/NavTest.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_NAVTEST_H -#define ANALYSISTEST_NAVTEST_H - -/* - test for navigation - - @author Tadashi Maeno -*/ - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/NTuple.h" - -///////////////////////////////////////////////////////////////////////////// - -class NavTest : public AthAlgorithm -{ -public: - NavTest (const std::string& name, ISvcLocator* pSvcLocator); - ~NavTest () {} - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.h deleted file mode 100644 index 189b337fd0f..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READCONSTITUENT_H -#define ANALYSISTEST_READCONSTITUENT_H - -/* - templated Read constituent - - @author Tadashi Maeno -*/ - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/NTuple.h" - -///////////////////////////////////////////////////////////////////////////// - -template <class CONT> -class ReadConstituent : public AthAlgorithm -{ -public: - ReadConstituent (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~ReadConstituent () {} - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - -protected: - - StatusCode accessNtuple(); - - NTuple::Tuple* m_ntuplePtr; - - // Container key - std::string m_ContainerName; - - // prefix for Ntuple - std::string m_prefix; - - // Ntuple ID - std::string m_NtupleLocID; - - // Define variables in the Ntuple: - - NTuple::Item<long> m_nCon; - - // user defined action - virtual StatusCode userInit() { return StatusCode::SUCCESS; } - virtual StatusCode userExec(const typename CONT::base_value_type *) { return StatusCode::SUCCESS; } -}; - -#include "AnalysisTest/ReadConstituent.icc" - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.icc b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.icc deleted file mode 100644 index 2858398f07c..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadConstituent.icc +++ /dev/null @@ -1,124 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - - -static const int MAX_nCon = 128; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class CONT> inline -ReadConstituent<CONT>::ReadConstituent(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_ntuplePtr(nullptr), - m_ContainerName("") -{ - // Declare the properties - declareProperty("NtupleLocID", m_NtupleLocID); - declareProperty("ContainerName",m_ContainerName); - declareProperty("NtuplePrefix", m_prefix); -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class CONT> inline -StatusCode ReadConstituent<CONT>::initialize() -{ - ATH_MSG_DEBUG ("in initialize()"); - - StatusCode sc; - - // access Ntuple - sc = accessNtuple(); - if (sc.isFailure()) - { - ATH_MSG_ERROR ("accessNtuple has failed !"); - return StatusCode::FAILURE; - } - - // add items - sc = m_ntuplePtr -> addItem (m_prefix+"/nCon", m_nCon, 0, MAX_nCon); - - if (sc.isFailure()) - { - ATH_MSG_ERROR ("Could not add items to column wise ntuple"); - return StatusCode::FAILURE; - } - - sc = userInit(); - return sc; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class CONT> inline -StatusCode ReadConstituent<CONT>::execute() -{ - ATH_MSG_DEBUG ("in execute()"); - - StatusCode sc; - - // Retrieve presistified container - CONT * pCont; - sc =evtStore()->retrieve(pCont,m_ContainerName); - if (sc.isFailure()) - { - ATH_MSG_FATAL ("Container \""+m_ContainerName+"\" could not be retrieved from StoreGate !"); - return StatusCode::FAILURE; - } - - - ATH_MSG_DEBUG ("Container->size() : " << pCont->size()); - - m_nCon = 0; - - // loop over constituents - typename CONT::const_iterator itP = pCont->begin(); - typename CONT::const_iterator itPe = pCont->end(); - for (; itP != itPe; ++itP) - { - if (m_nCon >= MAX_nCon) break; - - ATH_CHECK(userExec(*itP)); - - ++m_nCon; - } - - ATH_MSG_DEBUG ("execute() completed"); - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class CONT> inline -StatusCode ReadConstituent<CONT>::finalize() -{ - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class CONT> inline -StatusCode ReadConstituent<CONT>::accessNtuple() -{ - m_NtupleLocID = "/NTUPLES" + m_NtupleLocID ; - - //try to access it - NTuplePtr nt(ntupleSvc(), m_NtupleLocID ); - - if (static_cast<int>(nt)) - { - m_ntuplePtr=nt; - ATH_MSG_INFO ("Ntuple " << m_NtupleLocID << " reaccessed! "); - } - else - { - ATH_MSG_FATAL ("Cannot reaccess " << m_NtupleLocID); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadElectron.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadElectron.h deleted file mode 100644 index ed8430c5f50..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadElectron.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READELECTRON_H -#define ANALYSISTEST_READELECTRON_H - -/* - Read Electron - - @author Tadashi Maeno -*/ - -#include "AnalysisTest/ReadParticle.h" -#include "egammaEvent/ElectronContainer.h" - -class ReadElectron : public ReadParticle<ElectronContainer> -{ -public: - ReadElectron (const std::string& name, ISvcLocator* pSvcLocator) - : ReadParticle<ElectronContainer> (name, pSvcLocator) {} -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadINav4MomAssocs.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadINav4MomAssocs.h deleted file mode 100644 index e04cb8af9af..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadINav4MomAssocs.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// ReadINav4MomAssocs.h -// Header file for class ReadINav4MomAssocs -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef ANALYSISTEST_READINAV4MOMASSOCS_H -#define ANALYSISTEST_READINAV4MOMASSOCS_H - -/** Algorithm to test persistency of INav4MomAssocs class - */ - -// STL includes - -// FrameWork includes -#include "AthenaBaseComps/AthAlgorithm.h" - -#include "AthenaKernel/ClassName.h" - -class ReadINav4MomAssocs : public AthAlgorithm -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - // Copy constructor: - - /// Constructor with parameters: - ReadINav4MomAssocs( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~ReadINav4MomAssocs(); - - // Assignment operator: - //ReadINav4MomAssocs &operator=(const ReadINav4MomAssocs &alg); - - // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Protected method: - /////////////////////////////////////////////////////////////////// - protected: - - template <typename ASSOCS> - StatusCode readAssocs( const std::string assocsName ) const; - - /////////////////////////////////////////////////////////////////// - // Protected data: - /////////////////////////////////////////////////////////////////// - protected: - - /// Default constructor: - ReadINav4MomAssocs(); - - // Containers - - /** Input location of INav4MomAssocs container - */ - StringProperty m_inavAssocsName; - -}; - -/// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -/// Inline methods: -/////////////////////////////////////////////////////////////////// -template <typename ASSOCS> -StatusCode ReadINav4MomAssocs::readAssocs( const std::string assocsName ) const -{ - const ASSOCS * assocs = 0; - ATH_CHECK( evtStore()->retrieve( assocs, assocsName ) ); - - typename ASSOCS::object_iterator objEnd = assocs->endObject(); - for ( typename ASSOCS::object_iterator objItr = assocs->beginObject(); - objItr != objEnd; - ++objItr ) { - ATH_MSG_INFO - ( "--> e= " << (*objItr)->e() - << "\tnAssocs= " << assocs->getNumberOfAssociations(objItr) ) ; - } - - return StatusCode::SUCCESS; -} - -#endif //> ANALYSISTEST_READINAV4MOMASSOCS_H diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadMuon.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadMuon.h deleted file mode 100644 index c4da3f6e512..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadMuon.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READMUON_H -#define ANALYSISTEST_READMUON_H - -/* - Read Muons - - @author Tadashi Maeno -*/ - -#include "AnalysisTest/ReadParticle.h" -#include "muonEvent/MuonContainer.h" - -class ReadMuon : public ReadParticle<Analysis::MuonContainer> -{ -public: - ReadMuon (const std::string& name, ISvcLocator* pSvcLocator) - : ReadParticle<Analysis::MuonContainer> (name, pSvcLocator) {} -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.h deleted file mode 100644 index bf839887165..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READPARTICLE_H -#define ANALYSISTEST_READPARTICLE_H - -/* - templated Read Particle - - @author Tadashi Maeno -*/ - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/NTuple.h" - -///////////////////////////////////////////////////////////////////////////// - -template <class PARTICLE> -class ReadParticle : public AthAlgorithm -{ -public: - ReadParticle (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~ReadParticle () {} - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - -protected: - - StatusCode accessNtuple(); - - NTuple::Tuple* m_ntuplePtr; - - // Container key - std::string m_ContainerName; - - // prefix for Ntuple - std::string m_prefix; - - // Ntuple ID - std::string m_NtupleLocID; - - // Define variables in the Ntuple: - - NTuple::Item<long> m_nParticle; - NTuple::Array<double> m_pt; -}; - -#include "AnalysisTest/ReadParticle.icc" - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.icc b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.icc deleted file mode 100644 index 49f943353a9..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadParticle.icc +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -static const int MAX_nParticle = 128; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class PARTICLE> inline -ReadParticle<PARTICLE>::ReadParticle(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_ntuplePtr(nullptr), - m_ContainerName("") -{ - // Declare the properties - declareProperty("NtupleLocID", m_NtupleLocID); - declareProperty("ContainerName",m_ContainerName); - declareProperty("NtuplePrefix", m_prefix); -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class PARTICLE> inline -StatusCode ReadParticle<PARTICLE>::initialize() -{ - ATH_MSG_DEBUG ( "in initialize()" ) ; - - ATH_CHECK( accessNtuple() ); - - // add items - ATH_CHECK( m_ntuplePtr -> addItem (m_prefix+"/nParticle", m_nParticle, 0, MAX_nParticle) ); - ATH_CHECK( m_ntuplePtr -> addItem (m_prefix+"/pt", m_nParticle, m_pt) ); - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class PARTICLE> inline -StatusCode ReadParticle<PARTICLE>::execute() -{ - ATH_MSG_DEBUG ( "in execute()" ) ; - - // Retrieve presistified container - const PARTICLE * pCont = nullptr; - ATH_CHECK( evtStore()->retrieve(pCont,m_ContainerName) ); - - ATH_MSG_DEBUG ( "Container->size() : " << pCont->size() ) ; - - m_nParticle = 0; - - // loop over Particles - typename PARTICLE::const_iterator itP = pCont->begin(); - typename PARTICLE::const_iterator itPe = pCont->end(); - for (; itP != itPe; ++itP) - { - if (m_nParticle >= MAX_nParticle) break; - - // fill IParticle attributes - m_pt [m_nParticle] = (*itP)->pt(); - - ATH_MSG_DEBUG ( MSG::dec - << "#" << m_nParticle - << " pt:" << m_pt[m_nParticle] ) ; - - ++m_nParticle; - } - - ATH_MSG_DEBUG ( "execute() completed" ) ; - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class PARTICLE> inline -StatusCode ReadParticle<PARTICLE>::finalize() -{ - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -template <class PARTICLE> inline -StatusCode ReadParticle<PARTICLE>::accessNtuple() -{ - m_NtupleLocID = "/NTUPLES" + m_NtupleLocID ; - - //try to access it - NTuplePtr nt(ntupleSvc(), m_NtupleLocID ); - - if (static_cast<int>(nt)) - { - m_ntuplePtr=nt; - ATH_MSG_INFO ( "Ntuple " << m_NtupleLocID - << " reaccessed! " ) ; - } - else - { - ATH_MSG_FATAL ( "Cannot reaccess " << m_NtupleLocID ) ; - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadPhoton.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadPhoton.h deleted file mode 100644 index 791a7b0f44d..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadPhoton.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READPHOTON_H -#define ANALYSISTEST_READPHOTON_H - -/* - Read Photon - - @author Tadashi Maeno -*/ - -#include "AnalysisTest/ReadParticle.h" -#include "egammaEvent/PhotonContainer.h" - -class ReadPhoton : public ReadParticle<PhotonContainer> -{ -public: - ReadPhoton (const std::string& name, ISvcLocator* pSvcLocator) - : ReadParticle<PhotonContainer> (name, pSvcLocator) {} -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTauJet.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTauJet.h deleted file mode 100644 index da83cb56671..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTauJet.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READTAUJET_H -#define ANALYSISTEST_READTAUJET_H - -/* - Read TauJets - - @author Tadashi Maeno -*/ - -#include "AnalysisTest/ReadParticle.h" -#include "tauEvent/TauJetContainer.h" - -class ReadTauJet : public ReadParticle<Analysis::TauJetContainer> -{ -public: - ReadTauJet (const std::string& name, ISvcLocator* pSvcLocator) - : ReadParticle<Analysis::TauJetContainer> (name, pSvcLocator) {} -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrackParticle.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrackParticle.h deleted file mode 100644 index 70198295c20..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrackParticle.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READTRACKPARTICLE_H -#define ANALYSISTEST_READTRACKPARTICLE_H - -/* - Read TrackParticle - - @author Tadashi Maeno -*/ - -#include "GaudiKernel/NTuple.h" - -#include "AnalysisTest/ReadConstituent.h" -#include "Particle/TrackParticleContainer.h" - -class ReadTrackParticle : public ReadConstituent<Rec::TrackParticleContainer> -{ -public: - ReadTrackParticle (const std::string& name, ISvcLocator* pSvcLocator) - : ReadConstituent<Rec::TrackParticleContainer> (name, pSvcLocator) {} - ~ReadTrackParticle () {} - -private: - StatusCode userInit(); - StatusCode userExec(const Rec::TrackParticle *val); - - NTuple::Array<double> m_charge; -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrigger.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrigger.h deleted file mode 100644 index e425019ecb0..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTrigger.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READTRIGGER_H -#define ANALYSISTEST_READTRIGGER_H - -/* - Read Trigger - - @author Tadashi Maeno -*/ - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/NTuple.h" - -///////////////////////////////////////////////////////////////////////////// - -class ReadTrigger : public AthAlgorithm -{ -public: - ReadTrigger (const std::string& name, ISvcLocator* pSvcLocator); - ~ReadTrigger () {} - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTruthParticle.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTruthParticle.h deleted file mode 100644 index 0d59f462fbd..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadTruthParticle.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READTRUTHPARTICLE_H -#define ANALYSISTEST_READTRUTHPARTICLE_H - -/* - Read TruthParticles - - @author Tadashi Maeno -*/ - -#include "AnalysisTest/ReadParticle.h" -#include "McParticleEvent/TruthParticleContainer.h" - -class ReadTruthParticle : public ReadParticle<TruthParticleContainer> -{ -public: - ReadTruthParticle (const std::string& name, ISvcLocator* pSvcLocator) - : ReadParticle<TruthParticleContainer> (name, pSvcLocator) {} -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadVxContainer.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadVxContainer.h deleted file mode 100644 index e6bd3f30f2f..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/ReadVxContainer.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READVXCONTAINER_H -#define ANALYSISTEST_READVXCONTAINER_H - -/* - Read VxContainer - - @author Tadashi Maeno -*/ - -#include "GaudiKernel/NTuple.h" - -#include "AnalysisTest/ReadConstituent.h" -#include "VxVertex/VxContainer.h" - -class ReadVxContainer : public ReadConstituent<VxContainer> -{ -public: - ReadVxContainer (const std::string& name, ISvcLocator* pSvcLocator) - : ReadConstituent<VxContainer> (name, pSvcLocator) {} - ~ReadVxContainer () {} - -private: - StatusCode userInit(); - StatusCode userExec(const Trk::VxCandidate *val); - - NTuple::Array<double> m_chi2; -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/Readegamma.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/Readegamma.h deleted file mode 100644 index 44b734cd491..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/Readegamma.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISTEST_READEGAMMA_H -#define ANALYSISTEST_READEGAMMA_H - -/* - Read egamma - - @author Tadashi Maeno -*/ - -#include "GaudiKernel/NTuple.h" - -#include "AnalysisTest/ReadConstituent.h" -#include "egammaEvent/egammaContainer.h" - -class Readegamma : public ReadConstituent<egammaContainer> -{ -public: - Readegamma (const std::string& name, ISvcLocator* pSvcLocator) - : ReadConstituent<egammaContainer> (name, pSvcLocator) {} - ~Readegamma () {} - -private: - StatusCode userInit(); - StatusCode userExec(const egamma *val); - - NTuple::Array<double> m_e; -}; - -#endif - - - - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/WriteINav4MomAssocs.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/WriteINav4MomAssocs.h deleted file mode 100644 index 7f5f1cc4b97..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/AnalysisTest/WriteINav4MomAssocs.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// WriteINav4MomAssocs.h -// Header file for class WriteINav4MomAssocs -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef ANALYSISTEST_WRITEINAV4MOMASSOCS_H -#define ANALYSISTEST_WRITEINAV4MOMASSOCS_H - -/** Algorithm to test persistency of INav4MomAssocs class - */ - -// STL includes -#include <string> - - -// FrameWork includes -#include "AthenaBaseComps/AthAlgorithm.h" - -#include "AthenaKernel/ClassName.h" - -// NqvFourMom includes -#include "NavFourMom/INavigable4MomentumCollection.h" - -class WriteINav4MomAssocs : public AthAlgorithm -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - // Copy constructor: - - /// Constructor with parameters: - WriteINav4MomAssocs( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~WriteINav4MomAssocs(); - - // Assignment operator: - //WriteINav4MomAssocs &operator=(const WriteINav4MomAssocs &alg); - - // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Protected methods: - /////////////////////////////////////////////////////////////////// - protected: - - template < typename INCOLL, typename OUTCOLL > - StatusCode symLink( const std::string& collName ) const; - - StatusCode buildAssocs( const INavigable4MomentumCollection * coll1, - const INavigable4MomentumCollection * coll2 ) const; - - /////////////////////////////////////////////////////////////////// - // Protected data: - /////////////////////////////////////////////////////////////////// - protected: - - /// Default constructor: - WriteINav4MomAssocs(); - - // Containers - - /** Input location for ParticleJet container - */ - std::string m_jetsName; - - /** Input location for Electron container - */ - std::string m_electronsName; - - /** Output location for INav4MomAssocs container - */ - std::string m_inavAssocsOutputName; - -}; - -/// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -/// Inline methods: -/////////////////////////////////////////////////////////////////// - -template < typename INCOLL, typename OUTCOLL > -StatusCode WriteINav4MomAssocs::symLink( const std::string& collName ) const -{ - const INCOLL * inColl = 0; - ATH_CHECK ( evtStore()->retrieve( inColl, collName ) ); - - const OUTCOLL * outColl = 0; - ATH_CHECK ( evtStore()->symLink( inColl, outColl ) ); - - return StatusCode::SUCCESS; -} - -#endif //> ANALYSISTEST_WRITEINAV4MOMASSOCS_H diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt deleted file mode 100644 index 5e99eea7a1f..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -################################################################################ -# Package: AnalysisTest -################################################################################ - -# Declare the package name: -atlas_subdir( AnalysisTest ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - Control/StoreGate - Event/NavFourMom - GaudiKernel - PhysicsAnalysis/TruthParticleID/McParticleEvent - Reconstruction/MuonIdentification/muonEvent - Reconstruction/Particle - Reconstruction/egamma/egammaEvent - Reconstruction/tauEvent - Tracking/TrkEvent/VxVertex - PRIVATE - AtlasTest/TestTools - Control/AthenaBaseComps - Control/AthenaKernel - Event/EventKernel - Event/FourMom - Generators/GeneratorObjects - PhysicsAnalysis/AnalysisCommon/AnalysisAssociation - PhysicsAnalysis/AnalysisCommon/AnalysisUtils - PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent - PhysicsAnalysis/TruthParticleID/McParticleUtils - Reconstruction/Jet/JetEvent - Generators/AtlasHepMC ) - -# External dependencies: -find_package( CLHEP ) -find_package( CppUnit ) - -# Component(s) in the package: -atlas_add_component( AnalysisTest - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} - LINK_LIBRARIES AtlasHepMCLib ${CLHEP_LIBRARIES} ${CPPUNIT_LIBRARIES} AthContainers StoreGateLib SGtests NavFourMom GaudiKernel McParticleEvent muonEvent Particle egammaEvent tauEvent VxVertex TestTools AthenaBaseComps AthenaKernel EventKernel FourMom GeneratorObjects AnalysisAssociation AnalysisUtilsLib AnalysisTriggerEvent McParticleUtils JetEvent ) - -# Install files from the package: -atlas_install_headers( AnalysisTest ) -atlas_install_joboptions( share/*.py ) - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/doc/packagedoc.h b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/doc/packagedoc.h deleted file mode 100644 index 0980d50ba99..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/doc/packagedoc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** -@page AnalysisTest_page AnalysisTest - -@section AnalysisTest_introductionAnalysisTest Introduction -This package contains test algs for AODs - -@section AnalysisTest_packagecontentAnalysisTest Package Contents -AnalysisTest contains the following algs/files: - -- ReadXYZ : a simple alg to retrieve XYZ-object from TDS -- NavTest : test the back-navigation -- CBNT_BJetGeneral -- CBNT_BJetLifetimeTag -- CBNT_BJetSecVtxTag - -- AODTest_topOptions.py : read-test for AOD -- AODTriggerRead_topOptions.py : read-test for Trigger AOD -- AODTriggerWrite_topOptions.py : write-test for Trigger AOD -- EventTagTest_topOptions.py : test for TAG collection -- NavTest_topOptions.py : test for the back-navigation - - - -*/ diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTest_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTest_topOptions.py deleted file mode 100644 index 9d2972ce2e4..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTest_topOptions.py +++ /dev/null @@ -1,116 +0,0 @@ -# read AOD -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) -EventSelector = Service( "EventSelector" ) - -# The AOD input file -EventSelector.InputCollections = [ "AOD.pool.root" ] -#EventSelector.InputCollections = [ "reconstruction.root" ] - -# POOL converters -include( "LArAthenaPool/LArAthenaPool_joboptions.py" ) -include( "TrkEventAthenaPool/TrkEventAthenaPool_joboptions.py" ) -include( "RecAthenaPool/RecAthenaPool_joboptions.py" ) -include( "ParticleEventAthenaPool/ParticleEventAthenaPool_joboptions.py" ) - -# DLLs -theApp.Dlls += [ "CBNT_Athena", "CBNT_Utils" ] -theApp.Dlls += [ "AnalysisTest" ] - -# Algs -theApp.TopAlg += [ "CBNT_Athena/CBNT_AOD" ] -CBNT_AOD = Algorithm( "CBNT_AOD" ) -CBNT_AOD.members = [ - "ReadMuon", - "ReadElectron", - "ReadPhoton", - "ReadBJet", - "ReadParticleJet", - "ReadTauJet", - "ReadTruthParticle", - "ReadTruthParticleJet" -# "ReadTrackParticle" -# "ReadVxContainer" -# "Readegamma" -# "ReadTau" - ] - -# options for Algs -ReadMuon = Algorithm( "ReadMuon" ) -ReadMuon.NtupleLocID = "/FILE1/Muon/100" -ReadMuon.NtuplePrefix = "Muon" -ReadMuon.ContainerName = "MuonCollection" - -ReadElectron = Algorithm( "ReadElectron" ) -ReadElectron.NtupleLocID = "/FILE1/Electron/101" -ReadElectron.NtuplePrefix = "Electron" -ReadElectron.ContainerName = "ElectronCollection" - -ReadPhoton = Algorithm( "ReadPhoton" ) -ReadPhoton.NtupleLocID = "/FILE1/Photon/102" -ReadPhoton.NtuplePrefix = "Photon" -ReadPhoton.ContainerName = "PhotonCollection" - -ReadBJet = Algorithm( "ReadBJet" ) -ReadBJet.NtupleLocID = "/FILE1/BJet/103" -ReadBJet.NtuplePrefix = "BJet" -ReadBJet.ContainerName = "BCandidates" - -ReadParticleJet = Algorithm( "ReadParticleJet" ) -ReadParticleJet.NtupleLocID = "/FILE1/ParticleJet/104" -ReadParticleJet.NtuplePrefix = "ParticleJet" -ReadParticleJet.ContainerName = "ParticleJetContainer" - -ReadTauJet = Algorithm( "ReadTauJet" ) -ReadTauJet.NtupleLocID = "/FILE1/TauJet/105" -ReadTauJet.NtuplePrefix = "TauJet" -ReadTauJet.ContainerName = "TauJetCollection" - -ReadTruthParticle = Algorithm( "ReadTruthParticle" ) -ReadTruthParticle.NtupleLocID = "/FILE1/TruthParticle/106" -ReadTruthParticle.NtuplePrefix = "TruthParticle" -ReadTruthParticle.ContainerName = "SpclMC" - -ReadTruthParticleJet = Algorithm( "ReadTruthParticleJet" ) -ReadTruthParticleJet.NtupleLocID = "/FILE1/TruthParticleJet/107" -ReadTruthParticleJet.NtuplePrefix = "TruthParticleJet" -ReadTruthParticleJet.ContainerName = "TruthParticleJetContainer" - -ReadTrackParticle = Algorithm( "ReadTrackParticle" ) -ReadTrackParticle.NtupleLocID = "/FILE1/TrackParticle/108" -ReadTrackParticle.NtuplePrefix = "TrackParticle" -ReadTrackParticle.ContainerName = "TrackParticleCandidate" #"MooreTrackParticles" - -ReadTau = Algorithm( "ReadTau" ) -ReadTau.NtupleLocID = "/FILE1/tauContainer/109" -ReadTau.NtuplePrefix = "tauContainer" -ReadTau.ContainerName = "MYtauContainer" - -ReadVxContainer = Algorithm( "ReadVxContainer" ) -ReadVxContainer.NtupleLocID = "/FILE1/Vx/110" -ReadVxContainer.NtuplePrefix = "Vx" -ReadVxContainer.ContainerName = "VxPrimaryCandidate" - -Readegamma = Algorithm( "Readegamma" ) -Readegamma.NtupleLocID = "/FILE1/egamma/111" -Readegamma.NtuplePrefix = "egamma" -Readegamma.ContainerName = "egammaCollection" - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -MessageSvc = Service( "MessageSvc" ) -MessageSvc.OutputLevel = INFO - -# message level for ReadXYZ -#ReadMuon.OutputLevel = DEBUG -#ReadElectron.OutputLevel = DEBUG - -# Number of Events to process -theApp.EvtMax = 1000000 - -# Root Ntuple output -theApp.Dlls += [ "RootHistCnv" ] -theApp.HistogramPersistency = "ROOT" -NTupleSvc = Service( "NTupleSvc" ) -NTupleSvc.Output = [ "FILE1 DATAFILE='AODTest.root' OPT='NEW'" ] -HistogramPersistencySvc = Service( "HistogramPersistencySvc" ) -HistogramPersistencySvc.OutputFile = "hist.root"; - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerRead_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerRead_topOptions.py deleted file mode 100644 index eb8f7435aa2..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerRead_topOptions.py +++ /dev/null @@ -1,35 +0,0 @@ -# read AOD -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) -EventSelector = Service( "EventSelector" ) - -# The AOD input file -EventSelector.InputCollections = [ "AOD_Trigger.root" ] - -# POOL converters -include( "AnalysisTriggerEventAthenaPool/AnalysisTriggerEventAthenaPool_joboptions.py" ) - -# DLLs -theApp.Dlls += [ "AnalysisTest" ] - -# Algs -theApp.TopAlg += [ "ReadTrigger" ] - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -MessageSvc = Service( "MessageSvc" ) -MessageSvc.OutputLevel = INFO - -# message level for ReadXYZ -ReadTrigger = Algorithm( "ReadTrigger" ) -ReadTrigger.OutputLevel = DEBUG - -# Number of Events to process -theApp.EvtMax = 1000000 - -# Root Ntuple output -theApp.Dlls += [ "RootHistCnv" ] -theApp.HistogramPersistency = "ROOT" -NTupleSvc = Service( "NTupleSvc" ) -NTupleSvc.Output = [ "FILE1 DATAFILE='AODTest.root' OPT='NEW'" ] -HistogramPersistencySvc = Service( "HistogramPersistencySvc" ) -HistogramPersistencySvc.OutputFile = "hist.root"; - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerWrite_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerWrite_topOptions.py deleted file mode 100644 index 0ccd06b6861..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/AODTriggerWrite_topOptions.py +++ /dev/null @@ -1,58 +0,0 @@ -# read Pool -include("AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py") - -# Pool Converters -include("EventAthenaPool/EventAthenaPool_joboptions.py") -include("TrigT1EventAthenaPool/TrigT1EventAthenaPool_joboptions.py") -include("AnalysisTriggerEventAthenaPool/AnalysisTriggerEventAthenaPool_joboptions.py") - -# input -EventSelector = Service( "EventSelector" ) -#EventSelector.InputCollections = [ "/afs/cern.ch/atlas/offline/data/testfile/dc2.002867.pyt_z_ee.g4dig802._0001.pool.root" ] -EventSelector.InputCollections = [ "rfio:/castor/cern.ch/atlas/project/dc2/preprod/g4dig805/dc2.002883.pyt_z_mumu.g4dig805/data/dc2.002883.pyt_z_mumu.g4dig805._0001.pool.root" ] - -# LVL1 config -include("TrigT1Config/TrigT1ConfigJobOptions.py") -L1Config = Service( "L1Config" ) -L1Config.triggerMenuFileLocation = "LVL1triggermenuDC2.xml" -L1Config.thresholdListFileLocation = "LVL1triggerthresholdsDC2.xml" - -# for RecMuonRoI svc -DetDescrCnvSvc = Service( "DetDescrCnvSvc" ) -DetDescrCnvSvc.DecodeIdDict = TRUE -DetDescrCnvSvc.ReadFromNova = TRUE -include ( "AtlasGeoModel/GeoModelCommon.py" ) -include ( "AmdcAth/AmdcAth_jobOptions.py" ) -include ( "AtlasGeoModel/MuonGeoModel.py" ) -include ( "MuonByteStreamCnvTest/MuonRdoDigit_jobOptions.py" ) -include ( "TrigT1TGCRecRoiSvc/TrigT1TGCRecRoiSvcJobOptions.py" ) -theApp.Dlls += ["TrigT1RPCRecRoiSvc"] -theApp.ExtSvc += ["LVL1RPC::RPCRecRoiSvc"] - -# RoIB result to AOD conversion -include("AnalysisTriggerAlgs/AnalysisTrigger_jobOptions.py") - -# write to Pool -theApp.OutStream += [ "Stream1" ] -theApp.OutStreamType = "AthenaOutputStream" -Stream1 = Algorithm( "Stream1" ) -Stream1.EvtConversionSvc = "AthenaPoolCnvSvc" - -# Output file name -Stream1.OutputFile = "AOD_Trigger.root" - -# Item list -Stream1.ItemList+=["EventInfo#*"] -Stream1.ItemList+=["CTP_Decision#*"] -Stream1.ItemList+=["LVL1_ROI#*"] - -# Message level -MessageSvc = Service( "MessageSvc" ) -MessageSvc.OutputLevel = INFO - -RoIBResultToAOD = Algorithm( "RoIBResultToAOD" ) -RoIBResultToAOD.OutputLevel = DEBUG - -# Number of events to be processed -theApp.EvtMax = 10 - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/BJetCBNT_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/BJetCBNT_jobOptions.py deleted file mode 100644 index d6f9ebd3e1a..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/BJetCBNT_jobOptions.py +++ /dev/null @@ -1,49 +0,0 @@ -#-------------------------------------------------- -# CBNT_BJet -#------------------------------------------------- -theApp.Dlls += [ "AnalysisTest" ] -CBNT_Athena = Algorithm( "CBNT_Athena" ) - -OutputLevel = 3 - -# general BTag CBNT variables -CBNT_Athena.Members += [ "CBNT_BJetGeneral/CBNT_BJetGeneral" ] -CBNT_BJetGeneral = Algorithm( "CBNT_BJetGeneral" ) -CBNT_BJetGeneral.BCandidatesName = "BCandidates" -CBNT_BJetGeneral.OutputLevel = OutputLevel - -# lifetime BTag CBNT variables -if BTaggingAlgsFlags.lifetime1D: - CBNT_Athena.Members += [ "CBNT_BJetLifetimeTag/CBNT_BJetLifetimeTag1D" ] - CBNT_BJetLifetimeTag1D = Algorithm( "CBNT_BJetLifetimeTag1D" ) - CBNT_BJetLifetimeTag1D.BCandidatesName = "BCandidates" - CBNT_BJetLifetimeTag1D.tagMode = "1D" - CBNT_BJetLifetimeTag1D.OutputLevel = OutputLevel -if BTaggingAlgsFlags.lifetime2D: - CBNT_Athena.Members += [ "CBNT_BJetLifetimeTag/CBNT_BJetLifetimeTag2D" ] - CBNT_BJetLifetimeTag2D = Algorithm( "CBNT_BJetLifetimeTag2D" ) - CBNT_BJetLifetimeTag2D.BCandidatesName = "BCandidates" - CBNT_BJetLifetimeTag2D.tagMode = "2D" - CBNT_BJetLifetimeTag2D.OutputLevel = OutputLevel -if BTaggingAlgsFlags.lifetime3D: - CBNT_Athena.Members += [ "CBNT_BJetLifetimeTag/CBNT_BJetLifetimeTag3D" ] - CBNT_BJetLifetimeTag3D = Algorithm( "CBNT_BJetLifetimeTag3D" ) - CBNT_BJetLifetimeTag3D.BCandidatesName = "BCandidates" - CBNT_BJetLifetimeTag3D.tagMode = "3D" - CBNT_BJetLifetimeTag3D.OutputLevel = OutputLevel - -# sec vtx BTag variables -if BTaggingAlgsFlags.secVtxFitBU: - CBNT_Athena.Members += [ "CBNT_BJetSecVtxTag/CBNT_BJetSecVtxTagBU" ] - CBNT_BJetSecVtxTagBU = Algorithm( "CBNT_BJetSecVtxTagBU" ) - CBNT_BJetSecVtxTagBU.BCandidatesName = "BCandidates" - CBNT_BJetSecVtxTagBU.tagMode = "BU" - CBNT_BJetSecVtxTagBU.OutputLevel = OutputLevel -if BTaggingAlgsFlags.secVtxFitTD: - CBNT_Athena.Members += [ "CBNT_BJetSecVtxTag/CBNT_BJetSecVtxTagTD" ] - CBNT_BJetSecVtxTagTD = Algorithm( "CBNT_BJetSecVtxTagTD" ) - CBNT_BJetSecVtxTagTD.BCandidatesName = "BCandidates" - CBNT_BJetSecVtxTagTD.tagMode = "TD" - CBNT_BJetSecVtxTagTD.OutputLevel = OutputLevel - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/EventTagTest_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/EventTagTest_topOptions.py deleted file mode 100644 index 8c1b61f2842..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/EventTagTest_topOptions.py +++ /dev/null @@ -1,79 +0,0 @@ -############################################################### -# -# Job options file -# -#============================================================== - -#-------------------------------------------------------------- -# POOL related services. -#-------------------------------------------------------------- -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) - -PoolSvc = Service( "PoolSvc" ) -PoolSvc.WriteCatalog = "xmlcatalog_file:PoolFileCatalog.xml" - -#-------------------------------------------------------------- -# Event selector. -#-------------------------------------------------------------- -EventSelector = Service( "EventSelector" ) -EventSelector.InputCollections = [ - "AOD.pool.root" - ] - -EventSelector.Query = "n_electron > 2 && e_electron_1 > 20000 && e_electron_2 > 18000" - -#-------------------------------------------------------------- -# POOLconverters -#-------------------------------------------------------------- -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) -include( "LArAthenaPool/LArAthenaPool_joboptions.py" ) -include( "TileEventAthenaPool/TileEventAthenaPool_joboptions.py" ) -include( "TrkEventAthenaPool/TrkEventAthenaPool_joboptions.py" ) -include( "InDetEventAthenaPool/InDetEventAthenaPool_joboptions.py" ) -include( "RecAthenaPool/RecAthenaPool_joboptions.py" ) -include( "ParticleEventAthenaPool/ParticleEventAthenaPool_joboptions.py" ) -include( "AnalysisTriggerEventAthenaPool/AnalysisTriggerEventAthenaPool_joboptions.py" ) - -#-------------------------------------------------------------- -# Load libraries and declare top algorithms. -#-------------------------------------------------------------- -from EventTagAlgs.EventTagGlobal import EventTagGlobal -EventTagGlobal.AttributeList = "SimpleTag" - -include( "EventTagAlgs/EventTag_jobOptions.py" ) - -#-------------------------------------------------------------- -# Event collection registration. -#-------------------------------------------------------------- -# Run OutputStream as an algorithm -theApp.TopAlg += [ "RegistrationStream/RegStream1" ] -RegStream1 = Algorithm( "RegStream1" ) -RegStream1.OutputCollection = "EventTagCollection" -RegStream1.Connection = "" -#RegStream1.Connection = "mysql://CollTester:CtAl_204@atlasdbdev.cern.ch/CollectionTest" -#RegStream1.Connection = "mysql://athena:insider@db1.usatlas.bnl.gov/pool_collection" -# List of DO's to register -RegStream1.ItemList += [ "DataHeader#*" ] -# Key name of AthenaAttributeList used for the tag: -RegStream1.ItemList += [ "AthenaAttributeList#SimpleTag" ] - -#------------------------------------------------------------- -# Event related parameters. -#------------------------------------------------------------- -theApp.EvtMax = 20 - -#-------------------------------------------------------------- -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -#-------------------------------------------------------------- -MessageSvc = Service( "MessageSvc" ) -MessageSvc.OutputLevel = 1 -ClassIDSvc = Service( "ClassIDSvc" ) -ClassIDSvc.OutputLevel = 3 -StoreGateSvc = Service( "StoreGateSvc" ) -StoreGateSvc.Dump = TRUE - -#============================================================== -# -# End of job options file -# -############################################################### diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/NavTest_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/NavTest_topOptions.py deleted file mode 100644 index 3a71e992e3d..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/NavTest_topOptions.py +++ /dev/null @@ -1,23 +0,0 @@ -# read AOD -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) - -EventSelector = Service( "EventSelector" ) - -# The AOD input file -EventSelector.InputCollections = [ "AOD.pool.root" ] - -# POOL converters -include( "LArAthenaPool/LArAthenaPool_joboptions.py" ) -include( "TrkEventAthenaPool/TrkEventAthenaPool_joboptions.py" ) -include( "GeneratorObjectsAthenaPool/GeneratorObjectsAthenaPool_joboptions.py") -include( "RecAthenaPool/RecAthenaPool_joboptions.py" ) -include( "ParticleEventAthenaPool/ParticleEventAthenaPool_joboptions.py" ) - -# DLLs -theApp.Dlls += [ "AnalysisTest" ] - -# Algs -theApp.TopAlg += [ "NavTest" ] - -# number of events to be processed -theApp.EvtMax = 1000000 diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/ReadINav4MomAssocs_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/ReadINav4MomAssocs_jobOptions.py deleted file mode 100644 index 196f8c47d9b..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/ReadINav4MomAssocs_jobOptions.py +++ /dev/null @@ -1,122 +0,0 @@ -############################################################### -# -# Job options file -# -#============================================================== -# -AthenaEventLoopMgr = Service( "AthenaEventLoopMgr" ) - -include( "PartPropSvc/PartPropSvc.py" ) - -#* load relevant libraries -theApp.Dlls += [ "GaudiAlg" ] -theApp.Dlls += [ "GaudiAud" ] -theAuditorSvc = AuditorSvc() -theAuditorSvc.Auditors = [ "ChronoAuditor" ] -theAuditorSvc.Auditors += [ "MemStatAuditor" ] -MemStatAuditor = theAuditorSvc.auditor( "MemStatAuditor" ) -ChronoAuditor = theAuditorSvc.auditor( "ChronoAuditor" ) - -# import the data types -import EventKernel.ParticleDataType - -#-------------------------------------------------------------- -# Event related parameters -#-------------------------------------------------------------- -# Number of events to be processed -if not 'EVTMAX' in dir() : - EVTMAX = -1 - pass -theApp.EvtMax = EVTMAX - -#-------------------------------------------------------------- -# Load POOL support -#-------------------------------------------------------------- -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) -PoolSvc = Service( "PoolSvc" ) - -#-------------------------------------------------------------- -# Define the InputCollections -# There are three types: -# ImplicitROOT (default) - just file with event objects -# ExplicitROOT - ROOT-based collections -# ExplicitMySQL - MySQL-based collections -# E.g. one needs for explicit collection: -# EventSelector.CollectionType = "ExplicitROOT" -# This example uses ImplicitROOT -#-------------------------------------------------------------- -EventSelector = Service( "EventSelector" ) - -EventSelector.InputCollections = [ "assocs.pool.root" ] - -#PoolSvc.ReadCatalog = [ 'xmlcatalog_file:TestCatalog.xml' ] -#PoolSvc.WriteCatalog = 'xmlcatalog_file:TestCatalog.xml' - -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -theApp.ExtSvc += ["AtRndmGenSvc"] - -##################################################### -# ReadINav4MomAssocs -# --> Load and read the INav4MomAssocs content -##################################################### -theApp.Dlls += ["AnalysisTest" ] -theApp.TopAlg += [ "ReadINav4MomAssocs/ReadINav4MomAssocs" ] -ReadINav4MomAssocs = Algorithm( "ReadINav4MomAssocs" ) - -ReadINav4MomAssocs.Assocs = "INav4MomAssocs" -ReadINav4MomAssocs.OutputLevel = VERBOSE - -#-------------------------------------------------------------- -# POOL Persistency -#-------------------------------------------------------------- -# POOL converters -include( "AtlfastAthenaPool/AtlfastAthenaPool_joboptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" ) - -PoolSvc = Service( "PoolSvc" ) - -# Run OutputStream as an algorithm -theApp.TopAlg += [ "AthenaOutputStream/Stream1" ] -# Must make sure that no OutStream's have been declared -theApp.OutStream = []; -# Stream's output file -Stream1 = Algorithm( "Stream1" ) -Stream1.EvtConversionSvc = "AthenaPoolCnvSvc"; -Stream1.OutputFile = "assocs.readback.pool.root" - -# Event Info -Stream1.ItemList += [ "EventInfo#*" ] - -PoolSvc.OutputLevel = WARNING - -############################################################## -# -# Customise OutputLevel -# -############################################################## - -# OUTPUT PRINTOUT LEVEL -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -MessageSvc = Service( "MessageSvc" ) -MessageSvc.useColors = False -MessageSvc.OutputLevel = 3 -MessageSvc.defaultLimit = 4000000 -AthenaEventLoopMgr.OutputLevel = 4 - -MemStatAuditor.OutputLevel = 4 -ChronoAuditor.OutputLevel = 4 - -StoreGateSvc = Service( "StoreGateSvc" ) -#StoreGateSvc.Dump = True; -StoreGateSvc.OutputLevel=3 -#============================================================== -# -# End of job options file -# -############################################################### - - - -# athena AnalysisExamples/produceGenEvents_jobOptions.py && athena -c 'INPUT=["McEvent.root"]; OUTPUT="AOD.pool.root"; EVTMAX=10; ' AssocsRTT/FastSimToAOD_topOptions.py && athena -c 'EVTMAX=10' AnalysisTest/WriteAodAssocs_jobOptions.py && athena AnalysisTest/ReadAodAssocs_jobOptions.py diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/WriteINav4MomAssocs_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/WriteINav4MomAssocs_jobOptions.py deleted file mode 100644 index ca85fcf6d63..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/share/WriteINav4MomAssocs_jobOptions.py +++ /dev/null @@ -1,131 +0,0 @@ -############################################################### -# -# Job options file -# -#============================================================== -# -AthenaEventLoopMgr = Service( "AthenaEventLoopMgr" ) - -include( "PartPropSvc/PartPropSvc.py" ) - -#* load relevant libraries -theApp.Dlls += [ "GaudiAlg" ] -theApp.Dlls += [ "GaudiAud" ] -theAuditorSvc = AuditorSvc() -theAuditorSvc.Auditors = [ "ChronoAuditor" ] -theAuditorSvc.Auditors += [ "MemStatAuditor" ] -MemStatAuditor = theAuditorSvc.auditor( "MemStatAuditor" ) -ChronoAuditor = theAuditorSvc.auditor( "ChronoAuditor" ) - -# import the data types -import EventKernel.ParticleDataType - -#-------------------------------------------------------------- -# Event related parameters -#-------------------------------------------------------------- -# Number of events to be processed -if not 'EVTMAX' in dir() : - EVTMAX = -1 - pass -theApp.EvtMax = EVTMAX - -#-------------------------------------------------------------- -# Load POOL support -#-------------------------------------------------------------- -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) -PoolSvc = Service( "PoolSvc" ) - -#-------------------------------------------------------------- -# Define the InputCollections -# There are three types: -# ImplicitROOT (default) - just file with event objects -# ExplicitROOT - ROOT-based collections -# ExplicitMySQL - MySQL-based collections -# E.g. one needs for explicit collection: -# EventSelector.CollectionType = "ExplicitROOT" -# This example uses ImplicitROOT -#-------------------------------------------------------------- -EventSelector = Service( "EventSelector" ) - -EventSelector.InputCollections = [ "AOD.pool.root" ] - -PoolSvc.ReadCatalog = [ 'xmlcatalog_file:PoolFileCatalog.xml' ] - -PoolSvc.WriteCatalog = 'xmlcatalog_file:PoolFileCatalog.xml' - -print "\n" -print ">>> Input catalog :",PoolSvc.ReadCatalog -print ">>> Output catalog :",PoolSvc.WriteCatalog -print ">>> Input POOL files :",EventSelector.InputCollections -print ">>> EvtMax :",theApp.EvtMax - -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -theApp.ExtSvc += ["AtRndmGenSvc"] - -##################################################### -# WriteINav4MomAssocs -# --> Load and read the INav4MomAssocs content -##################################################### -theApp.Dlls += ["AnalysisTest" ] -theApp.TopAlg += [ "WriteINav4MomAssocs/WriteINav4MomAssocs" ] -WriteINav4MomAssocs = Algorithm( "WriteINav4MomAssocs" ) - -WriteINav4MomAssocs.Electrons = "AtlfastElectronCollection" -WriteINav4MomAssocs.Jets = "AtlfastParticleJetContainer" -WriteINav4MomAssocs.AssocsOutput = "INav4MomAssocs" -WriteINav4MomAssocs.OutputLevel = VERBOSE - -#-------------------------------------------------------------- -# POOL Persistency -#-------------------------------------------------------------- - -include( "AtlfastAthenaPool/AtlfastAthenaPool_joboptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" ) - -PoolSvc = Service( "PoolSvc" ) - -# Run OutputStream as an algorithm -theApp.TopAlg += [ "AthenaOutputStream/Stream1" ] -# Must make sure that no OutStream's have been declared -theApp.OutStream = []; -# Stream's output file -Stream1 = Algorithm( "Stream1" ) -Stream1.EvtConversionSvc = "AthenaPoolCnvSvc"; -Stream1.OutputFile = "assocs.pool.root" - -# Event Info -Stream1.ItemList += [ "EventInfo#*" ] -Stream1.ItemList += [ "INavigable4MomentumCollection#*" ] -Stream1.ItemList += [ "ElectronContainer#*" ] -Stream1.ItemList += [ "ParticleJetContainer#*" ] -Stream1.ItemList += [ "INav4MomAssocs#*" ] - -############################################################## -# -# Customise OutputLevel -# -############################################################## - -# OUTPUT PRINTOUT LEVEL -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -MessageSvc = Service( "MessageSvc" ) -MessageSvc.useColors = False -MessageSvc.OutputLevel = 3 -MessageSvc.defaultLimit = 4000000 -AthenaEventLoopMgr.OutputLevel = 4 - -MemStatAuditor.OutputLevel = 4 -ChronoAuditor.OutputLevel = 4 - -StoreGateSvc = Service( "StoreGateSvc" ) -#StoreGateSvc.Dump = True; -StoreGateSvc.OutputLevel=3 - -#============================================================== -# -# End of job options file -# -############################################################### - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/NavTest.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/NavTest.cxx deleted file mode 100644 index fcac5bc5f8b..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/NavTest.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/NavTest.h" - -#include "egammaEvent/ElectronContainer.h" -#include "GeneratorObjects/McEventCollection.h" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -NavTest::NavTest(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator) -{} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode NavTest::initialize() -{ - ATH_MSG_INFO ( "in initialize()" ) ; - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode NavTest::execute() -{ - ATH_MSG_INFO ( "in execute()" ) ; - - // Retrieve Electron from AOD - const ElectronContainer * eCont = nullptr; - ATH_CHECK( evtStore()->retrieve(eCont, "ElectronCollection") ); - - ATH_MSG_INFO ( " --- " ) ; - ATH_MSG_INFO ( "Electron Size : " << eCont->size() ) ; - - // loop over all Electron - for (const Analysis::Electron* ele : *eCont) - { - ATH_MSG_INFO ( "Electron pT : " << ele->pt() ) ; - - // get TrackParticle via ElementLink - const Rec::TrackParticle *track = ele->trackParticle(); - if (track == 0) - ATH_MSG_INFO ( "No Track" ) ; - else - ATH_MSG_INFO ( "Track charge : " << track->charge() ) ; - - // get LAr cluster from ESD via ElementLink of egamma - const CaloCluster *cls = ele->cluster(); - if (cls == 0) - { - ATH_MSG_INFO ( "Null LArCluster" ) ; - continue; - } - ATH_MSG_INFO ( "LArCluster eta0 : " << cls->eta0() ) ; - } - - // Retrieve G4Truth directly from ESD - const McEventCollection * g4Cont = nullptr; - ATH_CHECK( evtStore()->retrieve(g4Cont, "G4Truth") ); - - ATH_MSG_INFO ( " --- " ) ; - ATH_MSG_INFO ( "G4Truth Size : " << g4Cont->size() ) ; - - // loop over all McEvent - for (const HepMC::GenEvent* ev : *g4Cont) { - ATH_MSG_INFO ( "Size of particles : " << ev->particles_size() ) ; - } - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode NavTest::finalize() -{ - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadElectron.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadElectron.cxx deleted file mode 100644 index d385aa09531..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadElectron.cxx +++ /dev/null @@ -1,7 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadElectron.h" - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadINav4MomAssocs.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadINav4MomAssocs.cxx deleted file mode 100644 index e6bf57d3203..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadINav4MomAssocs.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// ReadINav4MomAssocs.cxx -// Implementation file for class ReadINav4MomAssocs -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - - -// STL includes - -// FrameWork includes -#include "Gaudi/Property.h" - -// NavFourMom includes -#include "NavFourMom/INav4MomAssocs.h" - -// AnalysisTest includes -#include "AnalysisTest/ReadINav4MomAssocs.h" - -/////////////////////////////////////////////////////////////////// -/// Public methods: -/////////////////////////////////////////////////////////////////// - -/// Constructors -//////////////// -ReadINav4MomAssocs::ReadINav4MomAssocs( const std::string& name, - ISvcLocator* pSvcLocator ) : - AthAlgorithm( name, pSvcLocator ) -{ - // - // Property declaration - // - declareProperty( "Assocs", m_inavAssocsName = "INav4MomAssocs" ); - -} - -/// Destructor -/////////////// -ReadINav4MomAssocs::~ReadINav4MomAssocs() -{ - ATH_MSG_DEBUG ( "Calling destructor" ) ; -} - -/// Athena Algorithm's Hooks -//////////////////////////// -StatusCode ReadINav4MomAssocs::initialize() -{ - ATH_MSG_INFO ( "Initializing " << name() << "..." ) ; - return StatusCode::SUCCESS; -} - -StatusCode ReadINav4MomAssocs::finalize() -{ - ATH_MSG_INFO ( "Finalizing " << name() << "..." ) ; - return StatusCode::SUCCESS; -} - -StatusCode ReadINav4MomAssocs::execute() -{ - ATH_MSG_DEBUG ( "Executing " << name() << "..." ) ; - ATH_CHECK( readAssocs<INav4MomAssocs>( m_inavAssocsName ) ); - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadMuon.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadMuon.cxx deleted file mode 100644 index 87f133db461..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadMuon.cxx +++ /dev/null @@ -1,7 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadMuon.h" - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadPhoton.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadPhoton.cxx deleted file mode 100644 index 4ff304fb905..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadPhoton.cxx +++ /dev/null @@ -1,7 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadPhoton.h" - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTauJet.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTauJet.cxx deleted file mode 100644 index d0e835661f2..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTauJet.cxx +++ /dev/null @@ -1,7 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadTauJet.h" - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrackParticle.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrackParticle.cxx deleted file mode 100644 index e1eded97cbf..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrackParticle.cxx +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadTrackParticle.h" - -StatusCode ReadTrackParticle::userInit() -{ - return m_ntuplePtr -> addItem (m_prefix+"/charge", m_nCon, m_charge); -} - -StatusCode ReadTrackParticle::userExec(const Rec::TrackParticle *val) -{ - m_charge [m_nCon] = val->charge(); - - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrigger.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrigger.cxx deleted file mode 100644 index 78e1e6a3f2e..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTrigger.cxx +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadTrigger.h" - -#include "AnalysisTriggerEvent/CTP_Decision.h" -#include "AnalysisTriggerEvent/LVL1_ROI.h" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -ReadTrigger::ReadTrigger(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator) -{} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode ReadTrigger::initialize() -{ - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode ReadTrigger::execute() -{ - ATH_MSG_DEBUG ("in execute()"); - - // Retrieve CTP - const CTP_Decision * ctpDecision = 0; - ATH_CHECK( evtStore()->retrieve(ctpDecision) ); - - ATH_MSG_DEBUG ("word0 : " << MSG::hex << ctpDecision->getWord0()); - ATH_MSG_DEBUG ("word1 : " << MSG::hex << ctpDecision->getWord1()); - ATH_MSG_DEBUG ("word2 : " << MSG::hex << ctpDecision->getWord2()); - ATH_MSG_DEBUG ("word3 : " << MSG::hex << ctpDecision->getWord3()); - ATH_MSG_DEBUG ("word4 : " << MSG::hex << ctpDecision->getWord4()); - ATH_MSG_DEBUG ("word5 : " << MSG::hex << ctpDecision->getWord5()); - ATH_MSG_DEBUG ("word6 : " << MSG::hex << ctpDecision->getWord6()); - ATH_MSG_DEBUG ("word7 : " << MSG::hex << ctpDecision->getWord7()); - - for (const auto& item : ctpDecision->getItems()) - { - ATH_MSG_DEBUG ("item : " << item); - } - - // Retrieve LVL1 ROI - const LVL1_ROI* roi = 0; - ATH_CHECK( evtStore()->retrieve(roi) ); - - for (const auto& item : roi->getMuonROIs()) - { - ATH_MSG_DEBUG ("Mu : " << item.getEta() << " " << item.getPhi()); - } - - for (const auto& item : roi->getEmTauROIs()) - { - ATH_MSG_DEBUG ("EmTau : " << item.getEta() << " " << item.getPhi()); - } - - for (const auto& item : roi->getJetROIs()) - { - ATH_MSG_DEBUG ("Jet : " << item.getEta() << " " << item.getPhi()); - } - - for (const auto& item : roi->getJetEtROIs()) - { - ATH_MSG_DEBUG ("JetET : " << MSG::hex << item.getROIWord() << MSG::dec); - } - - for (const auto& item : roi->getEnergySumROIs()) - { - ATH_MSG_DEBUG ("EnergySum : " << item.getEnergyX() << " " - << item.getEnergyY() << " " << item.getEnergyT()); - } - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode ReadTrigger::finalize() -{ - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTruthParticle.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTruthParticle.cxx deleted file mode 100644 index 8e285de0d11..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadTruthParticle.cxx +++ /dev/null @@ -1,7 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadTruthParticle.h" - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadVxContainer.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadVxContainer.cxx deleted file mode 100644 index eca6948dff8..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/ReadVxContainer.cxx +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/ReadVxContainer.h" - -StatusCode ReadVxContainer::userInit() -{ - return m_ntuplePtr -> addItem (m_prefix+"/chi2", m_nCon, m_chi2); -} - -StatusCode ReadVxContainer::userExec(const Trk::VxCandidate *val) -{ - m_chi2 [m_nCon] = (val->recVertex()).fitQuality().chiSquared(); - - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/Readegamma.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/Readegamma.cxx deleted file mode 100644 index d00d020bae3..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/Readegamma.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AnalysisTest/Readegamma.h" -#include "Particle/TrackParticle.h" - -StatusCode Readegamma::userInit() -{ - return m_ntuplePtr -> addItem (m_prefix+"/e", m_nCon, m_e); -} - -StatusCode Readegamma::userExec(const egamma *val) -{ - m_e [m_nCon] = val->e(); - - // get LAr cluster - const CaloCluster *cls = val->cluster(); - if (cls == 0) - { - ATH_MSG_INFO ( "Null LArCluster" ) ; - } - else - { - ATH_MSG_INFO ( "LArCluster eta0: " << cls->eta0() ) ; - } - - // get TrackParticle - const Rec::TrackParticle *tp; - tp = val->trackParticle(); - if (tp == 0) - { - ATH_MSG_INFO ( "Null TrackParticle" ) ; - } - else - { - ATH_MSG_INFO ( "TrackParticle charge: " << tp->charge() ) ; - } - - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/WriteINav4MomAssocs.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/WriteINav4MomAssocs.cxx deleted file mode 100644 index 93542497f11..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/WriteINav4MomAssocs.cxx +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// WriteINav4MomAssocs.cxx -// Implementation file for class WriteINav4MomAssocs -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - - -// STL includes - -// FrameWork includes -#include "Gaudi/Property.h" - -// NavFourMom includes -#include "NavFourMom/INav4MomAssocs.h" - -// ElectronPhotonIDEvent includes -#include "egammaEvent/ElectronContainer.h" - -// JetEvent includes -#include "JetEvent/JetCollection.h" - -// AnalysisTest includes -#include "AnalysisTest/WriteINav4MomAssocs.h" -#include "AthenaKernel/Units.h" - -/////////////////////////////////////////////////////////////////// -/// Public methods: -/////////////////////////////////////////////////////////////////// - -/// Constructors -//////////////// -WriteINav4MomAssocs::WriteINav4MomAssocs( const std::string& name, - ISvcLocator* pSvcLocator ) : - AthAlgorithm( name, pSvcLocator ) -{ - // - // Property declaration - // - declareProperty( "Jets", m_jetsName = "AtlfastJetContainer" ); - declareProperty( "Electrons", m_electronsName = "AtlfastElectronCollection" ); - declareProperty( "AssocsOutput", m_inavAssocsOutputName = "INav4MomAssocs" ); - -} - -/// Destructor -/////////////// -WriteINav4MomAssocs::~WriteINav4MomAssocs() -{ - ATH_MSG_DEBUG ( "Calling destructor" ) ; -} - -/// Athena Algorithm's Hooks -//////////////////////////// -StatusCode WriteINav4MomAssocs::initialize() -{ - ATH_MSG_INFO ( "Initializing " << name() << "..." ) ; - return StatusCode::SUCCESS; -} - -StatusCode WriteINav4MomAssocs::finalize() -{ - ATH_MSG_INFO ( "Finalizing " << name() << "..." ) ; - return StatusCode::SUCCESS; -} - -StatusCode WriteINav4MomAssocs::execute() -{ - ATH_MSG_DEBUG ( "Executing " << name() << "..." ) ; - - ATH_CHECK( (this->symLink<ElectronContainer,INavigable4MomentumCollection>(m_electronsName)) ); - - ATH_CHECK( (this->symLink<JetCollection,INavigable4MomentumCollection>(m_jetsName)) ); - - const INavigable4MomentumCollection * jets = 0; - ATH_CHECK( evtStore()->retrieve( jets, m_jetsName ) ); - - const INavigable4MomentumCollection * electrons = 0; - ATH_CHECK( evtStore()->retrieve( electrons, m_electronsName ) ); - - return buildAssocs( jets, electrons ); -} -/////////////////////////////////////////////////////////////////// -/// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -/// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -/// Protected methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -/// Const methods: -/////////////////////////////////////////////////////////////////// - -StatusCode -WriteINav4MomAssocs::buildAssocs( const INavigable4MomentumCollection * coll1, - const INavigable4MomentumCollection * coll2 ) const -{ - ATH_MSG_DEBUG ( "in buildINav4MomAssocs..." ) ; - - INav4MomAssocs * assocs = new INav4MomAssocs; - ATH_CHECK( evtStore()->record( assocs, m_inavAssocsOutputName ) ); - ATH_CHECK( evtStore()->setConst( assocs ) ); - - for (const INavigable4Momentum* m1 : *coll1) { - for (const INavigable4Momentum* m2 : *coll2) { - assocs->addAssociation( coll1, m1, coll2, m2 ); - ATH_MSG_DEBUG ( "Assoc: [jet-ele] ene= " - << m1->e() / Athena::Units::GeV - << "\t" - << m2->e() / Athena::Units::GeV ) ; - }//> end loop over electrons - }//> end loop over jets - - INav4MomAssocs::object_iterator objEnd = assocs->endObject(); - for ( INav4MomAssocs::object_iterator objItr = assocs->beginObject(); - objItr != objEnd; - ++objItr ) { - ATH_MSG_INFO ( "--> e= " << (*objItr)->e() / Athena::Units::GeV - << "\tnAssocs= " << assocs->getNumberOfAssociations(objItr) ) ; - } - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////// -/// Non-const methods: -/////////////////////////////////////////////////////////////////// - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/components/AnalysisTest_entries.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/components/AnalysisTest_entries.cxx deleted file mode 100644 index 09822a9addb..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/src/components/AnalysisTest_entries.cxx +++ /dev/null @@ -1,29 +0,0 @@ -#include "AnalysisTest/ReadMuon.h" -#include "AnalysisTest/ReadElectron.h" -#include "AnalysisTest/ReadPhoton.h" -#include "AnalysisTest/ReadTauJet.h" -#include "AnalysisTest/ReadTruthParticle.h" -#include "AnalysisTest/ReadTrigger.h" -#include "AnalysisTest/Readegamma.h" -#include "AnalysisTest/ReadVxContainer.h" -#include "AnalysisTest/ReadTrackParticle.h" -#include "AnalysisTest/NavTest.h" - -#include "AnalysisTest/WriteINav4MomAssocs.h" -#include "AnalysisTest/ReadINav4MomAssocs.h" - - -DECLARE_COMPONENT( ReadMuon ) -DECLARE_COMPONENT( ReadElectron ) -DECLARE_COMPONENT( ReadPhoton ) -DECLARE_COMPONENT( ReadTauJet ) -DECLARE_COMPONENT( ReadTruthParticle ) -DECLARE_COMPONENT( ReadTrigger ) -DECLARE_COMPONENT( Readegamma ) -DECLARE_COMPONENT( ReadVxContainer ) -DECLARE_COMPONENT( ReadTrackParticle ) -DECLARE_COMPONENT( NavTest ) - -DECLARE_COMPONENT( WriteINav4MomAssocs ) -DECLARE_COMPONENT( ReadINav4MomAssocs ) - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AnalysisTest.sh b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AnalysisTest.sh deleted file mode 100644 index 6bc85dd6c39..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AnalysisTest.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# This just selects the directory to run cmt commands -# But with project builds and as this package (AnalysisTest) can be moved -# from some project to another, we wildcard the AtlasXyzRelease directory -cd ${NIGHTLYAREA}/Atlas*Release/cmt -# -cmt broadcast -select=AnalysisTest make CppUnit -stat=$? -if [ "$stat" != "0" ]; then - echo " -------------------------------- " - echo " FAILURE : test AnalysisTest " - echo " -------------------------------- " -fi diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AssocFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AssocFilterTest_CppUnit.cxx deleted file mode 100644 index 9e6e9347f81..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/AssocFilterTest_CppUnit.cxx +++ /dev/null @@ -1,462 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the AssocFilter class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> - -// CLHEP includes -#include "CLHEP/Units/SystemOfUnits.h" - -#include "AthContainers/DataVector.h" - -// EventKernel includes -#include "EventKernel/I4Momentum.h" - -// FourMom includes -#include "FourMom/P4PxPyPzE.h" -#include "FourMom/P4EEtaPhiM.h" - -// AnalysisAssociation includes -#include "AnalysisAssociation/AssocFilter.h" - -class AssocFilterTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite "FilterTest" - CPPUNIT_TEST_SUITE( AssocFilterTest ); - - CPPUNIT_TEST( testConstructor ); - CPPUNIT_TEST( testCopyAssocFilter ); - CPPUNIT_TEST( testSettersAndGetters ); - - CPPUNIT_TEST( testDeltaPxAssoc ); - CPPUNIT_TEST( testDeltaPyAssoc ); - CPPUNIT_TEST( testDeltaPzAssoc ); - CPPUNIT_TEST( testDeltaEneAssoc ); - - CPPUNIT_TEST( testDeltaEtaAssoc ); - CPPUNIT_TEST( testDeltaPhiAssoc ); - CPPUNIT_TEST( testDeltaMassAssoc ); - CPPUNIT_TEST( testDeltaPtAssoc ); - - //CPPUNIT_TEST( testDeltaRAssoc ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - -public: - - /// Set up the data members - void setUp() - { - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - } - - /// Test constructor - void testConstructor() - { - AssocFilter<I4Momentum, I4Momentum> filter; - CPPUNIT_ASSERT( filter.deltaPxMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPxMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPyMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPyMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPzMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPzMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEneMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEneMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEtaMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEtaMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPhiMin() == -M_PI ); - CPPUNIT_ASSERT( filter.deltaPhiMax() == M_PI ); - CPPUNIT_ASSERT( filter.deltaMassMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaMassMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPtMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPtMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaRMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaRMax() == FLT_MAX ); - } - - /// Test that asociation filter cuts are well copied - void testCopyAssocFilter() - { - AssocFilter<I4Momentum, I4Momentum> orig; - orig.setDeltaPx ( 10.*GeV, 20.*GeV ); - orig.setDeltaPy ( 10.*GeV, 20.*GeV ); - orig.setDeltaPz ( 10.*GeV, 20.*GeV ); - orig.setDeltaEne( 10.*GeV, 20.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100*GeV, 100*GeV, 200*GeV ); - P4PxPyPzE p2( 110.*GeV, 110*GeV, 110*GeV, 210*GeV ); - - CPPUNIT_ASSERT( orig.isAccepted( &p1, &p2 ) ); - - AssocFilter<I4Momentum, I4Momentum> assoc; - assoc.setDeltaPxMin( 100.*GeV ); - CPPUNIT_ASSERT( !assoc.isAccepted( &p1, &p2 ) ); - - assoc.setFilter( &orig ); - CPPUNIT_ASSERT( assoc.isAccepted( &p1, &p2 ) ); - } - - /// Test the setters and getters of the AssocFilter class - void testSettersAndGetters() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - const double min = M_PI/2.; - const double max = M_PI; - - CPPUNIT_ASSERT( min < max ); - - assocFilter.setDeltaPx( min, max ); - assocFilter.setDeltaPy( min, max ); - assocFilter.setDeltaPz( min, max ); - assocFilter.setDeltaEne( min, max ); - - assocFilter.setDeltaEta( min, max ); - assocFilter.setDeltaPhi( min, max ); - assocFilter.setDeltaMass( min, max ); - assocFilter.setDeltaPt( min, max ); - - assocFilter.setDeltaR( min, max ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPxMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPxMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPyMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPyMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPzMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPzMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaEneMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaEneMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaEtaMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaEtaMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPhiMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPhiMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaMassMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaMassMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPtMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPtMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaRMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaRMax() ); - - /// Explore other interface - AssocFilter<I4Momentum, I4Momentum> assocFilter2; - - // Max - assocFilter2.setDeltaPxMax( max ); - assocFilter2.setDeltaPyMax( max ); - assocFilter2.setDeltaPzMax( max ); - assocFilter2.setDeltaEneMax( max ); - - assocFilter2.setDeltaEtaMax( max ); - assocFilter2.setDeltaPhiMax( max ); - assocFilter2.setDeltaMassMax( max ); - assocFilter2.setDeltaPtMax( max ); - - assocFilter2.setDeltaRMax( max ); - - // Min - assocFilter2.setDeltaPxMin( min ); - assocFilter2.setDeltaPyMin( min ); - assocFilter2.setDeltaPzMin( min ); - assocFilter2.setDeltaEneMin( min ); - - assocFilter2.setDeltaEtaMin( min ); - assocFilter2.setDeltaPhiMin( min ); - assocFilter2.setDeltaMassMin( min ); - assocFilter2.setDeltaPtMin( min ); - - assocFilter2.setDeltaRMin( min ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPxMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPxMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPyMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPyMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPzMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPzMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaEneMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaEneMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaEtaMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaEtaMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPhiMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPhiMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaMassMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaMassMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPtMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPtMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaRMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaRMax() ); - - } - - /// Test the association between objects based on their Px - void testDeltaPxAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaPxMin( 0.*GeV ); - assocFilter.setDeltaPxMax( 10.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 110.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPxMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their Py - void testDeltaPyAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaPyMin( 0.*GeV ); - assocFilter.setDeltaPyMax( 10.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 100.*GeV, 110.*GeV, 100.*GeV, 200.*GeV ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPyMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their Pz - void testDeltaPzAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaPzMin( 0.*GeV ); - assocFilter.setDeltaPzMax( 10.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 100.*GeV, 100.*GeV, 110.*GeV, 200.*GeV ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPzMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their energy - void testDeltaEneAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaEneMin( 0.*GeV ); - assocFilter.setDeltaEneMax( 10.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 100.*GeV, 100.*GeV, 100.*GeV, 210.*GeV ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaEneMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their eta - void testDeltaEtaAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaEtaMin( 0.0 ); - assocFilter.setDeltaEtaMax( 2.5 ); - - P4EEtaPhiM p1; - P4EEtaPhiM p2; - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 90.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaEtaMax( 2. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, -1.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, -2.5, M_PI/2., 90.*GeV ) ); - - /// Test negative eta - assocFilter.setDeltaEtaMax( 1.5 ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaEta( 2., 3. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - } - - /// Test the association between objects based on their phi - void testDeltaPhiAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaPhiMin( 0.0 ); - assocFilter.setDeltaPhiMax( M_PI/2. ); - - P4EEtaPhiM p1; - P4EEtaPhiM p2; - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 90.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPhi( 0., M_PI/4. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - /// Test negative phi - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, -M_PI/2., 90.*GeV ) ); - - assocFilter.setDeltaPhi( 0., M_PI/2. ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPhi( 0., M_PI/4. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - /// Test Modulo - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, 2*M_PI, 90.*GeV ) ); - - assocFilter.setDeltaPhi( 0., 0. ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their mass - void testDeltaMassAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaMassMin( 0.*GeV ); - assocFilter.setDeltaMassMax( 11.*GeV ); - - P4EEtaPhiM p1; - P4EEtaPhiM p2; - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 110.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 120.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaMass( 0.*GeV, 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaMass( 0.*GeV, 10.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - /// Test the accuracy of P4EEtaPhiM - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 10.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 20.*GeV ) ); - - assocFilter.setDeltaMass( 0.*GeV, 10.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - /// Test the accuracy of P4EEtaPhiM - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 90.*GeV ) ); - - assocFilter.setDeltaMass( 0.*GeV, 10.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their Pt - void testDeltaPtAssoc() - { - AssocFilter<I4Momentum, I4Momentum> assocFilter; - assocFilter.setDeltaPtMin( 0.*GeV ); - assocFilter.setDeltaPtMax( 20.*GeV ); - - P4EEtaPhiM p1( 200.*GeV, 3.0, M_PI, 90.*GeV ); //> Pt ~= 18 GeV; - P4EEtaPhiM p2( 200.*GeV, 2.3, M_PI, 90.*GeV ); //> Pt ~= 36 GeV; - - //p1.set4Mom(P4EEtaPhiM( 200.*GeV, 3., M_PI, 90.*GeV )); //> Pt ~= 18 GeV - //p1.set4Mom(P4EEtaPhiM( 200.*GeV, 1., 0., 80.*GeV )); //> Pt ~= 119 GeV - - //std::cout << "Pt1= " << p1.pt() << std::endl; - //std::cout << "Pt2= " << p2.pt() << std::endl; - CPPUNIT_ASSERT( 17.74*GeV <= p1.pt() && p1.pt() <= 17.75*GeV ); - CPPUNIT_ASSERT( 35.45*GeV <= p2.pt() && p2.pt() <= 35.46*GeV ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPtMax( 15.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPt( 15.*GeV, 20.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - } - -}; - -/// Registration of the test suite "AssocFilterTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( AssocFilterTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include "TestTools/CppUnit_testdriver.cxx" diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/CategoryIdFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/CategoryIdFilterTest_CppUnit.cxx deleted file mode 100644 index 0965fda8de7..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/CategoryIdFilterTest_CppUnit.cxx +++ /dev/null @@ -1,765 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the PdgIdFilter class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <stdexcept> -#include <cmath> - -// CLHEP includes -#include "CLHEP/Units/SystemOfUnits.h" - -#include "AthContainers/DataVector.h" - -// EventKernel includes -#include "EventKernel/IParticle.h" - -// FourMom includes -#include "FourMom/P4PxPyPzE.h" -#include "FourMom/P4EEtaPhiM.h" - -// JetEvent -#include "JetEvent/Jet.h" -#include "JetEvent/JetCollection.h" - -// McParticleEvent -#include "McParticleEvent/TruthParticle.h" - -// AnalysisUtils includes -#include "AnalysisUtils/AnalysisSelection.h" -#include "AnalysisUtils/AnalysisCombination.h" -#include "AnalysisUtils/CategoryIdFilter.h" - -class CategoryIdFilterTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite " CategoryIdFilterTest" - CPPUNIT_TEST_SUITE( CategoryIdFilterTest ); - - CPPUNIT_TEST( testCopyCategoryIdFilter ); - CPPUNIT_TEST( testSettersAndGetters ); - - CPPUNIT_TEST( testQuarkFilter ); - - CPPUNIT_TEST( testLightFlavourFilter ); - CPPUNIT_TEST( testHeavyFlavourFilter ); - - CPPUNIT_TEST( testLeptonFilter ); - - CPPUNIT_TEST( testBaryonFilter ); - CPPUNIT_TEST( testMesonFilter ); - - CPPUNIT_TEST( testDiQuarkFilter ); - CPPUNIT_TEST( testBosonFilter ); - - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - unsigned int m_nJets; - unsigned int m_nLightJets; - unsigned int m_nBJets; - JetCollection * m_jets; - -public: - - /// Set up the data members - void setUp() - { - m_nJets = 10; - m_nLightJets = 8; - m_nBJets = 2; - m_jets = new JetCollection; - - const double px = 100.*GeV; - const double py = 100.*GeV; - const double pz = 100.*GeV; - const double E = 200.*GeV; - - std::vector<PDG::pidType> pdgs; - pdgs.push_back( PDG::null ); - pdgs.push_back( PDG::d ); - pdgs.push_back( PDG::s ); - pdgs.push_back( PDG::b ); - - for ( unsigned int i = 0; i < m_nJets; ++i ) { - Jet * jet = 0; - jet = new Jet(); - - jet->set4Mom( P4PxPyPzE( ((i%4)+1)*px, ((i%4)+1)*py, - ((i%4)+1)*pz, ((i%4)+1)*E ) ); - jet->set_pdgId( pdgs[i%4] ); - m_jets->push_back(jet); - /* - std::cout << "\tjet " << i - << "pdgId= " << jet->pdgId() - << std::endl; - */ - } - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - if ( m_jets ) { - delete m_jets; - m_jets = 0; - } - } - - /// Test that CategoryIdFilter cuts are well copied - void testCopyCategoryIdFilter() - { - CategoryIdFilter<IParticle> orig; - - Jet bbar; - bbar.set_pdgId( PDG::b ); - CPPUNIT_ASSERT( orig.isAccepted( &bbar ) ); - - bbar.set_pdgId( PDG::anti_b ); - CPPUNIT_ASSERT( orig.isAccepted( &bbar ) ); - - CategoryIdFilter<IParticle> filter; - filter.setCategory( PDGCat::CFlavour ); - CPPUNIT_ASSERT( !filter.isAccepted( &bbar ) ); - - filter.setCategory( PDGCat::BFlavour ); - CPPUNIT_ASSERT( filter.isAccepted( &bbar ) ); - - filter.setFilter( &orig ); - CPPUNIT_ASSERT( filter.isAccepted( &bbar ) ); - - orig.setCategory( PDGCat::CFlavour ); - CPPUNIT_ASSERT( !orig.isAccepted( &bbar ) ); - - filter.setFilter( &orig ); - CPPUNIT_ASSERT( !filter.isAccepted( &bbar ) ); - - { - CategoryIdFilter<IParticle> copy; - CPPUNIT_ASSERT( copy.isAccepted( &bbar ) ); - copy = filter; - CPPUNIT_ASSERT( !copy.isAccepted( &bbar ) ); - } - { - CategoryIdFilter<IParticle> copy = filter; - CPPUNIT_ASSERT( !copy.isAccepted( &bbar ) ); - } - { - CategoryIdFilter<IParticle> copy(filter); - CPPUNIT_ASSERT( !copy.isAccepted( &bbar ) ); - } - } - - /// Test setters and getters - void testSettersAndGetters() - { - CategoryIdFilter<IParticle> filter; - CPPUNIT_ASSERT( filter.getCategories().empty() ); - - filter.setCategory( PDGCat::BFlavour ); - CPPUNIT_ASSERT( !filter.getCategories().empty() ); - CPPUNIT_ASSERT( PDGCat::BFlavour == filter.getCategories()[0] ); - - filter.addCategory( PDGCat::TFlavour ); - CPPUNIT_ASSERT( 2 == filter.getCategories().size() ); - CPPUNIT_ASSERT( PDGCat::TFlavour == filter.getCategories()[1] ); - - } - - /// Test that CategoryIdFilter selects b-quarks - void testQuarkFilter() - { - CategoryIdFilter<IParticle> mesonFilter; - mesonFilter.setCategory( PDGCat::Meson ); - - CategoryIdFilter<IParticle> filter; - Jet j; - - // u - filter.setCategory( PDGCat::UFlavour ); - - j.set_pdgId( PDG::u ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - j.set_pdgId( PDG::anti_u ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - - // d - filter.setCategory( PDGCat::DFlavour ); - - j.set_pdgId( PDG::d ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - j.set_pdgId( PDG::anti_d ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - - // c - filter.setCategory( PDGCat::CFlavour ); - - j.set_pdgId( PDG::c ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - j.set_pdgId( PDG::anti_c ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - - // s - filter.setCategory( PDGCat::SFlavour ); - - j.set_pdgId( PDG::s ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - j.set_pdgId( PDG::anti_s ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - - // t - filter.setCategory( PDGCat::TFlavour ); - - j.set_pdgId( PDG::t ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - j.set_pdgId( PDG::anti_t ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - - // b - filter.setCategory( PDGCat::BFlavour ); - - j.set_pdgId( PDG::b ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - j.set_pdgId( PDG::anti_b ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !mesonFilter.isAccepted( &j ) ); - - } - - /// Test the filtering on light flavour - void testLightFlavourFilter() - { - //> Create a light jet filter - CategoryIdFilter<IParticle> ljetFilter; - ljetFilter.setCategory( PDGCat::LightFlavour ); - - // Test with a std::vector - std::vector<Jet*> lightJets; - CPPUNIT_ASSERT( lightJets.size() == static_cast<unsigned int>(0) ); - AnalysisUtils::copy_if( m_jets->begin(), - m_jets->end(), - std::back_inserter(lightJets), - ljetFilter ); - CPPUNIT_ASSERT( lightJets.size() != m_nLightJets ); - - // Now add the category for "untagged jets" - ljetFilter.addCategory( PDGCat::Untagged ); - lightJets.clear(); - AnalysisUtils::copy_if( m_jets->begin(), - m_jets->end(), - std::back_inserter(lightJets), - ljetFilter ); - CPPUNIT_ASSERT( lightJets.size() == m_nLightJets ); - - // Test with a Selection - AnalysisUtils::Selection<CategoryIdFilter<IParticle> > ljetFilterSel; - ljetFilterSel.setCategory( PDGCat::LightFlavour ); - ljetFilterSel.addCategory( PDGCat::Untagged ); - - lightJets.clear(); - CPPUNIT_ASSERT( lightJets.size() == static_cast<unsigned int>(0) ); - ljetFilterSel.getObjects( m_jets, lightJets); - - CPPUNIT_ASSERT( (lightJets.size() == m_nLightJets) ); - - // Test with a JetCollection - JetCollection lJets(SG::VIEW_ELEMENTS); - CPPUNIT_ASSERT( lJets.size() == static_cast<unsigned int>(0) ); - AnalysisUtils::copy_if( m_jets->begin(), - m_jets->end(), - std::back_inserter(lJets), - ljetFilter ); - CPPUNIT_ASSERT( lJets.size() == m_nLightJets ); - } - - /// Test the filtering on heavy flavour - void testHeavyFlavourFilter() - { - //> Create a b-jet filter - CategoryIdFilter<IParticle> bjetFilter; - bjetFilter.setCategory( PDGCat::BFlavour ); - - std::vector<Jet*> bJets; - bJets.reserve (m_nBJets); - AnalysisUtils::copy_if( m_jets->begin(), - m_jets->end(), - std::back_inserter(bJets), - bjetFilter ); - - CPPUNIT_ASSERT( bJets.size() == m_nBJets ); - - return; - } - - void testLeptonFilter() - { - Jet ele; - - CategoryIdFilter<IParticle> filter; - filter.setCategory( PDGCat::Lepton ); - - ele.set_pdgId( PDG::e_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &ele ) ); - ele.set_pdgId( PDG::e_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &ele ) ); - - for ( JetCollection::const_iterator jet = m_jets->begin(); - jet != m_jets->end(); - ++jet ) { - CPPUNIT_ASSERT( !filter.isAccepted( *jet ) ); - } - - } - - void testBaryonFilter() - { - Jet j; - - CategoryIdFilter<IParticle> hadron; - hadron.setCategory( PDGCat::Hadron ); - - CategoryIdFilter<IParticle> filter; - filter.setCategory( PDGCat::Baryon ); - - j.set_pdgId( PDG::Delta_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::p_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Sigma_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Lambda0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Omega_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Sigma_c0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Lambda_c_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_c0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Sigma_c_plus_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_c_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_prime_c0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Omega_c0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Sigma_b_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Lambda_b0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_b_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Sigma_b0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Sigma_b_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_b0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_prime_b_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Xi_prime_b0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Omega_b_minus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - for ( JetCollection::const_iterator jet = m_jets->begin(); - jet != m_jets->end(); - ++jet ) { - CPPUNIT_ASSERT( !filter.isAccepted( *jet ) ); - CPPUNIT_ASSERT( !hadron.isAccepted( *jet ) ); - } - - } - - void testMesonFilter() - { - Jet j; - - CategoryIdFilter<IParticle> hadron; - hadron.setCategory( PDGCat::Hadron ); - - CategoryIdFilter<IParticle> filter; - filter.setCategory( PDGCat::Meson ); - - j.set_pdgId( PDG::pi0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::pi_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::eta ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::rho_2S0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::phi ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::f_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::K0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::K_0_star0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::D_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::D0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::D_0_star_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::D_prime_1_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::D_s_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::D_s1_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B_0_star0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B_10 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B_s0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B_s0_star0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B_c_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::B_c0_star_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::eta_c ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::J_psi ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - j.set_pdgId( PDG::Upsilon ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( hadron.isAccepted( &j ) ); - - for ( JetCollection::const_iterator jet = m_jets->begin(); - jet != m_jets->end(); - ++jet ) { - CPPUNIT_ASSERT( !filter.isAccepted( *jet ) ); - CPPUNIT_ASSERT( !hadron.isAccepted( *jet ) ); - } - - } - - /// Test DiQuark filter - void testDiQuarkFilter() - { - Jet j; - - CategoryIdFilter<IParticle> filter; - filter.setCategory( PDGCat::DiQuark ); - - CategoryIdFilter<IParticle> meson; - meson.setCategory( PDGCat::Meson ); - - CategoryIdFilter<IParticle> baryon; - baryon.setCategory( PDGCat::Baryon ); - - // stricto sensu this particle is not a diquark (not color neutral) - // so it is NOT accepted by the filter. - // Is it really worrying ? - j.set_pdgId( PDG::dd_0 ); - CPPUNIT_ASSERT( !filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::ud_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - // stricto sensu this particle is not a diquark (not color neutral) - // so it is NOT accepted by the filter. - // Is it really worrying ? - j.set_pdgId( PDG::uu_0 ); - CPPUNIT_ASSERT( !filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::sd_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::su_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - // stricto sensu this particle is not a diquark (not color neutral) - // so it is NOT accepted by the filter. - // Is it really worrying ? - j.set_pdgId( PDG::ss_0 ); - CPPUNIT_ASSERT( !filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::cd_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::cu_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::cs_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - // stricto sensu this particle is not a diquark (not color neutral) - // so it is NOT accepted by the filter. - // Is it really worrying ? - j.set_pdgId( PDG::cc_0 ); - CPPUNIT_ASSERT( !filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::bd_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::bu_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::bs_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::bc_0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - // stricto sensu this particle is not a diquark (not color neutral) - // so it is NOT accepted by the filter. - // Is it really worrying ? - j.set_pdgId( PDG::bb_0 ); - CPPUNIT_ASSERT( !filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::dd_1 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::ud_1 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::uu_1 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::ss_1 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::cc_1 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - j.set_pdgId( PDG::bb_1 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - CPPUNIT_ASSERT( !meson.isAccepted( &j ) ); - CPPUNIT_ASSERT( !baryon.isAccepted( &j ) ); - - for ( JetCollection::const_iterator jet = m_jets->begin(); - jet != m_jets->end(); - ++jet ) { - CPPUNIT_ASSERT( !filter.isAccepted( *jet ) ); - } - } - - /// Test Boson filter - void testBosonFilter() - { - Jet j; - - CategoryIdFilter<IParticle> filter; - filter.setCategory( PDGCat::Boson ); - - j.set_pdgId( static_cast<PDG::pidType>(21) ); //> gluon - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::gamma ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::Z0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::W_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::Higgs0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::reggeon ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::pomeron ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::Z_prime0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::Z_prime_prime0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::W_prime_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::Higgs_prime0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::A0 ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - j.set_pdgId( PDG::Higgs_plus ); - CPPUNIT_ASSERT( filter.isAccepted( &j ) ); - - for ( JetCollection::const_iterator jet = m_jets->begin(); - jet != m_jets->end(); - ++jet ) { - CPPUNIT_ASSERT( !filter.isAccepted( *jet ) ); - } - } -}; - -/// Registration of the test suite "CategoryIdFilterTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( CategoryIdFilterTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_SGtestdriver.cxx> diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/ChargeFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/ChargeFilterTest_CppUnit.cxx deleted file mode 100644 index ebadeaac902..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/ChargeFilterTest_CppUnit.cxx +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the ChargeFilter class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <stdexcept> -#include <cmath> - -// CLHEP includes -#include "CLHEP/Vector/LorentzVector.h" -#include "CLHEP/Units/SystemOfUnits.h" - -// ElectronPhotonIDEvent includes -#include "egammaEvent/Electron.h" - -// JetEvent includes -#include "JetEvent/Jet.h" - -// AnalysisUtils includes -#include "AnalysisUtils/ChargeFilter.h" - -class ChargeFilterTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite "ChargeFilterTest" - CPPUNIT_TEST_SUITE( ChargeFilterTest ); - - CPPUNIT_TEST( testConstructor ); - CPPUNIT_TEST( testCopyChargeFilter ); - CPPUNIT_TEST( testSettersAndGetters ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - Jet m_b; - Jet m_bbar; - Analysis::Electron m_ele; - -public: - - /// Set up the data members - void setUp() - { - m_b.set4Mom( P4PxPyPzE( 100*GeV, 100*GeV, 100*GeV, 200*GeV ) ); - m_b.set_pdgId( PDG::b ); - m_b.set_charge( -1./3. ); - - m_bbar.set4Mom( P4PxPyPzE( 100*GeV, 100*GeV, 100*GeV, 200*GeV ) ); - m_bbar.set_pdgId( PDG::anti_b ); - m_bbar.set_charge( 1./3. ); - - m_ele.set4Mom( P4PxPyPzE( 100*GeV, 100*GeV, 100*GeV, 200*GeV ) ); - m_ele.set_pdgId( PDG::e_minus ); - m_ele.set_charge( -1. ); - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - } - - /// Test the ChargeFilter constructors - void testConstructor() - { - ChargeFilter<IParticle> filter; - CPPUNIT_ASSERT( filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_bbar) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_ele) ); - - try { - CPPUNIT_ASSERT( filter.charge() ); - CPPUNIT_ASSERT( false ); - } catch( std::exception& e ) { - const std::string error = "No charge selection defined"; - CPPUNIT_ASSERT( error == e.what() ); - } - } - - /// Test that ChargeFilter cuts are well copied - void testCopyChargeFilter() - { - ChargeFilter<IParticle> orig; - orig.setCharge( -1./3. ); - CPPUNIT_ASSERT( orig.isAccepted(&m_b) ); - CPPUNIT_ASSERT( !orig.isAccepted(&m_bbar) ); - - { - ChargeFilter<IParticle> filter(orig); - CPPUNIT_ASSERT( filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_bbar) ); - } - { - ChargeFilter<IParticle> filter = orig; - CPPUNIT_ASSERT( filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_bbar) ); - } - { - ChargeFilter<IParticle> filter; - CPPUNIT_ASSERT( filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_bbar) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_ele) ); - - filter.setFilter( &orig ); - CPPUNIT_ASSERT( filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_bbar) ); - } - } - - /// Test setters and getters - void testSettersAndGetters() - { - ChargeFilter<IParticle> filter; - CPPUNIT_ASSERT( filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_bbar) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_ele) ); - - try { - CPPUNIT_ASSERT( filter.charge() ); - CPPUNIT_ASSERT( false ); - } catch( std::exception& e ) { - const std::string error = "No charge selection defined"; - CPPUNIT_ASSERT( error == e.what() ); - } - - filter.setCharge( -1./3. ); - CPPUNIT_ASSERT( -1./3. == filter.charge() ); - CPPUNIT_ASSERT( filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_bbar) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_ele) ); - - filter.setCharge( 1./3. ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_bbar) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_ele) ); - - filter.setCharge( -1. ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_bbar) ); - CPPUNIT_ASSERT( filter.isAccepted(&m_ele) ); - - filter.setCharge( 0. ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_b) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_bbar) ); - CPPUNIT_ASSERT( !filter.isAccepted(&m_ele) ); - - } - -}; - -/// Registration of the test suite "ChargeFilterTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( ChargeFilterTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_SGtestdriver.cxx> diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/DecayParserTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/DecayParserTest_CppUnit.cxx deleted file mode 100644 index 8deed222a0e..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/DecayParserTest_CppUnit.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the DecayParser class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <stdexcept> -#include <cmath> - -// McParticleUtils includes -#include "McParticleUtils/DecayParser.h" - -class DecayParserTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite "DecayParserTest" - CPPUNIT_TEST_SUITE( DecayParserTest ); - - CPPUNIT_TEST( testConstructor ); - CPPUNIT_TEST( testSettersAndGetters ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - -public: - - /// Set up the data members - void setUp() - { - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - } - - /// Test that momentum filter cuts are well copied - void testConstructor() - { - { - DecayParser parser( "23 -> -11 + 11" ); - CPPUNIT_ASSERT( parser.getParents().size() == 1 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 2 ); - } - - { - DecayParser parser( "->" ); - CPPUNIT_ASSERT( parser.getParents().size() == 0 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 0 ); - } - { - try { - DecayParser parser( " " ); - // should not be there because DecayParser should throw an exception - CPPUNIT_ASSERT(false); - } catch (std::invalid_argument& e) { - std::string error = "problem while parsing command [ ]"; - CPPUNIT_ASSERT( error == e.what() ); - } catch (std::exception& e) { - std::string error = "problem while parsing command [ ]"; - CPPUNIT_ASSERT( error == e.what() ); - } - } - } - - /// Test the setters and getters - void testSettersAndGetters() - { - DecayParser parser( "->" ); - CPPUNIT_ASSERT( parser.getParents().size() == 0 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 0 ); - - parser.parse( "23 -> -11 + 11" ); - CPPUNIT_ASSERT( parser.getParents().size() == 1 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 2 ); - - parser.parse( "6 -> 24 + -5" ); - CPPUNIT_ASSERT( parser.getParents().size() == 1 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 2 ); - - parser.parse( "23 -> -11 + 11 + 13" ); - CPPUNIT_ASSERT( parser.getParents().size() == 1 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 3 ); - - parser.parse( "6 -> 24 + -5 + 21 + 21" ); - CPPUNIT_ASSERT( parser.getParents().size() == 1 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 4 ); - - parser.parse( "21+21 -> -6 + 6" ); - CPPUNIT_ASSERT( parser.getParents().size() == 2 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 2 ); - - parser.parse( "23 -> -11|-13 + 11|13" ); - CPPUNIT_ASSERT( parser.getParents().size() == 1 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 2 ); - - parser.parse( "23 -> " ); - CPPUNIT_ASSERT( parser.getParents().size() == 1 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 0 ); - - parser.parse( " -> -11 + 11" ); - CPPUNIT_ASSERT( parser.getParents().size() == 0 ); - CPPUNIT_ASSERT( parser.getChildren().size() == 2 ); - - } - -}; - -/// Registration of the test suite "DecayParserTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( DecayParserTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_testdriver.cxx> diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/FilterRangeTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/FilterRangeTest_CppUnit.cxx deleted file mode 100644 index c832435a188..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/FilterRangeTest_CppUnit.cxx +++ /dev/null @@ -1,286 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the FilterRange class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <stdexcept> -#include <cmath> - -// CLHEP includes -#include "CLHEP/Units/SystemOfUnits.h" - -// AnalysisUtils includes -#include "AnalysisUtils/FilterRange.h" - -class FilterRangeTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite "FilterRangeTest" - CPPUNIT_TEST_SUITE( FilterRangeTest ); - - CPPUNIT_TEST( testConstructor ); - - CPPUNIT_TEST( testSetters ); - CPPUNIT_TEST( testGetters ); - - CPPUNIT_TEST( testRangeRounding ); - - CPPUNIT_TEST( testCopy ); - CPPUNIT_TEST( testCompareRanges ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - -public: - - /// Set up the data members - void setUp() - { - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - } - - /// test various ways of constructing a FilterRange - void testConstructor() - { - FilterRange r1; - CPPUNIT_ASSERT( false == r1.isActive() ); - - FilterRange r2(0., 10.); - CPPUNIT_ASSERT( true == r2.isActive() ); - - FilterRange r3(0., 0.); - CPPUNIT_ASSERT( true == r3.isActive() ); - - FilterRange r4( -FLT_MAX, FLT_MAX ); - CPPUNIT_ASSERT( false == r4.isActive() ); - - } - - /// test the setters - void testSetters() - { - FilterRange range; - - range.setRange( 0., 10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - - range.includeAll(); - CPPUNIT_ASSERT( false == range.isActive() ); - - range.setRange( 0., 10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( range.isInRange( 0. ) ); - CPPUNIT_ASSERT( range.isInRange( 10. ) ); - - range.setRange( -FLT_MAX, 0. ); - CPPUNIT_ASSERT( range.isInRange( -FLT_MAX ) ); - CPPUNIT_ASSERT( range.isInRange( 0. ) ); - - range.setRange( 0., FLT_MAX ); - CPPUNIT_ASSERT( range.isInRange( 0. ) ); - CPPUNIT_ASSERT( range.isInRange( FLT_MAX ) ); - - range.setRange( -FLT_MAX, FLT_MAX ); - CPPUNIT_ASSERT( false == range.isActive() ); - - range.setRange( 0., 10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - - range.setMin( 5. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( !range.isInRange( 0. ) ); - CPPUNIT_ASSERT( range.isInRange( 5. ) ); - CPPUNIT_ASSERT( range.isInRange( 10. ) ); - - range.setMax( 5. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( !range.isInRange( 0. ) ); - CPPUNIT_ASSERT( range.isInRange( 5. ) ); - CPPUNIT_ASSERT( !range.isInRange( 10. ) ); - - range.includeAll(); - CPPUNIT_ASSERT( false == range.isActive() ); - - range.include( 0., 10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( range.isInRange( 0. ) ); - CPPUNIT_ASSERT( range.isInRange( 5. ) ); - CPPUNIT_ASSERT( range.isInRange( 10. ) ); - - range.include( -100., -10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( !range.isInRange( 0. ) ); - CPPUNIT_ASSERT( range.isInRange( -10. ) ); - CPPUNIT_ASSERT( range.isInRange( -100. ) ); - - } - - /// test the getters - void testGetters() - { - FilterRange range; - CPPUNIT_ASSERT( false == range.isActive() ); - CPPUNIT_ASSERT( -FLT_MAX == range.lower() ); - CPPUNIT_ASSERT( -FLT_MAX == range.getMin() ); - CPPUNIT_ASSERT( FLT_MAX == range.upper() ); - CPPUNIT_ASSERT( FLT_MAX == range.getMax() ); - - range.setRange( 0., 10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( 0. == range.lower() ); - CPPUNIT_ASSERT( 0. == range.getMin() ); - CPPUNIT_ASSERT( 10. == range.upper() ); - CPPUNIT_ASSERT( 10. == range.getMax() ); - - range.includeAll(); - CPPUNIT_ASSERT( false == range.isActive() ); - CPPUNIT_ASSERT( -FLT_MAX == range.lower() ); - CPPUNIT_ASSERT( -FLT_MAX == range.getMin() ); - CPPUNIT_ASSERT( FLT_MAX == range.upper() ); - CPPUNIT_ASSERT( FLT_MAX == range.getMax() ); - - range.setMin( 0. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( 0. == range.lower() ); - CPPUNIT_ASSERT( 0. == range.getMin() ); - CPPUNIT_ASSERT( FLT_MAX == range.upper() ); - CPPUNIT_ASSERT( FLT_MAX == range.getMax() ); - - range.setMax( 10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( 0. == range.lower() ); - CPPUNIT_ASSERT( 0. == range.getMin() ); - CPPUNIT_ASSERT( 10. == range.upper() ); - CPPUNIT_ASSERT( 10. == range.getMax() ); - - range.includeAll(); - range.setMax( 10. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( -FLT_MAX == range.lower() ); - CPPUNIT_ASSERT( -FLT_MAX == range.getMin() ); - CPPUNIT_ASSERT( 10. == range.upper() ); - CPPUNIT_ASSERT( 10. == range.getMax() ); - - range.setMin( 0. ); - CPPUNIT_ASSERT( true == range.isActive() ); - CPPUNIT_ASSERT( 0. == range.lower() ); - CPPUNIT_ASSERT( 0. == range.getMin() ); - CPPUNIT_ASSERT( 10. == range.upper() ); - CPPUNIT_ASSERT( 10. == range.getMax() ); - - } - - /// Test range rounding - void testRangeRounding() - { - FilterRange range; - range.setRange( -FLT_MAX+1, FLT_MAX-1 ); - CPPUNIT_ASSERT( false == range.isActive() ); - CPPUNIT_ASSERT( FLT_MAX == FLT_MAX-1 ); - - range.setRange( -FLT_MAX+10, FLT_MAX-10 ); - CPPUNIT_ASSERT( false == range.isActive() ); - CPPUNIT_ASSERT( FLT_MAX == FLT_MAX-10 ); - } - - /// Test the copy of ranges - void testCopy() - { - FilterRange r1; - FilterRange r2; - - CPPUNIT_ASSERT( r1 == r2 ); - CPPUNIT_ASSERT( r2 == r1 ); - - r1.include( 20*GeV, 40*GeV ); - r2.include( 20*GeV, 40*GeV ); - - CPPUNIT_ASSERT( r1 == r2 ); - CPPUNIT_ASSERT( r2 == r1 ); - - CPPUNIT_ASSERT( r1.lower() == r2.lower() ); - CPPUNIT_ASSERT( r1.upper() == r2.upper() ); - - FilterRange r3( r1 ); - CPPUNIT_ASSERT( r1 == r3 ); - CPPUNIT_ASSERT( r3 == r1 ); - CPPUNIT_ASSERT( r1.lower() == r3.lower() ); - CPPUNIT_ASSERT( r1.upper() == r3.upper() ); - - FilterRange r4 = r2; - CPPUNIT_ASSERT( r2 == r4 ); - CPPUNIT_ASSERT( r4 == r2 ); - CPPUNIT_ASSERT( r4.lower() == r2.lower() ); - CPPUNIT_ASSERT( r4.upper() == r2.upper() ); - - } - - /// Test the comparison of ranges - void testCompareRanges() - { - FilterRange r1; - FilterRange r2; - - CPPUNIT_ASSERT( r1 == r1 ); - CPPUNIT_ASSERT( r1 == r2 ); - CPPUNIT_ASSERT( r2 == r1 ); - - r1.include( 10*GeV, 20*GeV ); - r2.include( 10.*GeV, 20.*GeV ); - - CPPUNIT_ASSERT( r1 == r1 ); - CPPUNIT_ASSERT( r1 == r2 ); - CPPUNIT_ASSERT( r2 == r1 ); - - r1.include( 10*GeV, 20*GeV ); - r2.include( 100*GeV, 200*GeV ); - - CPPUNIT_ASSERT( r2 == r2 ); - CPPUNIT_ASSERT( r1 != r2 ); - CPPUNIT_ASSERT( r2 != r1 ); - CPPUNIT_ASSERT( !(r1 == r2) ); - CPPUNIT_ASSERT( !(r2 == r1) ); - - r1.include( 10*GeV, 20*GeV ); - r2.include( 15*GeV, 20*GeV ); - - CPPUNIT_ASSERT( !(r1 == r2) ); - CPPUNIT_ASSERT( !(r2 == r1) ); - CPPUNIT_ASSERT( r1 != r2 ); - CPPUNIT_ASSERT( r2 != r1 ); - - CPPUNIT_ASSERT( !(r1 < r2) ); - CPPUNIT_ASSERT( r2 >= r1 ); - - r1.include( 10*GeV, 10*GeV ); - r2.include( 20*GeV, 20*GeV ); - CPPUNIT_ASSERT( r1 < r2 ); - - r1.include( 10*GeV, 20*GeV ); - r2.include( 20*GeV, 25*GeV ); - CPPUNIT_ASSERT( !(r1 < r2) ); - CPPUNIT_ASSERT( r1 <= r2 ); - - } - -}; - -/// Registration of the test suite "FilterRangeTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( FilterRangeTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_testdriver.cxx> diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/IParticleAssocFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/IParticleAssocFilterTest_CppUnit.cxx deleted file mode 100644 index 3ce5cc84e01..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/IParticleAssocFilterTest_CppUnit.cxx +++ /dev/null @@ -1,507 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the IParticleAssocFilter class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <cmath> - -// CLHEP includes -#include "CLHEP/Units/SystemOfUnits.h" - -#include "AthContainers/DataVector.h" - -// FourMom includes -#include "FourMom/P4PxPyPzE.h" -#include "FourMom/P4EEtaPhiM.h" - -// JetEvent includes -#include "JetEvent/Jet.h" -#include "JetEvent/JetCollection.h" - -// AnalysisAssociation includes -#include "AnalysisAssociation/IParticleAssocFilter.h" - -class IParticleAssocFilterTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite "IParticleAssocFilterTest" - CPPUNIT_TEST_SUITE( IParticleAssocFilterTest ); - - CPPUNIT_TEST( testConstructor ); - CPPUNIT_TEST( testCopyIParticleAssocFilter ); - CPPUNIT_TEST( testSettersAndGetters ); - - CPPUNIT_TEST( testDeltaPxAssoc ); - CPPUNIT_TEST( testDeltaPyAssoc ); - CPPUNIT_TEST( testDeltaPzAssoc ); - CPPUNIT_TEST( testDeltaEneAssoc ); - - CPPUNIT_TEST( testDeltaEtaAssoc ); - CPPUNIT_TEST( testDeltaPhiAssoc ); - CPPUNIT_TEST( testDeltaMassAssoc ); - CPPUNIT_TEST( testDeltaPtAssoc ); - - //CPPUNIT_TEST( testDeltaRAssoc ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - - -public: - - /// Set up the data members - void setUp() - { - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - } - - /// Test asociation filter constructor - void testConstructor() - { - IParticleAssocFilter filter; - CPPUNIT_ASSERT( filter.deltaPxMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPxMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPyMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPyMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPzMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPzMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEneMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEneMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEtaMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaEtaMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPhiMin() == -M_PI ); - CPPUNIT_ASSERT( filter.deltaPhiMax() == M_PI ); - CPPUNIT_ASSERT( filter.deltaMassMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaMassMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPtMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaPtMax() == FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaRMin() == -FLT_MAX ); - CPPUNIT_ASSERT( filter.deltaRMax() == FLT_MAX ); - } - - /// Test that asociation filter cuts are well copied - void testCopyIParticleAssocFilter() - { - IParticleAssocFilter orig; - orig.setDeltaPx ( 10.*GeV, 20.*GeV ); - orig.setDeltaPy ( 10.*GeV, 20.*GeV ); - orig.setDeltaPz ( 10.*GeV, 20.*GeV ); - orig.setDeltaEne( 10.*GeV, 20.*GeV ); - - Jet p1; - Jet p2; - p1.set4Mom( P4PxPyPzE( 100.*GeV, 100*GeV, 100*GeV, 200*GeV ) ); - p2.set4Mom( P4PxPyPzE( 110.*GeV, 110*GeV, 110*GeV, 210*GeV ) ); - CPPUNIT_ASSERT( orig.isAccepted( &p1, &p2 ) ); - - IParticleAssocFilter assoc; - assoc.setDeltaPx( 100.*GeV, 200.*GeV ); - CPPUNIT_ASSERT( !assoc.isAccepted( &p1, &p2 ) ); - - assoc.setFilter( &orig ); - CPPUNIT_ASSERT( assoc.isAccepted( &p1, &p2 ) ); - - // FIXME - //assoc.reset(); - CPPUNIT_ASSERT( assoc.isAccepted( &p1, &p2 ) ); - - IParticleAssocFilter defaultFilter; - CPPUNIT_ASSERT( defaultFilter.isAccepted( &p1, &p2 ) ); - - } - - /// Test the setters and getters of the IParticleAssocFilter class - void testSettersAndGetters() - { - IParticleAssocFilter assocFilter; - const double min = M_PI/2.; - const double max = M_PI; - - CPPUNIT_ASSERT( min < max ); - - assocFilter.setDeltaPx( min, max ); - assocFilter.setDeltaPy( min, max ); - assocFilter.setDeltaPz( min, max ); - assocFilter.setDeltaEne( min, max ); - - assocFilter.setDeltaEta( min, max ); - assocFilter.setDeltaPhi( min, max ); - assocFilter.setDeltaMass( min, max ); - assocFilter.setDeltaPt( min, max ); - - assocFilter.setDeltaR( min, max ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPxMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPxMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPyMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPyMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPzMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPzMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaEneMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaEneMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaEtaMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaEtaMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPhiMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPhiMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaMassMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaMassMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaPtMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaPtMax() ); - - CPPUNIT_ASSERT( min == assocFilter.deltaRMin() ); - CPPUNIT_ASSERT( max == assocFilter.deltaRMax() ); - - /// Explore other interface - IParticleAssocFilter assocFilter2; - - // Max - assocFilter2.setDeltaPxMax( max ); - assocFilter2.setDeltaPyMax( max ); - assocFilter2.setDeltaPzMax( max ); - assocFilter2.setDeltaEneMax( max ); - - assocFilter2.setDeltaEtaMax( max ); - assocFilter2.setDeltaPhiMax( max ); - assocFilter2.setDeltaMassMax( max ); - assocFilter2.setDeltaPtMax( max ); - - assocFilter2.setDeltaRMax( max ); - - // Min - assocFilter2.setDeltaPxMin( min ); - assocFilter2.setDeltaPyMin( min ); - assocFilter2.setDeltaPzMin( min ); - assocFilter2.setDeltaEneMin( min ); - - assocFilter2.setDeltaEtaMin( min ); - assocFilter2.setDeltaPhiMin( min ); - assocFilter2.setDeltaMassMin( min ); - assocFilter2.setDeltaPtMin( min ); - - assocFilter2.setDeltaRMin( min ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPxMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPxMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPyMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPyMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPzMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPzMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaEneMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaEneMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaEtaMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaEtaMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPhiMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPhiMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaMassMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaMassMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaPtMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaPtMax() ); - - CPPUNIT_ASSERT( min == assocFilter2.deltaRMin() ); - CPPUNIT_ASSERT( max == assocFilter2.deltaRMax() ); - - } - - /// Test the association between objects based on their Px - void testDeltaPxAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaPxMin( 0.*GeV ); - assocFilter.setDeltaPxMax( 10.*GeV ); - - Jet p1; - Jet p2; - p1.set4Mom( P4PxPyPzE( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ) ); - p2.set4Mom( P4PxPyPzE( 110.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPxMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their Py - void testDeltaPyAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaPyMin( 0.*GeV ); - assocFilter.setDeltaPyMax( 10.*GeV ); - - Jet p1; - Jet p2; - p1.set4Mom( P4PxPyPzE( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ) ); - p2.set4Mom( P4PxPyPzE( 100.*GeV, 110.*GeV, 100.*GeV, 200.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPyMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their Pz - void testDeltaPzAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaPzMin( 0.*GeV ); - assocFilter.setDeltaPzMax( 10.*GeV ); - - Jet p1; - Jet p2; - - p1.set4Mom( P4PxPyPzE( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ) ); - p2.set4Mom( P4PxPyPzE( 100.*GeV, 100.*GeV, 110.*GeV, 200.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPzMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their energy - void testDeltaEneAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaEneMin( 0.*GeV ); - assocFilter.setDeltaEneMax( 10.*GeV ); - - Jet p1; - Jet p2; - - p1.set4Mom( P4PxPyPzE( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ) ); - p2.set4Mom( P4PxPyPzE( 100.*GeV, 100.*GeV, 100.*GeV, 210.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaEneMax( 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their eta - void testDeltaEtaAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaEtaMin( 0.0 ); - assocFilter.setDeltaEtaMax( 2.5 ); - - Jet p1; - Jet p2; - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 90.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaEtaMax( 2. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, -1.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, -2.5, M_PI/2., 90.*GeV ) ); - - /// Test negative eta - assocFilter.setDeltaEtaMax( 1.5 ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaEta( 2., 3. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - } - - /// Test the association between objects based on their phi - void testDeltaPhiAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaPhiMin( 0.0 ); - assocFilter.setDeltaPhiMax( M_PI/2. ); - - Jet p1; - Jet p2; - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 90.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPhi( 0., M_PI/4. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - /// Test negative phi - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, -M_PI/2., 90.*GeV ) ); - - assocFilter.setDeltaPhi( 0., M_PI/2. ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPhi( 0., M_PI/4. ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - /// Test Modulo - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, 2*M_PI, 90.*GeV ) ); - - assocFilter.setDeltaPhi( 0., 0. ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - /// Test Modulo at discontinuity point - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, M_PI, 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, -M_PI, 90.*GeV ) ); - - assocFilter.setDeltaPhi( 0., 0. ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - /// Test Modulo at discontinuity point - const double denom = 12; - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, M_PI-M_PI/denom, 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, -M_PI+M_PI/denom, 90.*GeV ) ); - - assocFilter.setDeltaPhi( 0., 2*M_PI/denom ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, -M_PI+M_PI/(denom-1), 90.*GeV ) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their mass - void testDeltaMassAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaMassMin( 0.*GeV ); - assocFilter.setDeltaMassMax( 11.*GeV ); - - Jet p1; - Jet p2; - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 110.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 120.*GeV ) ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaMass( 0.*GeV, 9.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaMass( 0.*GeV, 10.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - /// Test the accuracy of P4EEtaPhiM - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 10.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 20.*GeV ) ); - - assocFilter.setDeltaMass( 0.*GeV, 10.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - /// Test the accuracy of P4EEtaPhiM - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 0.0, 0., 80.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 2.5, M_PI/2., 90.*GeV ) ); - - assocFilter.setDeltaMass( 0.*GeV, 10.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - } - - /// Test the association between objects based on their Pt - void testDeltaPtAssoc() - { - IParticleAssocFilter assocFilter; - assocFilter.setDeltaPtMin( 0.*GeV ); - assocFilter.setDeltaPtMax( 200.*GeV ); - - Jet p1; - Jet p2; - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 3., M_PI, 90.*GeV ) ); //> Pt ~= 18 GeV - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 1., 0., 80.*GeV ) ); //> Pt ~= 119 GeV - - CPPUNIT_ASSERT( 17*GeV <= p1.pt() && p1.pt() <= 18*GeV ); - CPPUNIT_ASSERT( 118*GeV <= p2.pt() && p2.pt() <= 119*GeV ); - - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p1) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPtMax( 100.*GeV ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( !assocFilter.isAccepted(&p2, &p1) ); - - assocFilter.setDeltaPt( 100.*GeV, 105.*GeV ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p1, &p2) ); - CPPUNIT_ASSERT( assocFilter.isAccepted(&p2, &p1) ); - - } - -}; - -/// Registration of the test suite "IParticleAssocFilterTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( IParticleAssocFilterTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_SGtestdriver.cxx> diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx deleted file mode 100644 index 972aedbc44d..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx +++ /dev/null @@ -1,712 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the McVtxFilter class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <stdexcept> -#include <cmath> - -// CLHEP includes -#include "CLHEP/Vector/LorentzVector.h" -#include "CLHEP/Units/SystemOfUnits.h" - -// HepMC includes -#include "AtlasHepMC/GenEvent.h" -#include "AtlasHepMC/GenVertex.h" -#include "AtlasHepMC/GenParticle.h" - -#include "AthContainers/DataVector.h" - - -// McParticleUtils includes -#include "McParticleUtils/McVtxFilter.h" - -class McVtxFilterTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite "FilterTest" - CPPUNIT_TEST_SUITE( McVtxFilterTest ); - - CPPUNIT_TEST( testConstructor ); - CPPUNIT_TEST( testCopyMcVtxFilter ); - CPPUNIT_TEST( testSettersAndGetters ); - - CPPUNIT_TEST( testFullVtx ); - - CPPUNIT_TEST( testZeeVertices ); - CPPUNIT_TEST( testTopWbggVertices ); - CPPUNIT_TEST( testWlnuVertices ); - CPPUNIT_TEST( testQuarkVertices ); - - CPPUNIT_TEST( testStableParticle ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - HepMC::GenEvent * m_evt; - int m_bcZee; - int m_bcZgee; - int m_bcTopWbgg; - typedef HepMC::FourVector HLV_t; - -public: - - /// Set up the data members - void setUp() - { - const int signalProcessId = 1000082; - const int evtNbr = 1; - m_evt = new HepMC::GenEvent( signalProcessId, evtNbr ); - m_evt->set_event_scale( -1 ); - m_evt->set_alphaQCD( -1 ); - m_evt->set_alphaQED( -1 ); - std::vector<double> weights(3); - weights[0] = 1; - weights[1] = 1; - weights[2] = 1; - std::vector<long> rdmStates(2); - rdmStates[0] = 85909879; - rdmStates[1] = 9707499; - m_evt->weights() = weights; - m_evt->set_random_states( rdmStates ); - - // Add 2 vertices - HepMC::GenVertex * v1 = new HepMC::GenVertex(); - m_evt->add_vertex( v1 ); - v1->add_particle_in( new HepMC::GenParticle( HLV_t(0,0, - 7000*GeV, - 7000*GeV), - 2212, 3 ) ); - HepMC::GenVertex* v2 = new HepMC::GenVertex; - m_evt->add_vertex( v2 ); - v2->add_particle_in( new HepMC::GenParticle( HLV_t(0,0, - -7000*GeV, - +7000*GeV), - 2212, 3 ) ); - - // - // create the outgoing particles of v1 and v2 - HepMC::GenParticle* p3 = - new HepMC::GenParticle( HLV_t(.750*GeV, - -1.569*GeV, - 32.191*GeV, - 32.238*GeV), 1, 3 ); - v1->add_particle_out( p3 ); - HepMC::GenParticle* p4 = - new HepMC::GenParticle( HLV_t( -3.047*GeV, - -19.*GeV, - -54.629*GeV, - 57.920*GeV), -2, 3 ); - v2->add_particle_out( p4 ); - - // - // create v3 - HepMC::GenVertex* v3 = new HepMC::GenVertex(); - m_evt->add_vertex( v3 ); - v3->add_particle_in( p3 ); - v3->add_particle_in( p4 ); - v3->add_particle_out( - new HepMC::GenParticle( HLV_t(-3.813,0.113,-1.833,4.233 ), - 22, 1 ) - ); - HepMC::GenParticle* p5 = - new HepMC::GenParticle( HLV_t(1.517,-20.68,-20.605,85.925), - -24,3); - v3->add_particle_out( p5 ); - - // - // tell the event which vertex is the signal process vertex - m_evt->set_signal_process_vertex( v3 ); - - // - // add a Z0->4gammas,e+,e- - // - HepMC::GenVertex * vZgee = new HepMC::GenVertex; - m_evt->add_vertex( vZgee ); - // Z0 - vZgee->add_particle_in( new HepMC::GenParticle( HLV_t( -4.49e+04, - +8.36e+03, - -2.70e+05, - +2.89e+05 ), - 23, 2 ) ); - // Gammas - vZgee->add_particle_out( new HepMC::GenParticle( HLV_t( -1.28e+03, - +1.03e+03, - -5.47e+03, - +5.71e+03 ), - 22, 1 ) ); - vZgee->add_particle_out( new HepMC::GenParticle( HLV_t( +3.89e+02, - -3.16e+02, - -6.69e+03, - +6.70e+03 ), - 22, 1 ) ); - vZgee->add_particle_out( new HepMC::GenParticle( HLV_t( +7.34e+00, - -2.71e+01, - -4.12e+01, - +4.98e+01 ), - 22, 1 ) ); - vZgee->add_particle_out( new HepMC::GenParticle( HLV_t( -1.36e+02, - +9.38e+01, - -5.62e+02, - +5.86e+02 ), - 22, 1 ) ); - // Electrons - vZgee->add_particle_out( new HepMC::GenParticle( HLV_t( +8.01e+03, - -2.96e+04, - -4.50e+04, - +5.44e+04 ), - -11, 1 ) ); - vZgee->add_particle_out( new HepMC::GenParticle( HLV_t( -5.19e+04, - +3.72e+04, - -2.13e+05, - +2.22e+05 ), - 11, 1 ) ); - // store its barcode for later use - m_bcZgee = vZgee->barcode(); - - // - // Add a Z->e+e- - HepMC::GenVertex * vZee = new HepMC::GenVertex; - m_evt->add_vertex( vZee ); - vZee->add_particle_in( new HepMC::GenParticle( HLV_t( +7.29e+03, - +2.34e+04, - +2.81e+05, - +2.96e+05 ), - 23, 2 ) ); - - vZee->add_particle_out( new HepMC::GenParticle( HLV_t( +2.74e+04, - -1.83e+04, - +4.70e+04, - +5.74e+04 ), - 11, 1 ) ); - vZee->add_particle_out( new HepMC::GenParticle( HLV_t( -2.01e+04, - +4.17e+04, - +2.34e+05, - +2.38e+05 ), - -11, 1 ) ); - m_bcZee = vZee->barcode(); - - // - // Add a t->W+bgg - HepMC::GenVertex * vtWbgg = new HepMC::GenVertex; - m_evt->add_vertex( vtWbgg ); - // top - vtWbgg->add_particle_in(new HepMC::GenParticle(HLV_t(-2.35e+05, - +7.34e+04, - +3.60e+04, - +3.04e+05), - 6, 3 ) ); - - // Wbgg - vtWbgg->add_particle_out(new HepMC::GenParticle(HLV_t(-1.09e+05, - +6.99e+04, - -3.86e+04, - +1.57e+05), - 24, 2 ) ); - vtWbgg->add_particle_out(new HepMC::GenParticle(HLV_t(-9.23e+04, - +2.54e+03, - +5.32e+04, - +1.07e+05), - 5, 2 ) ); - vtWbgg->add_particle_out(new HepMC::GenParticle(HLV_t(-4.76e+03, - +6.72e+02, - +2.90e+03, - +5.62e+03), - 21, 2 ) ); - vtWbgg->add_particle_out(new HepMC::GenParticle(HLV_t(-2.93e+04, - +2.13e+02, - +1.85e+04, - +3.46e+04), - 21, 2 ) ); - m_bcTopWbgg = vtWbgg->barcode(); - - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - if ( m_evt ) { - delete m_evt; - m_evt = 0; - } - } - - /// Test the McVtxFilter constructors - void testConstructor() - { - const unsigned int defaultCand = 0; - McVtxFilter filter; - CPPUNIT_ASSERT( false == filter.matchSign() ); - CPPUNIT_ASSERT( false == filter.matchBranches() ); - CPPUNIT_ASSERT( "" == filter.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == filter.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == filter.childList().size() ); - - McVtxFilter f2( false, false ); - CPPUNIT_ASSERT( false == f2.matchSign() ); - CPPUNIT_ASSERT( false == f2.matchBranches() ); - CPPUNIT_ASSERT( "" == f2.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == f2.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == f2.childList().size() ); - - McVtxFilter f3( true, false ); - CPPUNIT_ASSERT( true == f3.matchSign() ); - CPPUNIT_ASSERT( false == f3.matchBranches() ); - CPPUNIT_ASSERT( "" == f3.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == f3.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == f3.childList().size() ); - - McVtxFilter f4( false, true ); - CPPUNIT_ASSERT( false == f4.matchSign() ); - CPPUNIT_ASSERT( true == f4.matchBranches() ); - CPPUNIT_ASSERT( "" == f4.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == f4.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == f4.childList().size() ); - - McVtxFilter f5( f4 ); - CPPUNIT_ASSERT( false == f5.matchSign() ); - CPPUNIT_ASSERT( true == f5.matchBranches() ); - CPPUNIT_ASSERT( "" == f5.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == f5.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == f5.childList().size() ); - - McVtxFilter f6 = f4; - CPPUNIT_ASSERT( false == f6.matchSign() ); - CPPUNIT_ASSERT( true == f6.matchBranches() ); - CPPUNIT_ASSERT( "" == f6.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == f6.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == f6.childList().size() ); - - } - - /// Test that McVtxFilter cuts are well copied - void testCopyMcVtxFilter() - { - const unsigned int defaultCand = 0; - McVtxFilter filter( false, true ); - CPPUNIT_ASSERT( false == filter.matchSign() ); - CPPUNIT_ASSERT( true == filter.matchBranches() ); - CPPUNIT_ASSERT( "" == filter.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == filter.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == filter.childList().size() ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - - filter.setDecayPattern( "6 -> 24 + -5" ); - CPPUNIT_ASSERT( "6 -> 24 + -5" == filter.decayPattern() ); - CPPUNIT_ASSERT( 1 == filter.parentList().size() ); - CPPUNIT_ASSERT( 2 == filter.childList().size() ); - CPPUNIT_ASSERT( true == filter.isFullVtx() ); - - McVtxFilter copy; - CPPUNIT_ASSERT( false == copy.matchSign() ); - CPPUNIT_ASSERT( false == copy.matchBranches() ); - CPPUNIT_ASSERT( "" == copy.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == copy.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == copy.childList().size() ); - CPPUNIT_ASSERT( false == copy.isFullVtx() ); - - copy.setFilter( &filter ); - CPPUNIT_ASSERT( false == copy.matchSign() ); - CPPUNIT_ASSERT( true == copy.matchBranches() ); - CPPUNIT_ASSERT( "6 -> 24 + -5" == copy.decayPattern() ); - CPPUNIT_ASSERT( 1 == copy.parentList().size() ); - CPPUNIT_ASSERT( 2 == copy.childList().size() ); - CPPUNIT_ASSERT( true == copy.isFullVtx() ); - } - - /// Test setters and getters - void testSettersAndGetters() - { - std::cout << std::endl; - // - // Print event - // - m_evt->print(); - - const unsigned int defaultCand = 0; - McVtxFilter filter( false, true ); - CPPUNIT_ASSERT( false == filter.matchSign() ); - CPPUNIT_ASSERT( true == filter.matchBranches() ); - CPPUNIT_ASSERT( "" == filter.decayPattern() ); - CPPUNIT_ASSERT( defaultCand == filter.parentList().size() ); - CPPUNIT_ASSERT( defaultCand == filter.childList().size() ); - - filter.setMatchSign( true ); - CPPUNIT_ASSERT( true == filter.matchSign() ); - filter.setMatchSign( false ); - CPPUNIT_ASSERT( false == filter.matchSign() ); - - filter.setMatchBranches( false ); - CPPUNIT_ASSERT( false == filter.matchBranches() ); - filter.setMatchBranches( true ); - CPPUNIT_ASSERT( true == filter.matchBranches() ); - - filter.setDecayPattern( "6 -> 24 + -5" ); - CPPUNIT_ASSERT( "6 -> 24 + -5" == filter.decayPattern() ); - CPPUNIT_ASSERT( 1 == filter.parentList().size() ); - CPPUNIT_ASSERT( 2 == filter.childList().size() ); - - filter.setDecayPattern( "23 -> -11|-13 + 11|13|15" ); - CPPUNIT_ASSERT( "23 -> -11|-13 + 11|13|15" == filter.decayPattern() ); - CPPUNIT_ASSERT( 1 == filter.parentList().size() ); - CPPUNIT_ASSERT( 2 == filter.childList().size() ); - - bool matchSign = false; - CPPUNIT_ASSERT( (filter.parentList()[0])->hasInList(PDG::Z0, matchSign) ); - matchSign = true; - CPPUNIT_ASSERT( (filter.parentList()[0])->hasInList(PDG::Z0, matchSign) ); - - matchSign = false; - CPPUNIT_ASSERT((filter.childList()[0])->hasInList(PDG::e_plus, matchSign)); - CPPUNIT_ASSERT((filter.childList()[0])->hasInList(PDG::mu_plus,matchSign)); - matchSign = true; - CPPUNIT_ASSERT((filter.childList()[0])->hasInList(PDG::e_plus, matchSign)); - CPPUNIT_ASSERT((filter.childList()[0])->hasInList(PDG::mu_plus,matchSign)); - - matchSign = true; - CPPUNIT_ASSERT(!(filter.childList()[0])->hasInList( PDG::e_minus, - matchSign)); - CPPUNIT_ASSERT(!(filter.childList()[0])->hasInList( PDG::mu_minus, - matchSign)); - - CPPUNIT_ASSERT( 1 == (filter.parentList()[0])->size() ); - std::vector<PDG::pidType> parent; - for ( std::list<PDG::pidType>::const_iterator itr = - (filter.parentList()[0])->begin(); - itr != (filter.parentList()[0])->end(); - ++itr ) { - parent.push_back( *itr ); - } - - CPPUNIT_ASSERT( PDG::Z0 == parent[0] ); - - CPPUNIT_ASSERT( 2 == (filter.childList()[0])->size() ); - std::vector<PDG::pidType> child1; - for ( std::list<PDG::pidType>::const_iterator itr = - (filter.childList()[0])->begin(); - itr != (filter.childList()[0])->end(); - ++itr ) { - child1.push_back( *itr ); - } - CPPUNIT_ASSERT( 2 == child1.size() ); - CPPUNIT_ASSERT( PDG::e_plus == child1[0] ); - CPPUNIT_ASSERT( PDG::mu_plus == child1[1] ); - - CPPUNIT_ASSERT( 3 == (filter.childList()[1])->size() ); - std::vector<PDG::pidType> child2; - for ( std::list<PDG::pidType>::const_iterator itr = - (filter.childList()[1])->begin(); - itr != (filter.childList()[1])->end(); - ++itr ) { - child2.push_back( *itr ); - } - CPPUNIT_ASSERT( 3 == child2.size() ); - - CPPUNIT_ASSERT( PDG::e_minus == child2[0] ); - CPPUNIT_ASSERT( PDG::mu_minus == child2[1] ); - CPPUNIT_ASSERT( PDG::tau_minus == child2[2] ); - - } - - /// Test full vtx - void testFullVtx() - { - HepMC::GenVertex * vtx = new HepMC::GenVertex; - m_evt->add_vertex( vtx ); - vtx->add_particle_in( new HepMC::GenParticle( HLV_t( -2.45e+04, - +1.88e+04, - -8.65e+05, - +8.65e+05 ), - 22, 3 ) ); - vtx->add_particle_out( new HepMC::GenParticle( HLV_t( -2.45e+04, - +1.88e+04, - -8.65e+05, - +8.65e+05 ), - 22, 1 ) ); - - McVtxFilter filter; - filter.setDecayPattern( "22->" ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - CPPUNIT_ASSERT( filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "->22" ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - CPPUNIT_ASSERT( filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "24->-24" ); - CPPUNIT_ASSERT( true == filter.isFullVtx() ); - CPPUNIT_ASSERT( !filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "-> -24 + 24" ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - CPPUNIT_ASSERT( !filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "22 -> -11 + 11" ); - CPPUNIT_ASSERT( true == filter.isFullVtx() ); - CPPUNIT_ASSERT( !filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "22 -> -11" ); - CPPUNIT_ASSERT( true == filter.isFullVtx() ); - CPPUNIT_ASSERT( !filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "22 -> 22" ); - CPPUNIT_ASSERT( true == filter.isFullVtx() ); - CPPUNIT_ASSERT( filter.isAccepted( vtx ) ); - - } - - /// Test some vertices - void testZeeVertices() - { - McVtxFilter filter; - filter.setDecayPattern( "23 -> -11 + 11" ); - - const HepMC::GenVertex * vtx = m_evt->barcode_to_vertex(m_bcZee); - CPPUNIT_ASSERT( 0 != vtx ); - - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - filter.setMatchSign( true ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - filter.setMatchBranches( true ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - // Retrieve a vtx with FSR showering - vtx = m_evt->barcode_to_vertex(m_bcZgee); - CPPUNIT_ASSERT( 0 != vtx ); - - filter.setMatchSign( false ); - filter.setMatchBranches( true ); - CPPUNIT_ASSERT( !filter.isAccepted(vtx) ); - - filter.setMatchSign( false ); - filter.setMatchBranches( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - filter.setMatchSign( true ); - filter.setMatchBranches( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - filter.setMatchSign( true ); - filter.setMatchBranches( true ); - CPPUNIT_ASSERT( !filter.isAccepted(vtx) ); - } - - /// Test some vertices - void testTopWbggVertices() - { - const HepMC::GenVertex * vtx = m_evt->barcode_to_vertex(m_bcTopWbgg); - CPPUNIT_ASSERT( 0 != vtx ); - - { - McVtxFilter filter; - filter.setDecayPattern( "6 -> 24 + 5" ); - - filter.setMatchSign( true ); - filter.setMatchBranches( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - filter.setMatchSign( true ); - filter.setMatchBranches( true ); - CPPUNIT_ASSERT( !filter.isAccepted(vtx) ); - - filter.setMatchSign( false ); - filter.setMatchBranches( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - filter.setMatchSign( false ); - filter.setMatchBranches( true ); - CPPUNIT_ASSERT( !filter.isAccepted(vtx) ); - } - } - - /// Test some vertices - void testWlnuVertices() - { - - HepMC::GenVertex * vtx = new HepMC::GenVertex; - m_evt->add_vertex( vtx ); - vtx->add_particle_in( new HepMC::GenParticle( HLV_t( -6.76e+04, - +4.85e+03, - -1.46e+03, - +9.51e+04 ), - -24, 2 ) ); - vtx->add_particle_out( new HepMC::GenParticle( HLV_t( -7.14e+04, - -6.17e+03, - +1.67e+04, - +7.36e+04 ), - 13, 1 ) ); - - vtx->add_particle_out( new HepMC::GenParticle( HLV_t( +3.75e+03, - +1.10e+04, - -1.81e+04, - +2.15e+04 ), - -14, 1 ) ); - //const int bcWlnu = vtx->barcode(); - - McVtxFilter filter; - filter.setDecayPattern( "24 -> -13 + -14" ); - - filter.setMatchSign( true ); - CPPUNIT_ASSERT( !filter.isAccepted(vtx) ); - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - filter.setDecayPattern( "-24 -> 13 + -14" ); - filter.setMatchSign( true ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtx) ); - - } - - /* -GenVertex: -5 ID: 0 (X,cT):0 - I: 2 5 21 +1.23e+04,-4.79e+03,+6.52e+04,+6.65e+04 3 -5 - 6 21 +1.14e+02,+1.35e+04,-6.42e+04,+6.56e+04 3 -5 - O: 2 7 5 +4.56e+04,+1.53e+04,-5.08e+04,+7.01e+04 3 -8 - 8 -5 -3.32e+04,-6.56e+03,+5.18e+04,+6.20e+04 3 -9 -GenVertex: -39 ID: 0 (X,cT):0 - I: 1 158 -5 -3.21e+04,-6.19e+03,+5.05e+04,+6.38e+04 2 -39 - O: 2 159 -5 -1.29e+04,+1.12e+03,+3.50e+04,+3.77e+04 2 -92 - 160 21 -1.92e+04,-7.30e+03,+1.55e+04,+2.61e+04 2 -40 - */ - - /// Test some vertices - void testQuarkVertices() - { - // create a b->g+b vertex - HepMC::GenVertex * vtxgb = new HepMC::GenVertex; - m_evt->add_vertex( vtxgb ); - vtxgb->add_particle_in( new HepMC::GenParticle( HLV_t( -3.21e+04, - -6.19e+03, - +5.05e+04, - +6.38e+04 ), - -5, 2 ) ); - vtxgb->add_particle_out( new HepMC::GenParticle( HLV_t( -1.29e+04, - +1.12e+03, - +3.50e+04, - +3.77e+04 ), - -5, 2 ) ); - - vtxgb->add_particle_out( new HepMC::GenParticle( HLV_t( -1.92e+04, - -7.30e+03, - +1.55e+04, - +2.61e+04 ), - 21, 2 ) ); - - // create a gg->b+bbar vertex - HepMC::GenVertex * vtxbb = new HepMC::GenVertex; - m_evt->add_vertex( vtxbb ); - vtxbb->add_particle_in( new HepMC::GenParticle( HLV_t( +1.23e+04, - -4.79e+03, - +6.52e+04, - +6.65e+04 ), - 21, 3 ) ); - vtxbb->add_particle_in( new HepMC::GenParticle( HLV_t( +1.14e+02, - +1.35e+04, - -6.42e+04, - +6.56e+04 ), - 21, 3 ) ); - vtxbb->add_particle_out( new HepMC::GenParticle( HLV_t( +4.56e+04, - +1.53e+04, - -5.08e+04, - +7.01e+04 ), - 5, 3 ) ); - - vtxbb->add_particle_out( new HepMC::GenParticle( HLV_t( -3.32e+04, - -6.56e+03, - +5.18e+04, - +6.20e+04 ), - -5, 3 ) ); - - McVtxFilter filter; - filter.setDecayPattern( " -> -5 + 5" ); - - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtxbb) ); - CPPUNIT_ASSERT( !filter.isAccepted(vtxgb) ); - - filter.setMatchSign( true ); - CPPUNIT_ASSERT( filter.isAccepted(vtxbb) ); - CPPUNIT_ASSERT( !filter.isAccepted(vtxgb) ); - - filter.setDecayPattern( "21+21 -> -5 + 5" ); - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtxbb) ); - CPPUNIT_ASSERT( !filter.isAccepted(vtxgb) ); - - filter.setMatchSign( true ); - CPPUNIT_ASSERT( filter.isAccepted(vtxbb) ); - CPPUNIT_ASSERT( !filter.isAccepted(vtxgb) ); - - filter.setMatchBranches(true); - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted(vtxbb) ); - CPPUNIT_ASSERT( !filter.isAccepted(vtxgb) ); - - filter.setMatchSign( true ); - CPPUNIT_ASSERT( filter.isAccepted(vtxbb) ); - CPPUNIT_ASSERT( !filter.isAccepted(vtxgb) ); - - } - - /// Test Stable particles (no end_vertex) - void testStableParticle() - { - HepMC::GenVertex * vtx = new HepMC::GenVertex; - m_evt->add_vertex( vtx ); - vtx->add_particle_in( new HepMC::GenParticle( HLV_t( -2.45e+04, - +1.88e+04, - -8.65e+05, - +8.65e+05 ), - 23, 3 ) ); - HepMC::GenParticle * photon = 0; - photon = new HepMC::GenParticle( HLV_t( -2.45e+04, - +1.88e+04, - -8.65e+05, - +8.65e+05 ), - 22, 1 ); - vtx->add_particle_out( photon ); - - // no end_vertex so : particle is stable - CPPUNIT_ASSERT( photon->end_vertex() == 0 ); - - McVtxFilter filter; - filter.setDecayPattern( "23->" ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - CPPUNIT_ASSERT( filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "22->" ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - CPPUNIT_ASSERT( !filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "->23" ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - CPPUNIT_ASSERT( !filter.isAccepted( vtx ) ); - - filter.setDecayPattern( "->22" ); - CPPUNIT_ASSERT( false == filter.isFullVtx() ); - CPPUNIT_ASSERT( filter.isAccepted( vtx ) ); - - } - -}; - -/// Registration of the test suite "McVtxFilterTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( McVtxFilterTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_SGtestdriver.cxx> diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/MomentumFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/MomentumFilterTest_CppUnit.cxx deleted file mode 100644 index 0aaafa13e21..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/MomentumFilterTest_CppUnit.cxx +++ /dev/null @@ -1,664 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the MomentumFilter class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <stdexcept> -#include <cmath> - -// CLHEP includes -#include "CLHEP/Units/SystemOfUnits.h" - -#include "AthContainers/DataVector.h" - -// EventKernel -#include "EventKernel/I4Momentum.h" -#include "EventKernel/IParticle.h" - -// FourMom includes -#include "FourMom/P4PxPyPzE.h" -#include "FourMom/P4EEtaPhiM.h" - -// AnalysisUtils includes -#include "AnalysisUtils/MomentumFilter.h" - -class MomentumFilterTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite "MomentumFilterTest" - CPPUNIT_TEST_SUITE( MomentumFilterTest ); - - CPPUNIT_TEST( testCopyMomentumFilter ); - - CPPUNIT_TEST( testSettersAndGetters ); - CPPUNIT_TEST( testModuloPhi ); - - CPPUNIT_TEST( testPxFilter ); - CPPUNIT_TEST( testPyFilter ); - CPPUNIT_TEST( testPzFilter ); - CPPUNIT_TEST( testEneFilter ); - - CPPUNIT_TEST( testEtaFilter ); - CPPUNIT_TEST( testPhiFilter ); - CPPUNIT_TEST( testMassFilter ); - CPPUNIT_TEST( testPtFilter ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - -public: - - /// Set up the data members - void setUp() - { - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - } - - /// Test that momentum filter cuts are well copied - void testCopyMomentumFilter() - { - MomentumFilter<I4Momentum> orig; - orig.setRange( "px", 100.*GeV, 120.*GeV ); - orig.setRange( "py", 100.*GeV, 120.*GeV ); - orig.setRange( "pz", 100.*GeV, 120.*GeV ); - orig.setRange( "ene",200.*GeV, 200.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100*GeV, 100*GeV, 200*GeV ); - P4PxPyPzE p2( 110.*GeV, 110*GeV, 110*GeV, 210*GeV ); - - CPPUNIT_ASSERT( orig.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( !orig.isAccepted( &p2 ) ); - - { - MomentumFilter<I4Momentum> filter; - filter.setEneMin( 205.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( filter.isAccepted( &p2 ) ); - - filter.setFilter( &orig ); - CPPUNIT_ASSERT( filter.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( !filter.isAccepted( &p2 ) ); - } - { - MomentumFilter<I4Momentum> filter; - filter.setEneMin( 205.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( filter.isAccepted( &p2 ) ); - - filter = orig; - CPPUNIT_ASSERT( filter.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( !filter.isAccepted( &p2 ) ); - } - { - MomentumFilter<I4Momentum> filter = orig; - CPPUNIT_ASSERT( filter.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( !filter.isAccepted( &p2 ) ); - } - { - MomentumFilter<I4Momentum> filter(orig); - CPPUNIT_ASSERT( filter.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( !filter.isAccepted( &p2 ) ); - } - } - - /// Test the setters and getters - void testSettersAndGetters() - { - MomentumFilter<I4Momentum> orig; - - MomentumFilter<I4Momentum> filter; - CPPUNIT_ASSERT( -FLT_MAX == filter.pxMin() ); - CPPUNIT_ASSERT( +FLT_MAX == filter.pxMax() ); - CPPUNIT_ASSERT( -FLT_MAX == filter.pyMin() ); - CPPUNIT_ASSERT( +FLT_MAX == filter.pyMax() ); - CPPUNIT_ASSERT( -FLT_MAX == filter.pzMin() ); - CPPUNIT_ASSERT( +FLT_MAX == filter.pzMax() ); - CPPUNIT_ASSERT( -FLT_MAX == filter.eneMin() ); - CPPUNIT_ASSERT( +FLT_MAX == filter.eneMax() ); - CPPUNIT_ASSERT( -FLT_MAX == filter.etaMin() ); - CPPUNIT_ASSERT( +FLT_MAX == filter.etaMax() ); - CPPUNIT_ASSERT( -M_PI == filter.phiMin() ); - CPPUNIT_ASSERT( +M_PI == filter.phiMax() ); - CPPUNIT_ASSERT( -FLT_MAX == filter.massMin() ); - CPPUNIT_ASSERT( +FLT_MAX == filter.massMax() ); - CPPUNIT_ASSERT( -FLT_MAX == filter.ptMin() ); - CPPUNIT_ASSERT( +FLT_MAX == filter.ptMax() ); - - double min = 10*GeV; - double max = 100*GeV; - - // Px - filter.setFilter( &orig ); - filter.setPxMin( min ); - filter.setPxMax( max ); - CPPUNIT_ASSERT( min == filter.pxMin() ); - CPPUNIT_ASSERT( max == filter.pxMax() ); - - // Py - filter.setFilter( &orig ); - filter.setPyMin( min ); - filter.setPyMax( max ); - CPPUNIT_ASSERT( min == filter.pyMin() ); - CPPUNIT_ASSERT( max == filter.pyMax() ); - - // Pz - filter.setFilter( &orig ); - filter.setPzMin( min ); - filter.setPzMax( max ); - CPPUNIT_ASSERT( min == filter.pzMin() ); - CPPUNIT_ASSERT( max == filter.pzMax() ); - - // Ene - filter.setFilter( &orig ); - filter.setEneMin( min ); - filter.setEneMax( max ); - CPPUNIT_ASSERT( min == filter.eneMin() ); - CPPUNIT_ASSERT( max == filter.eneMax() ); - - // Eta - filter.setFilter( &orig ); - filter.setEtaMin( 1. ); - filter.setEtaMax( 2.5 ); - CPPUNIT_ASSERT( 1 == filter.etaMin() ); - CPPUNIT_ASSERT( 2.5 == filter.etaMax() ); - - // Phi - filter.setFilter( &orig ); - filter.setPhiMin( -M_PI ); - filter.setPhiMax( +M_PI ); - CPPUNIT_ASSERT( -M_PI == filter.phiMin() ); - CPPUNIT_ASSERT( +M_PI == filter.phiMax() ); - - // Mass - filter.setFilter( &orig ); - filter.setMassMin( min ); - filter.setMassMax( max ); - CPPUNIT_ASSERT( min == filter.massMin() ); - CPPUNIT_ASSERT( max == filter.massMax() ); - - // Pt - filter.setFilter( &orig ); - filter.setPtMin( min ); - filter.setPtMax( max ); - CPPUNIT_ASSERT( min == filter.ptMin() ); - CPPUNIT_ASSERT( max == filter.ptMax() ); - - - min = 20*GeV; - max = 200*GeV; - - // Px - filter.setFilter( &orig ); - filter.setRange( "px", min, max ); - CPPUNIT_ASSERT( min == filter.pxMin() ); - CPPUNIT_ASSERT( max == filter.pxMax() ); - - // Py - filter.setFilter( &orig ); - filter.setRange( "py", min, max ); - CPPUNIT_ASSERT( min == filter.pyMin() ); - CPPUNIT_ASSERT( max == filter.pyMax() ); - - // Pz - filter.setFilter( &orig ); - filter.setRange( "pz", min, max ); - CPPUNIT_ASSERT( min == filter.pzMin() ); - CPPUNIT_ASSERT( max == filter.pzMax() ); - - // Ene - filter.setFilter( &orig ); - filter.setRange( "ene", min, max ); - CPPUNIT_ASSERT( min == filter.eneMin() ); - CPPUNIT_ASSERT( max == filter.eneMax() ); - - // Eta - filter.setFilter( &orig ); - filter.setRange( "eta", 1., 2.5 ); - CPPUNIT_ASSERT( 1 == filter.etaMin() ); - CPPUNIT_ASSERT( 2.5 == filter.etaMax() ); - - // Phi - filter.setFilter( &orig ); - filter.setRange( "phi", -M_PI, +M_PI ); - CPPUNIT_ASSERT( -M_PI == filter.phiMin() ); - CPPUNIT_ASSERT( +M_PI == filter.phiMax() ); - filter.setFilter( &orig ); - filter.setRange( "phi", 0., +M_PI/2 ); - CPPUNIT_ASSERT( 0 == filter.phiMin() ); - CPPUNIT_ASSERT( +M_PI/2 == filter.phiMax() ); - filter.setFilter( &orig ); - filter.setRange( "phi", M_PI/2, +M_PI ); - CPPUNIT_ASSERT( M_PI/2 == filter.phiMin() ); - CPPUNIT_ASSERT( +M_PI == filter.phiMax() ); - filter.setFilter( &orig ); - filter.setRange( "phi", M_PI, 3*M_PI/2 ); - CPPUNIT_ASSERT( -M_PI/2 == filter.phiMin() ); - CPPUNIT_ASSERT( M_PI == filter.phiMax() ); - filter.setFilter( &orig ); - filter.setRange( "phi", 3*M_PI/2, 4*M_PI/2 ); - CPPUNIT_ASSERT( -M_PI/2 == filter.phiMin() ); - CPPUNIT_ASSERT( 0 == filter.phiMax() ); - - // Mass - filter.setFilter( &orig ); - filter.setRange( "mass", min, max ); - CPPUNIT_ASSERT( min == filter.massMin() ); - CPPUNIT_ASSERT( max == filter.massMax() ); - - // Pt - filter.setFilter( &orig ); - filter.setRange( "pt", min, max ); - CPPUNIT_ASSERT( min == filter.ptMin() ); - CPPUNIT_ASSERT( max == filter.ptMax() ); - - } - - /// Test the phi modulation - void testModuloPhi() - { - MomentumFilter<I4Momentum> filter; - - CPPUNIT_ASSERT( -M_PI == filter.atlasPhi( -M_PI ) ); - CPPUNIT_ASSERT( M_PI == filter.atlasPhi( M_PI ) ); - CPPUNIT_ASSERT( -M_PI != filter.atlasPhi( M_PI ) ); - CPPUNIT_ASSERT( M_PI != filter.atlasPhi( -M_PI ) ); - - CPPUNIT_ASSERT( 0 == filter.atlasPhi( 0 ) ); - CPPUNIT_ASSERT( M_PI != filter.atlasPhi( 0 ) ); - CPPUNIT_ASSERT( -M_PI != filter.atlasPhi( 0 ) ); - - CPPUNIT_ASSERT( M_PI/2 != filter.atlasPhi( 0 ) ); - CPPUNIT_ASSERT( -M_PI/2 != filter.atlasPhi( 0 ) ); - - filter.setRange( "phi", M_PI/2, M_PI ); - P4EEtaPhiM p1( 200.*GeV, 1., 0., 5.*GeV ); - - CPPUNIT_ASSERT( M_PI/2 == filter.phiMin() ); - CPPUNIT_ASSERT( M_PI == filter.phiMax() ); - CPPUNIT_ASSERT( 0 == filter.atlasPhi( p1.phi() ) ); - - CPPUNIT_ASSERT( -M_PI != filter.phiMin() ); - CPPUNIT_ASSERT( +M_PI == filter.phiMax() ); - - CPPUNIT_ASSERT( -M_PI != filter.atlasPhi(filter.phiMin()) || - +M_PI != filter.atlasPhi(filter.phiMax()) ); - CPPUNIT_ASSERT( !( (filter.phiMin() <= filter.atlasPhi(p1.phi()) && - filter.phiMax() >= filter.atlasPhi(p1.phi()) ) ) ); - CPPUNIT_ASSERT( !filter.isAccepted( &p1 ) ); - } - - /// Test filtering objects based on their Px - void testPxFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setPxMin( 0.*GeV ); - filter.setPxMax( 100.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 110.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setPxMax( 110.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setPxMin( 110.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "px", 0.*GeV, 100.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "px", 0.*GeV, 110.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "px", 105.*GeV, 110.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - } - - /// Test filtering objects based on their Py - void testPyFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setPyMin( 0.*GeV ); - filter.setPyMax( 100.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 100.*GeV, 110.*GeV, 100.*GeV, 200.*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setPyMax( 110.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setPyMin( 110.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "py", 0.*GeV, 100.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "py", 105.*GeV, 110.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - } - - /// Test filtering objects based on their Pz - void testPzFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setPzMin( 0.*GeV ); - filter.setPzMax( 100.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 100.*GeV, 100.*GeV, 110.*GeV, 200.*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setPzMax( 110.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setPzMin( 110.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "pz", 0.*GeV, 100.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "pz", 105.*GeV, 110.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - } - - /// Test filtering objects based on their Ene - void testEneFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setEneMin( 0.*GeV ); - filter.setEneMax( 200.*GeV ); - - P4PxPyPzE p1( 100.*GeV, 100.*GeV, 100.*GeV, 200.*GeV ); - P4PxPyPzE p2( 100.*GeV, 100.*GeV, 100.*GeV, 210.*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setEneMax( 210.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setEneMin( 210.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "ene", 0.*GeV, 200.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "ene", 205.*GeV, 210.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - } - - /// Test filtering objects based on their Eta - void testEtaFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setEtaMin( 0.0 ); - filter.setEtaMax( 2.5 ); - - P4EEtaPhiM p1( 200.*GeV, 1., M_PI, 5.*GeV ); - P4EEtaPhiM p2( 200.*GeV, 3., M_PI, 5.*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setEtaMax( 3. ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setEtaMin( 2.5 ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "eta", 0., 2.5 ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "eta", 2.5, 3. ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - /// Explore negative eta - p1.set4Mom( P4EEtaPhiM( 200.*GeV, -1., M_PI, 5.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, -3., M_PI, 5.*GeV ) ); - - filter.setEtaMin( -2.5 ); - filter.setEtaMax( 0.0 ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setEtaMin( -3. ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setEtaMax( -2.5 ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "eta", -2.5, 0. ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "eta", -3., -2.5 ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - } - - /// Test filtering objects based on their Phi - void testPhiFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setPhiMin( 0.0 ); - filter.setPhiMax( M_PI/2. ); - - P4EEtaPhiM p1( 200.*GeV, 1., 0., 5.*GeV ); - P4EEtaPhiM p2( 200.*GeV, 3., M_PI, 5.*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setPhiMax( M_PI ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setPhiMin( M_PI/2. ); - CPPUNIT_ASSERT( M_PI/2 == filter.phiMin() && - M_PI == filter.phiMax() ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "phi", 0., M_PI/2. ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "phi", M_PI/2., M_PI ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - /// Explore negative phi - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 1., 0., 5.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 3., -M_PI, 5.*GeV ) ); - - filter.setPhiMin( -M_PI/2. ); - filter.setPhiMax( 0.0 ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setPhiMin( -M_PI ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setPhiMax( -M_PI/2. ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "phi", -M_PI/2., 0. ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "phi", -M_PI, -M_PI/2. ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "phi", -M_PI/2, -M_PI ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - /// - /// Explore modulo phi - /// - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 1., 0., 5.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 3., 2*M_PI, 5.*GeV ) ); - - // No phi range policy enforced on the 4-vectors - CPPUNIT_ASSERT( 0. == p1.phi() ); - CPPUNIT_ASSERT( 2*M_PI == p2.phi() ); - - filter.setRange( "phi", 0., 0. ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "phi", 2*M_PI, 2*M_PI ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - p1.set4Mom( P4EEtaPhiM( 200.*GeV, 1., M_PI/2., 5.*GeV ) ); - p2.set4Mom( P4EEtaPhiM( 200.*GeV, 3., -3*M_PI/2., 5.*GeV ) ); - - filter.setRange( "phi", M_PI/2., M_PI/2. ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "phi", -3*M_PI/2, -3*M_PI/2 ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "phi", -3*M_PI/2, M_PI/2 ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "phi", M_PI/2, -3*M_PI/2 ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - // test that even if phiRange=[-PI, PI[, the phi range is *not* active - MomentumFilter<I4Momentum> phiFilter; - CPPUNIT_ASSERT( phiFilter.isAccepted( &p1 ) ); - CPPUNIT_ASSERT( phiFilter.isAccepted( &p2 ) ); - } - - /// Test filtering objects based on their Mass - void testMassFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setMassMin( 0.*GeV ); - filter.setMassMax( 80.*GeV ); - - P4EEtaPhiM p1( 200.*GeV, 1., 0., 80.*GeV ); - P4EEtaPhiM p2( 200.*GeV, 3., M_PI, 90.*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setMassMax( 90.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setMassMin( 85.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "mass", 0.*GeV, 80.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "mass", 85.*GeV, 90.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - } - - /// Test filtering objects based on their Pt - void testPtFilter() - { - MomentumFilter<I4Momentum> filter; - filter.setPtMin( 0.*GeV ); - filter.setPtMax( 20.*GeV ); - - P4EEtaPhiM p1( 200.*GeV, 3., M_PI, 90.*GeV ); //> Pt ~= 18 GeV - P4EEtaPhiM p2( 200.*GeV, 1., 0., 80.*GeV ); //> Pt ~= 119 GeV - - CPPUNIT_ASSERT( 17*GeV <= p1.pt() && p1.pt() <= 18*GeV ); - CPPUNIT_ASSERT( 118*GeV <= p2.pt() && p2.pt() <= 119*GeV ); - - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setPtMax( 119.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setPtMin( 20.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - filter.setRange( "pt", 0.*GeV, 20.*GeV ); - CPPUNIT_ASSERT( filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( !filter.isAccepted(&p2) ); - - filter.setRange( "pt", 20.*GeV, 119.*GeV ); - CPPUNIT_ASSERT( !filter.isAccepted(&p1) ); - CPPUNIT_ASSERT( filter.isAccepted(&p2) ); - - } - -}; - -/// Registration of the test suite "MomentumFilterTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( MomentumFilterTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_testdriver.cxx> diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx deleted file mode 100644 index b71bc55fd55..00000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx +++ /dev/null @@ -1,247 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// Class to test the PdgIdFilter class -/// Author : S.Binet<binet@cern.ch> - -// CppUnit includes -#include<cppunit/extensions/HelperMacros.h> -#include<cppunit/Exception.h> - -// STL includes -#include <iostream> -#include <stdexcept> -#include <cmath> - -// CLHEP includes -#include "CLHEP/Units/SystemOfUnits.h" -#include "AtlasHepMC/GenParticle.h" - -#include "AthContainers/DataVector.h" - -// EventKernel includes -#include "EventKernel/IParticle.h" - -// FourMom includes -#include "FourMom/P4PxPyPzE.h" -#include "FourMom/P4EEtaPhiM.h" - -// JetEvent -#include "JetEvent/Jet.h" -#include "JetEvent/JetCollection.h" - -// McParticleEvent -#include "McParticleEvent/TruthParticle.h" - -// AnalysisUtils includes -#include "AnalysisUtils/AnalysisSelection.h" -#include "AnalysisUtils/AnalysisCombination.h" -#include "AnalysisUtils/PdgIdFilter.h" - -class PdgIdFilterTest : public CppUnit::TestFixture -{ - /// Definition of the unit test suite " PdgIdFilterTest" - CPPUNIT_TEST_SUITE( PdgIdFilterTest ); - - CPPUNIT_TEST( testCopyPdgIdFilter ); - CPPUNIT_TEST( testSettersAndGetters ); - - CPPUNIT_TEST( testBQuarkFilter ); - - CPPUNIT_TEST( testLightFlavourFilter ); - CPPUNIT_TEST( testHeavyFlavourFilter ); - - /// end the definition test suite - CPPUNIT_TEST_SUITE_END(); - -private: - unsigned int m_nJets; - unsigned int m_nLightJets; - unsigned int m_nBJets; - JetCollection * m_jets; - -public: - - /// Set up the data members - void setUp() - { - m_nJets = 10; - m_nLightJets = 8; - m_nBJets = 2; - m_jets = new JetCollection; - - const double px = 100.*GeV; - const double py = 100.*GeV; - const double pz = 100.*GeV; - const double E = 200.*GeV; - - std::vector<PDG::pidType> pdgs; - pdgs.push_back( PDG::null ); - pdgs.push_back( PDG::d ); - pdgs.push_back( PDG::s ); - pdgs.push_back( PDG::b ); - - for ( unsigned int i = 0; i < m_nJets; ++i ) { - Jet * jet = 0; - jet = new Jet(); - - jet->set4Mom( P4PxPyPzE( ((i%4)+1)*px, ((i%4)+1)*py, - ((i%4)+1)*pz, ((i%4)+1)*E ) ); - jet->set_pdgId( pdgs[i%4] ); - m_jets->push_back(jet); - /* - std::cout << "\tjet " << i - << "pdgId= " << jet->pdgId() - << std::endl; - */ - } - } - - /// destroy any on-the-heap-created data member - void tearDown() - { - if ( m_jets ) { - delete m_jets; - m_jets = 0; - } - } - - /// Test that PdgIdFilter cuts are well copied - void testCopyPdgIdFilter() - { - PdgIdFilter<IParticle> orig; - - Jet bbar; - bbar.set_pdgId( PDG::b ); - CPPUNIT_ASSERT( orig.isAccepted( &bbar ) ); - - bbar.set_pdgId( PDG::anti_b ); - CPPUNIT_ASSERT( orig.isAccepted( &bbar ) ); - - PdgIdFilter<IParticle> filter; - filter.setPdgId( PDG::b ); - CPPUNIT_ASSERT( !filter.isAccepted( &bbar ) ); - - filter.setFilter( &orig ); - CPPUNIT_ASSERT( filter.isAccepted( &bbar ) ); - - orig.setPdgId( PDG::b ); - CPPUNIT_ASSERT( !orig.isAccepted( &bbar ) ); - - filter.setFilter( &orig ); - CPPUNIT_ASSERT( !filter.isAccepted( &bbar ) ); - - } - - /// Test setters and getters - void testSettersAndGetters() - { - PdgIdFilter<IParticle> filter; - CPPUNIT_ASSERT( true == filter.matchSign() ); - - filter.setMatchSign( false ); - CPPUNIT_ASSERT( false == filter.matchSign() ); - - filter.setMatchSign( true ); - CPPUNIT_ASSERT( true == filter.matchSign() ); - - } - - /// Test that PdgIdFilter selects b-quarks - void testBQuarkFilter() - { - PdgIdFilter<IParticle> filter; - filter.setPdgId( PDG::b ); - - Jet bjet; - - bjet.set_pdgId( PDG::b ); - CPPUNIT_ASSERT( filter.isAccepted( &bjet ) ); - - bjet.set_pdgId( PDG::anti_b ); - CPPUNIT_ASSERT( !filter.isAccepted( &bjet ) ); - - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted( &bjet ) ); - - HepMC::GenParticle hepBQuark; - hepBQuark.set_pdg_id( static_cast<int>(PDG::anti_b) ); - TruthParticle bquark(&hepBQuark); - filter.setMatchSign( false ); - CPPUNIT_ASSERT( filter.isAccepted( &bquark ) ); - - filter.setMatchSign( true ); - CPPUNIT_ASSERT( !filter.isAccepted( &bquark ) ); - } - - /// Test the filtering on light flavour - void testLightFlavourFilter() - { - ParticleCandidateList pdgIds; - pdgIds.clear(); - pdgIds.addLightJets(); - - //> Create a light jet filter - PdgIdFilter<IParticle> ljetFilter; - ljetFilter.setPdgIds( pdgIds ); - - // Test with a std::vector - std::vector<Jet*> lightJets; - CPPUNIT_ASSERT( lightJets.size() == static_cast<unsigned int>(0) ); - AnalysisUtils::copy_if( m_jets->begin(), - m_jets->end(), - std::back_inserter(lightJets), - ljetFilter ); - CPPUNIT_ASSERT( lightJets.size() == m_nLightJets ); - - // Test with a Selection - AnalysisUtils::Selection<PdgIdFilter<IParticle> > ljetFilterSel; - ljetFilterSel.setPdgIds( pdgIds ); - - lightJets.clear(); - CPPUNIT_ASSERT( lightJets.size() == static_cast<unsigned int>(0) ); - ljetFilterSel.getObjects( m_jets, lightJets); - - CPPUNIT_ASSERT( (lightJets.size() == m_nLightJets) ); - - // Test with a JetCollection - JetCollection lJets(SG::VIEW_ELEMENTS); - CPPUNIT_ASSERT( lJets.size() == static_cast<unsigned int>(0) ); - AnalysisUtils::copy_if( m_jets->begin(), - m_jets->end(), - std::back_inserter(lJets), - ljetFilter ); - CPPUNIT_ASSERT( lJets.size() == m_nLightJets ); - } - - /// Test the filtering on heavy flavour - void testHeavyFlavourFilter() - { - ParticleCandidateList pdgIds; - - //> Create a b-jet filter - PdgIdFilter<IParticle> bjetFilter; - pdgIds.clear(); - pdgIds.add( PDG::b ); - pdgIds.add( PDG::anti_b ); - bjetFilter.setPdgIds( pdgIds ); - - std::vector<Jet*> bJets; - AnalysisUtils::copy_if( m_jets->begin(), - m_jets->end(), - std::back_inserter(bJets), - bjetFilter ); - - CPPUNIT_ASSERT( bJets.size() == m_nBJets ); - - return; - } -}; - -/// Registration of the test suite "PdgIdFilterTest" so it will be -/// recognized by the main test program which drives the different tests -CPPUNIT_TEST_SUITE_REGISTRATION( PdgIdFilterTest ); - -/// CppUnit test-driver common for all the cppunit test classes. -#include <TestTools/CppUnit_SGtestdriver.cxx> -- GitLab